diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index bff4106530876..ba686cd881b57 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -337,6 +337,7 @@ com.azure.resourcemanager:azure-resourcemanager-mobilenetwork;1.0.0-beta.2;1.0.0 com.azure.resourcemanager:azure-resourcemanager-azureadexternalidentities;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-dashboard;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-servicelinker;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 com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index f24a3d5566bd4..0e2ab134583e5 100644 --- a/pom.xml +++ b/pom.xml @@ -963,6 +963,7 @@ sdk/servicelinker sdk/signalr 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..da54b11eff238 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-04-27) + +- 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-v5. 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..9588666af5cc9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/README.md @@ -0,0 +1,102 @@ +# 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-v5. 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 + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/sql/azure-resourcemanager-sql-generated/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/sql/azure-resourcemanager-sql-generated/SAMPLE.md b/sdk/sql/azure-resourcemanager-sql-generated/SAMPLE.md new file mode 100644 index 0000000000000..ad2bc4721caf1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/SAMPLE.md @@ -0,0 +1,14853 @@ +# Code snippets and samples + + +## BackupShortTermRetentionPolicies + +- [CreateOrUpdate](#backupshorttermretentionpolicies_createorupdate) +- [Get](#backupshorttermretentionpolicies_get) +- [ListByDatabase](#backupshorttermretentionpolicies_listbydatabase) +- [Update](#backupshorttermretentionpolicies_update) + +## Capabilities + +- [ListByLocation](#capabilities_listbylocation) + +## DataMaskingPolicies + +- [CreateOrUpdate](#datamaskingpolicies_createorupdate) +- [Get](#datamaskingpolicies_get) + +## DataMaskingRules + +- [CreateOrUpdate](#datamaskingrules_createorupdate) +- [ListByDatabase](#datamaskingrules_listbydatabase) + +## DataWarehouseUserActivitiesOperation + +- [Get](#datawarehouseuseractivitiesoperation_get) +- [ListByDatabase](#datawarehouseuseractivitiesoperation_listbydatabase) + +## DatabaseAdvisors + +- [Get](#databaseadvisors_get) +- [ListByDatabase](#databaseadvisors_listbydatabase) +- [Update](#databaseadvisors_update) + +## DatabaseAutomaticTuning + +- [Get](#databaseautomatictuning_get) +- [Update](#databaseautomatictuning_update) + +## DatabaseBlobAuditingPolicies + +- [CreateOrUpdate](#databaseblobauditingpolicies_createorupdate) +- [Get](#databaseblobauditingpolicies_get) +- [ListByDatabase](#databaseblobauditingpolicies_listbydatabase) + +## DatabaseColumns + +- [Get](#databasecolumns_get) +- [ListByDatabase](#databasecolumns_listbydatabase) +- [ListByTable](#databasecolumns_listbytable) + +## DatabaseExtensionsOperation + +- [CreateOrUpdate](#databaseextensionsoperation_createorupdate) +- [Get](#databaseextensionsoperation_get) +- [ListByDatabase](#databaseextensionsoperation_listbydatabase) + +## DatabaseOperations + +- [Cancel](#databaseoperations_cancel) +- [ListByDatabase](#databaseoperations_listbydatabase) + +## DatabaseRecommendedActions + +- [Get](#databaserecommendedactions_get) +- [ListByDatabaseAdvisor](#databaserecommendedactions_listbydatabaseadvisor) +- [Update](#databaserecommendedactions_update) + +## DatabaseSchemas + +- [Get](#databaseschemas_get) +- [ListByDatabase](#databaseschemas_listbydatabase) + +## DatabaseSecurityAlertPolicies + +- [CreateOrUpdate](#databasesecurityalertpolicies_createorupdate) +- [Get](#databasesecurityalertpolicies_get) +- [ListByDatabase](#databasesecurityalertpolicies_listbydatabase) + +## DatabaseTables + +- [Get](#databasetables_get) +- [ListBySchema](#databasetables_listbyschema) + +## DatabaseUsages + +- [ListByDatabase](#databaseusages_listbydatabase) + +## DatabaseVulnerabilityAssessmentRuleBaselines + +- [CreateOrUpdate](#databasevulnerabilityassessmentrulebaselines_createorupdate) +- [Delete](#databasevulnerabilityassessmentrulebaselines_delete) +- [Get](#databasevulnerabilityassessmentrulebaselines_get) + +## DatabaseVulnerabilityAssessmentScans + +- [Export](#databasevulnerabilityassessmentscans_export) +- [Get](#databasevulnerabilityassessmentscans_get) +- [InitiateScan](#databasevulnerabilityassessmentscans_initiatescan) +- [ListByDatabase](#databasevulnerabilityassessmentscans_listbydatabase) + +## DatabaseVulnerabilityAssessments + +- [CreateOrUpdate](#databasevulnerabilityassessments_createorupdate) +- [Delete](#databasevulnerabilityassessments_delete) +- [Get](#databasevulnerabilityassessments_get) +- [ListByDatabase](#databasevulnerabilityassessments_listbydatabase) + +## Databases + +- [CreateOrUpdate](#databases_createorupdate) +- [Delete](#databases_delete) +- [Export](#databases_export) +- [Failover](#databases_failover) +- [Get](#databases_get) +- [ImportMethod](#databases_importmethod) +- [ListByElasticPool](#databases_listbyelasticpool) +- [ListByServer](#databases_listbyserver) +- [ListInaccessibleByServer](#databases_listinaccessiblebyserver) +- [ListMetricDefinitions](#databases_listmetricdefinitions) +- [ListMetrics](#databases_listmetrics) +- [Pause](#databases_pause) +- [Rename](#databases_rename) +- [Resume](#databases_resume) +- [Update](#databases_update) +- [UpgradeDataWarehouse](#databases_upgradedatawarehouse) + +## DeletedServers + +- [Get](#deletedservers_get) +- [List](#deletedservers_list) +- [ListByLocation](#deletedservers_listbylocation) +- [Recover](#deletedservers_recover) + +## DistributedAvailabilityGroups + +- [CreateOrUpdate](#distributedavailabilitygroups_createorupdate) +- [Delete](#distributedavailabilitygroups_delete) +- [Get](#distributedavailabilitygroups_get) +- [ListByInstance](#distributedavailabilitygroups_listbyinstance) +- [Update](#distributedavailabilitygroups_update) + +## ElasticPoolActivities + +- [ListByElasticPool](#elasticpoolactivities_listbyelasticpool) + +## ElasticPoolDatabaseActivities + +- [ListByElasticPool](#elasticpooldatabaseactivities_listbyelasticpool) + +## ElasticPoolOperations + +- [Cancel](#elasticpooloperations_cancel) +- [ListByElasticPool](#elasticpooloperations_listbyelasticpool) + +## ElasticPools + +- [CreateOrUpdate](#elasticpools_createorupdate) +- [Delete](#elasticpools_delete) +- [Failover](#elasticpools_failover) +- [Get](#elasticpools_get) +- [ListByServer](#elasticpools_listbyserver) +- [ListMetricDefinitions](#elasticpools_listmetricdefinitions) +- [ListMetrics](#elasticpools_listmetrics) +- [Update](#elasticpools_update) + +## EncryptionProtectors + +- [CreateOrUpdate](#encryptionprotectors_createorupdate) +- [Get](#encryptionprotectors_get) +- [ListByServer](#encryptionprotectors_listbyserver) +- [Revalidate](#encryptionprotectors_revalidate) + +## EndpointCertificates + +- [Get](#endpointcertificates_get) +- [ListByInstance](#endpointcertificates_listbyinstance) + +## ExtendedDatabaseBlobAuditingPolicies + +- [CreateOrUpdate](#extendeddatabaseblobauditingpolicies_createorupdate) +- [Get](#extendeddatabaseblobauditingpolicies_get) +- [ListByDatabase](#extendeddatabaseblobauditingpolicies_listbydatabase) + +## ExtendedServerBlobAuditingPolicies + +- [CreateOrUpdate](#extendedserverblobauditingpolicies_createorupdate) +- [Get](#extendedserverblobauditingpolicies_get) +- [ListByServer](#extendedserverblobauditingpolicies_listbyserver) + +## FailoverGroups + +- [CreateOrUpdate](#failovergroups_createorupdate) +- [Delete](#failovergroups_delete) +- [Failover](#failovergroups_failover) +- [ForceFailoverAllowDataLoss](#failovergroups_forcefailoverallowdataloss) +- [Get](#failovergroups_get) +- [ListByServer](#failovergroups_listbyserver) +- [Update](#failovergroups_update) + +## FirewallRules + +- [CreateOrUpdate](#firewallrules_createorupdate) +- [Delete](#firewallrules_delete) +- [Get](#firewallrules_get) +- [ListByServer](#firewallrules_listbyserver) +- [Replace](#firewallrules_replace) + +## GeoBackupPolicies + +- [CreateOrUpdate](#geobackuppolicies_createorupdate) +- [Get](#geobackuppolicies_get) +- [ListByDatabase](#geobackuppolicies_listbydatabase) + +## IPv6FirewallRules + +- [CreateOrUpdate](#ipv6firewallrules_createorupdate) +- [Delete](#ipv6firewallrules_delete) +- [Get](#ipv6firewallrules_get) +- [ListByServer](#ipv6firewallrules_listbyserver) + +## InstanceFailoverGroups + +- [CreateOrUpdate](#instancefailovergroups_createorupdate) +- [Delete](#instancefailovergroups_delete) +- [Failover](#instancefailovergroups_failover) +- [ForceFailoverAllowDataLoss](#instancefailovergroups_forcefailoverallowdataloss) +- [Get](#instancefailovergroups_get) +- [ListByLocation](#instancefailovergroups_listbylocation) + +## InstancePools + +- [CreateOrUpdate](#instancepools_createorupdate) +- [Delete](#instancepools_delete) +- [GetByResourceGroup](#instancepools_getbyresourcegroup) +- [List](#instancepools_list) +- [ListByResourceGroup](#instancepools_listbyresourcegroup) +- [Update](#instancepools_update) + +## JobAgents + +- [CreateOrUpdate](#jobagents_createorupdate) +- [Delete](#jobagents_delete) +- [Get](#jobagents_get) +- [ListByServer](#jobagents_listbyserver) +- [Update](#jobagents_update) + +## JobCredentials + +- [CreateOrUpdate](#jobcredentials_createorupdate) +- [Delete](#jobcredentials_delete) +- [Get](#jobcredentials_get) +- [ListByAgent](#jobcredentials_listbyagent) + +## JobExecutions + +- [Cancel](#jobexecutions_cancel) +- [Create](#jobexecutions_create) +- [CreateOrUpdate](#jobexecutions_createorupdate) +- [Get](#jobexecutions_get) +- [ListByAgent](#jobexecutions_listbyagent) +- [ListByJob](#jobexecutions_listbyjob) + +## JobStepExecutions + +- [Get](#jobstepexecutions_get) +- [ListByJobExecution](#jobstepexecutions_listbyjobexecution) + +## JobSteps + +- [CreateOrUpdate](#jobsteps_createorupdate) +- [Delete](#jobsteps_delete) +- [Get](#jobsteps_get) +- [GetByVersion](#jobsteps_getbyversion) +- [ListByJob](#jobsteps_listbyjob) +- [ListByVersion](#jobsteps_listbyversion) + +## JobTargetExecutions + +- [Get](#jobtargetexecutions_get) +- [ListByJobExecution](#jobtargetexecutions_listbyjobexecution) +- [ListByStep](#jobtargetexecutions_listbystep) + +## JobTargetGroups + +- [CreateOrUpdate](#jobtargetgroups_createorupdate) +- [Delete](#jobtargetgroups_delete) +- [Get](#jobtargetgroups_get) +- [ListByAgent](#jobtargetgroups_listbyagent) + +## JobVersions + +- [Get](#jobversions_get) +- [ListByJob](#jobversions_listbyjob) + +## Jobs + +- [CreateOrUpdate](#jobs_createorupdate) +- [Delete](#jobs_delete) +- [Get](#jobs_get) +- [ListByAgent](#jobs_listbyagent) + +## LedgerDigestUploadsOperation + +- [CreateOrUpdate](#ledgerdigestuploadsoperation_createorupdate) +- [Disable](#ledgerdigestuploadsoperation_disable) +- [Get](#ledgerdigestuploadsoperation_get) +- [ListByDatabase](#ledgerdigestuploadsoperation_listbydatabase) + +## LongTermRetentionBackups + +- [Copy](#longtermretentionbackups_copy) +- [CopyByResourceGroup](#longtermretentionbackups_copybyresourcegroup) +- [Delete](#longtermretentionbackups_delete) +- [DeleteByResourceGroup](#longtermretentionbackups_deletebyresourcegroup) +- [Get](#longtermretentionbackups_get) +- [GetByResourceGroup](#longtermretentionbackups_getbyresourcegroup) +- [ListByDatabase](#longtermretentionbackups_listbydatabase) +- [ListByLocation](#longtermretentionbackups_listbylocation) +- [ListByResourceGroupDatabase](#longtermretentionbackups_listbyresourcegroupdatabase) +- [ListByResourceGroupLocation](#longtermretentionbackups_listbyresourcegrouplocation) +- [ListByResourceGroupServer](#longtermretentionbackups_listbyresourcegroupserver) +- [ListByServer](#longtermretentionbackups_listbyserver) +- [Update](#longtermretentionbackups_update) +- [UpdateByResourceGroup](#longtermretentionbackups_updatebyresourcegroup) + +## LongTermRetentionManagedInstanceBackups + +- [Delete](#longtermretentionmanagedinstancebackups_delete) +- [DeleteByResourceGroup](#longtermretentionmanagedinstancebackups_deletebyresourcegroup) +- [Get](#longtermretentionmanagedinstancebackups_get) +- [GetByResourceGroup](#longtermretentionmanagedinstancebackups_getbyresourcegroup) +- [ListByDatabase](#longtermretentionmanagedinstancebackups_listbydatabase) +- [ListByInstance](#longtermretentionmanagedinstancebackups_listbyinstance) +- [ListByLocation](#longtermretentionmanagedinstancebackups_listbylocation) +- [ListByResourceGroupDatabase](#longtermretentionmanagedinstancebackups_listbyresourcegroupdatabase) +- [ListByResourceGroupInstance](#longtermretentionmanagedinstancebackups_listbyresourcegroupinstance) +- [ListByResourceGroupLocation](#longtermretentionmanagedinstancebackups_listbyresourcegrouplocation) + +## LongTermRetentionPolicies + +- [CreateOrUpdate](#longtermretentionpolicies_createorupdate) +- [Get](#longtermretentionpolicies_get) +- [ListByDatabase](#longtermretentionpolicies_listbydatabase) + +## MaintenanceWindowOptionsOperation + +- [Get](#maintenancewindowoptionsoperation_get) + +## MaintenanceWindowsOperation + +- [CreateOrUpdate](#maintenancewindowsoperation_createorupdate) +- [Get](#maintenancewindowsoperation_get) + +## ManagedBackupShortTermRetentionPolicies + +- [CreateOrUpdate](#managedbackupshorttermretentionpolicies_createorupdate) +- [Get](#managedbackupshorttermretentionpolicies_get) +- [ListByDatabase](#managedbackupshorttermretentionpolicies_listbydatabase) +- [Update](#managedbackupshorttermretentionpolicies_update) + +## ManagedDatabaseColumns + +- [Get](#manageddatabasecolumns_get) +- [ListByDatabase](#manageddatabasecolumns_listbydatabase) +- [ListByTable](#manageddatabasecolumns_listbytable) + +## ManagedDatabaseQueries + +- [Get](#manageddatabasequeries_get) +- [ListByQuery](#manageddatabasequeries_listbyquery) + +## ManagedDatabaseRecommendedSensitivityLabels + +- [Update](#manageddatabaserecommendedsensitivitylabels_update) + +## ManagedDatabaseRestoreDetails + +- [Get](#manageddatabaserestoredetails_get) + +## ManagedDatabaseSchemas + +- [Get](#manageddatabaseschemas_get) +- [ListByDatabase](#manageddatabaseschemas_listbydatabase) + +## ManagedDatabaseSecurityAlertPolicies + +- [CreateOrUpdate](#manageddatabasesecurityalertpolicies_createorupdate) +- [Get](#manageddatabasesecurityalertpolicies_get) +- [ListByDatabase](#manageddatabasesecurityalertpolicies_listbydatabase) + +## ManagedDatabaseSecurityEvents + +- [ListByDatabase](#manageddatabasesecurityevents_listbydatabase) + +## ManagedDatabaseSensitivityLabels + +- [CreateOrUpdate](#manageddatabasesensitivitylabels_createorupdate) +- [Delete](#manageddatabasesensitivitylabels_delete) +- [DisableRecommendation](#manageddatabasesensitivitylabels_disablerecommendation) +- [EnableRecommendation](#manageddatabasesensitivitylabels_enablerecommendation) +- [Get](#manageddatabasesensitivitylabels_get) +- [ListCurrentByDatabase](#manageddatabasesensitivitylabels_listcurrentbydatabase) +- [ListRecommendedByDatabase](#manageddatabasesensitivitylabels_listrecommendedbydatabase) +- [Update](#manageddatabasesensitivitylabels_update) + +## ManagedDatabaseTables + +- [Get](#manageddatabasetables_get) +- [ListBySchema](#manageddatabasetables_listbyschema) + +## ManagedDatabaseTransparentDataEncryption + +- [CreateOrUpdate](#manageddatabasetransparentdataencryption_createorupdate) +- [Get](#manageddatabasetransparentdataencryption_get) +- [ListByDatabase](#manageddatabasetransparentdataencryption_listbydatabase) + +## ManagedDatabaseVulnerabilityAssessmentRuleBaselines + +- [CreateOrUpdate](#manageddatabasevulnerabilityassessmentrulebaselines_createorupdate) +- [Delete](#manageddatabasevulnerabilityassessmentrulebaselines_delete) +- [Get](#manageddatabasevulnerabilityassessmentrulebaselines_get) + +## ManagedDatabaseVulnerabilityAssessmentScans + +- [Export](#manageddatabasevulnerabilityassessmentscans_export) +- [Get](#manageddatabasevulnerabilityassessmentscans_get) +- [InitiateScan](#manageddatabasevulnerabilityassessmentscans_initiatescan) +- [ListByDatabase](#manageddatabasevulnerabilityassessmentscans_listbydatabase) + +## ManagedDatabaseVulnerabilityAssessments + +- [CreateOrUpdate](#manageddatabasevulnerabilityassessments_createorupdate) +- [Delete](#manageddatabasevulnerabilityassessments_delete) +- [Get](#manageddatabasevulnerabilityassessments_get) +- [ListByDatabase](#manageddatabasevulnerabilityassessments_listbydatabase) + +## ManagedDatabases + +- [CompleteRestore](#manageddatabases_completerestore) +- [CreateOrUpdate](#manageddatabases_createorupdate) +- [Delete](#manageddatabases_delete) +- [Get](#manageddatabases_get) +- [ListByInstance](#manageddatabases_listbyinstance) +- [ListInaccessibleByInstance](#manageddatabases_listinaccessiblebyinstance) +- [Update](#manageddatabases_update) + +## ManagedInstanceAdministrators + +- [CreateOrUpdate](#managedinstanceadministrators_createorupdate) +- [Delete](#managedinstanceadministrators_delete) +- [Get](#managedinstanceadministrators_get) +- [ListByInstance](#managedinstanceadministrators_listbyinstance) + +## ManagedInstanceAzureADOnlyAuthentications + +- [CreateOrUpdate](#managedinstanceazureadonlyauthentications_createorupdate) +- [Delete](#managedinstanceazureadonlyauthentications_delete) +- [Get](#managedinstanceazureadonlyauthentications_get) +- [ListByInstance](#managedinstanceazureadonlyauthentications_listbyinstance) + +## ManagedInstanceEncryptionProtectors + +- [CreateOrUpdate](#managedinstanceencryptionprotectors_createorupdate) +- [Get](#managedinstanceencryptionprotectors_get) +- [ListByInstance](#managedinstanceencryptionprotectors_listbyinstance) +- [Revalidate](#managedinstanceencryptionprotectors_revalidate) + +## ManagedInstanceKeys + +- [CreateOrUpdate](#managedinstancekeys_createorupdate) +- [Delete](#managedinstancekeys_delete) +- [Get](#managedinstancekeys_get) +- [ListByInstance](#managedinstancekeys_listbyinstance) + +## ManagedInstanceLongTermRetentionPolicies + +- [CreateOrUpdate](#managedinstancelongtermretentionpolicies_createorupdate) +- [Get](#managedinstancelongtermretentionpolicies_get) +- [ListByDatabase](#managedinstancelongtermretentionpolicies_listbydatabase) + +## ManagedInstanceOperations + +- [Cancel](#managedinstanceoperations_cancel) +- [Get](#managedinstanceoperations_get) +- [ListByManagedInstance](#managedinstanceoperations_listbymanagedinstance) + +## ManagedInstancePrivateEndpointConnections + +- [CreateOrUpdate](#managedinstanceprivateendpointconnections_createorupdate) +- [Delete](#managedinstanceprivateendpointconnections_delete) +- [Get](#managedinstanceprivateendpointconnections_get) +- [ListByManagedInstance](#managedinstanceprivateendpointconnections_listbymanagedinstance) + +## ManagedInstancePrivateLinkResources + +- [Get](#managedinstanceprivatelinkresources_get) +- [ListByManagedInstance](#managedinstanceprivatelinkresources_listbymanagedinstance) + +## ManagedInstanceTdeCertificates + +- [Create](#managedinstancetdecertificates_create) + +## ManagedInstanceVulnerabilityAssessments + +- [CreateOrUpdate](#managedinstancevulnerabilityassessments_createorupdate) +- [Delete](#managedinstancevulnerabilityassessments_delete) +- [Get](#managedinstancevulnerabilityassessments_get) +- [ListByInstance](#managedinstancevulnerabilityassessments_listbyinstance) + +## ManagedInstances + +- [CreateOrUpdate](#managedinstances_createorupdate) +- [Delete](#managedinstances_delete) +- [Failover](#managedinstances_failover) +- [GetByResourceGroup](#managedinstances_getbyresourcegroup) +- [List](#managedinstances_list) +- [ListByInstancePool](#managedinstances_listbyinstancepool) +- [ListByManagedInstance](#managedinstances_listbymanagedinstance) +- [ListByResourceGroup](#managedinstances_listbyresourcegroup) +- [Update](#managedinstances_update) + +## ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies + +- [CreateOrUpdate](#managedrestorabledroppeddatabasebackupshorttermretentionpolicies_createorupdate) +- [Get](#managedrestorabledroppeddatabasebackupshorttermretentionpolicies_get) +- [ListByRestorableDroppedDatabase](#managedrestorabledroppeddatabasebackupshorttermretentionpolicies_listbyrestorabledroppeddatabase) +- [Update](#managedrestorabledroppeddatabasebackupshorttermretentionpolicies_update) + +## ManagedServerSecurityAlertPolicies + +- [CreateOrUpdate](#managedserversecurityalertpolicies_createorupdate) +- [Get](#managedserversecurityalertpolicies_get) +- [ListByInstance](#managedserversecurityalertpolicies_listbyinstance) + +## OutboundFirewallRules + +- [CreateOrUpdate](#outboundfirewallrules_createorupdate) +- [Delete](#outboundfirewallrules_delete) +- [Get](#outboundfirewallrules_get) +- [ListByServer](#outboundfirewallrules_listbyserver) + +## PrivateEndpointConnections + +- [CreateOrUpdate](#privateendpointconnections_createorupdate) +- [Delete](#privateendpointconnections_delete) +- [Get](#privateendpointconnections_get) +- [ListByServer](#privateendpointconnections_listbyserver) + +## PrivateLinkResources + +- [Get](#privatelinkresources_get) +- [ListByServer](#privatelinkresources_listbyserver) + +## RecommendedSensitivityLabels + +- [Update](#recommendedsensitivitylabels_update) + +## RecoverableDatabases + +- [Get](#recoverabledatabases_get) +- [ListByServer](#recoverabledatabases_listbyserver) + +## RecoverableManagedDatabases + +- [Get](#recoverablemanageddatabases_get) +- [ListByInstance](#recoverablemanageddatabases_listbyinstance) + +## ReplicationLinks + +- [Delete](#replicationlinks_delete) +- [Failover](#replicationlinks_failover) +- [FailoverAllowDataLoss](#replicationlinks_failoverallowdataloss) +- [Get](#replicationlinks_get) +- [ListByDatabase](#replicationlinks_listbydatabase) +- [ListByServer](#replicationlinks_listbyserver) +- [Unlink](#replicationlinks_unlink) + +## RestorableDroppedDatabases + +- [Get](#restorabledroppeddatabases_get) +- [ListByServer](#restorabledroppeddatabases_listbyserver) + +## RestorableDroppedManagedDatabases + +- [Get](#restorabledroppedmanageddatabases_get) +- [ListByInstance](#restorabledroppedmanageddatabases_listbyinstance) + +## RestorePoints + +- [Create](#restorepoints_create) +- [Delete](#restorepoints_delete) +- [Get](#restorepoints_get) +- [ListByDatabase](#restorepoints_listbydatabase) + +## SensitivityLabels + +- [CreateOrUpdate](#sensitivitylabels_createorupdate) +- [Delete](#sensitivitylabels_delete) +- [DisableRecommendation](#sensitivitylabels_disablerecommendation) +- [EnableRecommendation](#sensitivitylabels_enablerecommendation) +- [Get](#sensitivitylabels_get) +- [ListCurrentByDatabase](#sensitivitylabels_listcurrentbydatabase) +- [ListRecommendedByDatabase](#sensitivitylabels_listrecommendedbydatabase) +- [Update](#sensitivitylabels_update) + +## ServerAdvisors + +- [Get](#serveradvisors_get) +- [ListByServer](#serveradvisors_listbyserver) +- [Update](#serveradvisors_update) + +## ServerAutomaticTuning + +- [Get](#serverautomatictuning_get) +- [Update](#serverautomatictuning_update) + +## ServerAzureADAdministrators + +- [CreateOrUpdate](#serverazureadadministrators_createorupdate) +- [Delete](#serverazureadadministrators_delete) +- [Get](#serverazureadadministrators_get) +- [ListByServer](#serverazureadadministrators_listbyserver) + +## ServerAzureADOnlyAuthentications + +- [CreateOrUpdate](#serverazureadonlyauthentications_createorupdate) +- [Delete](#serverazureadonlyauthentications_delete) +- [Get](#serverazureadonlyauthentications_get) +- [ListByServer](#serverazureadonlyauthentications_listbyserver) + +## ServerBlobAuditingPolicies + +- [CreateOrUpdate](#serverblobauditingpolicies_createorupdate) +- [Get](#serverblobauditingpolicies_get) +- [ListByServer](#serverblobauditingpolicies_listbyserver) + +## ServerCommunicationLinks + +- [CreateOrUpdate](#servercommunicationlinks_createorupdate) +- [Delete](#servercommunicationlinks_delete) +- [Get](#servercommunicationlinks_get) +- [ListByServer](#servercommunicationlinks_listbyserver) + +## ServerConnectionPolicies + +- [CreateOrUpdate](#serverconnectionpolicies_createorupdate) +- [Get](#serverconnectionpolicies_get) +- [ListByServer](#serverconnectionpolicies_listbyserver) + +## ServerDevOpsAuditSettings + +- [CreateOrUpdate](#serverdevopsauditsettings_createorupdate) +- [Get](#serverdevopsauditsettings_get) +- [ListByServer](#serverdevopsauditsettings_listbyserver) + +## ServerDnsAliases + +- [Acquire](#serverdnsaliases_acquire) +- [CreateOrUpdate](#serverdnsaliases_createorupdate) +- [Delete](#serverdnsaliases_delete) +- [Get](#serverdnsaliases_get) +- [ListByServer](#serverdnsaliases_listbyserver) + +## ServerKeys + +- [CreateOrUpdate](#serverkeys_createorupdate) +- [Delete](#serverkeys_delete) +- [Get](#serverkeys_get) +- [ListByServer](#serverkeys_listbyserver) + +## ServerOperations + +- [ListByServer](#serveroperations_listbyserver) + +## ServerSecurityAlertPolicies + +- [CreateOrUpdate](#serversecurityalertpolicies_createorupdate) +- [Get](#serversecurityalertpolicies_get) +- [ListByServer](#serversecurityalertpolicies_listbyserver) + +## ServerTrustCertificates + +- [CreateOrUpdate](#servertrustcertificates_createorupdate) +- [Delete](#servertrustcertificates_delete) +- [Get](#servertrustcertificates_get) +- [ListByInstance](#servertrustcertificates_listbyinstance) + +## ServerTrustGroups + +- [CreateOrUpdate](#servertrustgroups_createorupdate) +- [Delete](#servertrustgroups_delete) +- [Get](#servertrustgroups_get) +- [ListByInstance](#servertrustgroups_listbyinstance) +- [ListByLocation](#servertrustgroups_listbylocation) + +## ServerUsages + +- [ListByServer](#serverusages_listbyserver) + +## ServerVulnerabilityAssessments + +- [CreateOrUpdate](#servervulnerabilityassessments_createorupdate) +- [Delete](#servervulnerabilityassessments_delete) +- [Get](#servervulnerabilityassessments_get) +- [ListByServer](#servervulnerabilityassessments_listbyserver) + +## Servers + +- [CheckNameAvailability](#servers_checknameavailability) +- [CreateOrUpdate](#servers_createorupdate) +- [Delete](#servers_delete) +- [GetByResourceGroup](#servers_getbyresourcegroup) +- [ImportDatabase](#servers_importdatabase) +- [List](#servers_list) +- [ListByResourceGroup](#servers_listbyresourcegroup) +- [Update](#servers_update) + +## ServiceObjectives + +- [Get](#serviceobjectives_get) +- [ListByServer](#serviceobjectives_listbyserver) + +## SqlAgent + +- [CreateOrUpdate](#sqlagent_createorupdate) +- [Get](#sqlagent_get) + +## SubscriptionUsages + +- [Get](#subscriptionusages_get) +- [ListByLocation](#subscriptionusages_listbylocation) + +## SyncAgents + +- [CreateOrUpdate](#syncagents_createorupdate) +- [Delete](#syncagents_delete) +- [GenerateKey](#syncagents_generatekey) +- [Get](#syncagents_get) +- [ListByServer](#syncagents_listbyserver) +- [ListLinkedDatabases](#syncagents_listlinkeddatabases) + +## SyncGroups + +- [CancelSync](#syncgroups_cancelsync) +- [CreateOrUpdate](#syncgroups_createorupdate) +- [Delete](#syncgroups_delete) +- [Get](#syncgroups_get) +- [ListByDatabase](#syncgroups_listbydatabase) +- [ListHubSchemas](#syncgroups_listhubschemas) +- [ListLogs](#syncgroups_listlogs) +- [ListSyncDatabaseIds](#syncgroups_listsyncdatabaseids) +- [RefreshHubSchema](#syncgroups_refreshhubschema) +- [TriggerSync](#syncgroups_triggersync) +- [Update](#syncgroups_update) + +## SyncMembers + +- [CreateOrUpdate](#syncmembers_createorupdate) +- [Delete](#syncmembers_delete) +- [Get](#syncmembers_get) +- [ListBySyncGroup](#syncmembers_listbysyncgroup) +- [ListMemberSchemas](#syncmembers_listmemberschemas) +- [RefreshMemberSchema](#syncmembers_refreshmemberschema) +- [Update](#syncmembers_update) + +## TdeCertificates + +- [Create](#tdecertificates_create) + +## TimeZones + +- [Get](#timezones_get) +- [ListByLocation](#timezones_listbylocation) + +## TransparentDataEncryptions + +- [CreateOrUpdate](#transparentdataencryptions_createorupdate) +- [Get](#transparentdataencryptions_get) +- [ListByDatabase](#transparentdataencryptions_listbydatabase) + +## Usages + +- [ListByInstancePool](#usages_listbyinstancepool) + +## VirtualClusters + +- [Delete](#virtualclusters_delete) +- [GetByResourceGroup](#virtualclusters_getbyresourcegroup) +- [List](#virtualclusters_list) +- [ListByResourceGroup](#virtualclusters_listbyresourcegroup) +- [Update](#virtualclusters_update) +- [UpdateDnsServers](#virtualclusters_updatednsservers) + +## VirtualNetworkRules + +- [CreateOrUpdate](#virtualnetworkrules_createorupdate) +- [Delete](#virtualnetworkrules_delete) +- [Get](#virtualnetworkrules_get) +- [ListByServer](#virtualnetworkrules_listbyserver) + +## WorkloadClassifiers + +- [CreateOrUpdate](#workloadclassifiers_createorupdate) +- [Delete](#workloadclassifiers_delete) +- [Get](#workloadclassifiers_get) +- [ListByWorkloadGroup](#workloadclassifiers_listbyworkloadgroup) + +## WorkloadGroups + +- [CreateOrUpdate](#workloadgroups_createorupdate) +- [Delete](#workloadgroups_delete) +- [Get](#workloadgroups_get) +- [ListByDatabase](#workloadgroups_listbydatabase) +### BackupShortTermRetentionPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.DiffBackupIntervalInHours; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +/** Samples for BackupShortTermRetentionPolicies CreateOrUpdate. */ +public final class BackupShortTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/UpdateShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .backupShortTermRetentionPolicies() + .define(ShortTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("resourceGroup", "testsvr", "testdb") + .withRetentionDays(7) + .withDiffBackupIntervalInHours(DiffBackupIntervalInHours.TWO_FOUR) + .create(); + } +} +``` + +### BackupShortTermRetentionPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +/** Samples for BackupShortTermRetentionPolicies Get. */ +public final class BackupShortTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetShortTermRetentionPolicy.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .backupShortTermRetentionPolicies() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testsvr", "testdb", ShortTermRetentionPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### BackupShortTermRetentionPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for BackupShortTermRetentionPolicies ListByDatabase. */ +public final class BackupShortTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListShortTermRetentionPoliciesByDatabase.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .backupShortTermRetentionPolicies() + .listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} +``` + +### BackupShortTermRetentionPolicies_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.DiffBackupIntervalInHours; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +/** Samples for BackupShortTermRetentionPolicies Update. */ +public final class BackupShortTermRetentionPoliciesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/UpdateShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + BackupShortTermRetentionPolicy resource = + manager + .backupShortTermRetentionPolicies() + .getWithResponse( + "resourceGroup", "testsvr", "testdb", ShortTermRetentionPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withRetentionDays(7) + .withDiffBackupIntervalInHours(DiffBackupIntervalInHours.TWO_FOUR) + .apply(); + } +} +``` + +### Capabilities_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for Capabilities ListByLocation. */ +public final class CapabilitiesListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LocationCapabilityListByLocation.json + */ + /** + * Sample code: List subscription capabilities in the given location. + * + * @param manager Entry point to SqlManager. + */ + public static void listSubscriptionCapabilitiesInTheGivenLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.capabilities().listByLocationWithResponse("eastus", null, Context.NONE); + } +} +``` + +### DataMaskingPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.DataMaskingState; + +/** Samples for DataMaskingPolicies CreateOrUpdate. */ +public final class DataMaskingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyCreateOrUpdateMin.json + */ + /** + * Sample code: Create or update data masking policy min. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateDataMaskingPolicyMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingPolicies() + .define() + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withDataMaskingState(DataMaskingState.ENABLED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyCreateOrUpdateMax.json + */ + /** + * Sample code: Create or update data masking policy max. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateDataMaskingPolicyMax(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingPolicies() + .define() + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withDataMaskingState(DataMaskingState.ENABLED) + .withExemptPrincipals("testuser;") + .create(); + } +} +``` + +### DataMaskingPolicies_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DataMaskingPolicies Get. */ +public final class DataMaskingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyGet.json + */ + /** + * Sample code: Get data masking policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getDataMaskingPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingPolicies() + .getWithResponse("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", Context.NONE); + } +} +``` + +### DataMaskingRules_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.DataMaskingFunction; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRuleState; + +/** Samples for DataMaskingRules CreateOrUpdate. */ +public final class DataMaskingRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateDefaultMin.json + */ + /** + * Sample code: Create/Update data masking rule for default min. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForDefaultMin( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateDefaultMax.json + */ + /** + * Sample code: Create/Update data masking rule for default max. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForDefaultMax( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withAliasName("nickname") + .withRuleState(DataMaskingRuleState.ENABLED) + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateText.json + */ + /** + * Sample code: Create/Update data masking rule for text. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForText(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.TEXT) + .withPrefixSize("1") + .withSuffixSize("0") + .withReplacementString("asdf") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateNumber.json + */ + /** + * Sample code: Create/Update data masking rule for numbers. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForNumbers( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.NUMBER) + .withNumberFrom("0") + .withNumberTo("2") + .create(); + } +} +``` + +### DataMaskingRules_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DataMaskingRules ListByDatabase. */ +public final class DataMaskingRulesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleList.json + */ + /** + * Sample code: List data masking rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listDataMaskingRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .listByDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", Context.NONE); + } +} +``` + +### DataWarehouseUserActivitiesOperation_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivityName; + +/** Samples for DataWarehouseUserActivitiesOperation Get. */ +public final class DataWarehouseUserActivitiesOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetDataWarehouseUserActivities.json + */ + /** + * Sample code: Get the list of the user activities of a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheListOfTheUserActivitiesOfADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataWarehouseUserActivitiesOperations() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testsvr", "testdb", DataWarehouseUserActivityName.CURRENT, Context.NONE); + } +} +``` + +### DataWarehouseUserActivitiesOperation_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DataWarehouseUserActivitiesOperation ListByDatabase. */ +public final class DataWarehouseUserActivitiesOperationListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListDataWarehouseUserActivities.json + */ + /** + * Sample code: List of the user activities of a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfTheUserActivitiesOfADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataWarehouseUserActivitiesOperations() + .listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} +``` + +### DatabaseAdvisors_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAdvisors Get. */ +public final class DatabaseAdvisorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorGet.json + */ + /** + * Sample code: Get database advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .getWithResponse("workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "CreateIndex", Context.NONE); + } +} +``` + +### DatabaseAdvisors_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAdvisors ListByDatabase. */ +public final class DatabaseAdvisorsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorList.json + */ + /** + * Sample code: List of database advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfDatabaseAdvisors(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .listByDatabaseWithResponse( + "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionListExpand.json + */ + /** + * Sample code: List of database recommended actions for all advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfDatabaseRecommendedActionsForAllAdvisors( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .listByDatabaseWithResponse( + "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "recommendedActions", Context.NONE); + } +} +``` + +### DatabaseAdvisors_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatus; + +/** Samples for DatabaseAdvisors Update. */ +public final class DatabaseAdvisorsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorUpdate.json + */ + /** + * Sample code: Update database advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void updateDatabaseAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .updateWithResponse( + "workloadinsight-demos", + "misosisvr", + "IndexAdvisor_test_3", + "CreateIndex", + new AdvisorInner().withAutoExecuteStatus(AutoExecuteStatus.DISABLED), + Context.NONE); + } +} +``` + +### DatabaseAutomaticTuning_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAutomaticTuning Get. */ +public final class DatabaseAutomaticTuningGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningGet.json + */ + /** + * Sample code: Get a database's automatic tuning settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSAutomaticTuningSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseAutomaticTunings().getWithResponse("default-sql-onebox", "testsvr11", "db1", Context.NONE); + } +} +``` + +### DatabaseAutomaticTuning_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptionModeDesired; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptions; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DatabaseAutomaticTuning Update. */ +public final class DatabaseAutomaticTuningUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningUpdateMax.json + */ + /** + * Sample code: Updates database automatic tuning settings with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesDatabaseAutomaticTuningSettingsWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + "db1", + new DatabaseAutomaticTuningInner() + .withDesiredState(AutomaticTuningMode.AUTO) + .withOptions( + mapOf( + "createIndex", + new AutomaticTuningOptions().withDesiredState(AutomaticTuningOptionModeDesired.OFF), + "dropIndex", + new AutomaticTuningOptions().withDesiredState(AutomaticTuningOptionModeDesired.ON), + "forceLastGoodPlan", + new AutomaticTuningOptions().withDesiredState(AutomaticTuningOptionModeDesired.DEFAULT))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningUpdateMin.json + */ + /** + * Sample code: Updates database automatic tuning settings with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesDatabaseAutomaticTuningSettingsWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + "db1", + new DatabaseAutomaticTuningInner().withDesiredState(AutomaticTuningMode.AUTO), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### DatabaseBlobAuditingPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for DatabaseBlobAuditingPolicies CreateOrUpdate. */ +public final class DatabaseBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAzureMonitorAuditingCreateMin.json + */ + /** + * Sample code: Create or update a database's azure monitor auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateADatabaseSAzureMonitorAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withIsAzureMonitorTargetEnabled(true) + .withState(BlobAuditingPolicyState.ENABLED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingCreateMax.json + */ + /** + * Sample code: Create or update a database's blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateADatabaseSBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "DATABASE_LOGOUT_GROUP", + "DATABASE_ROLE_MEMBER_CHANGE_GROUP", + "UPDATE on database::TestDatabaseName by public")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingCreateMin.json + */ + /** + * Sample code: Create or update a database's blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateADatabaseSBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .create(); + } +} +``` + +### DatabaseBlobAuditingPolicies_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseBlobAuditingPolicies Get. */ +public final class DatabaseBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingGet.json + */ + /** + * Sample code: Get a database's blob auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSBlobAuditingPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .getWithResponse("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} +``` + +### DatabaseBlobAuditingPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseBlobAuditingPolicies ListByDatabase. */ +public final class DatabaseBlobAuditingPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAuditingSettingsList.json + */ + /** + * Sample code: List audit settings of a database. + * + * @param manager Entry point to SqlManager. + */ + public static void listAuditSettingsOfADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .listByDatabase("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} +``` + +### DatabaseColumns_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseColumns Get. */ +public final class DatabaseColumnsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseColumnGet.json + */ + /** + * Sample code: Get database column. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseColumn(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseColumns() + .getWithResponse("myRG", "serverName", "myDatabase", "dbo", "table1", "column1", Context.NONE); + } +} +``` + +### DatabaseColumns_ListByDatabase + +```java +import com.azure.core.util.Context; +import java.util.Arrays; + +/** Samples for DatabaseColumns ListByDatabase. */ +public final class DatabaseColumnsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnsListByDatabaseMax.json + */ + /** + * Sample code: Filter database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void filterDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseColumns() + .listByDatabase( + "myRG", + "serverName", + "myDatabase", + Arrays.asList("dbo"), + Arrays.asList("customer", "address"), + Arrays.asList("username"), + Arrays.asList("schema asc", "table", "column desc"), + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnsListByDatabaseMin.json + */ + /** + * Sample code: List database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseColumns() + .listByDatabase("myRG", "serverName", "myDatabase", null, null, null, null, null, Context.NONE); + } +} +``` + +### DatabaseColumns_ListByTable + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseColumns ListByTable. */ +public final class DatabaseColumnsListByTableSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseColumnListByTable.json + */ + /** + * Sample code: List database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseColumns().listByTable("myRG", "serverName", "myDatabase", "dbo", "table1", null, Context.NONE); + } +} +``` + +### DatabaseExtensionsOperation_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.OperationMode; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for DatabaseExtensionsOperation CreateOrUpdate. */ +public final class DatabaseExtensionsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CreateOrUpdateDatabaseExtensions.json + */ + /** + * Sample code: Create or Update database extensions. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateDatabaseExtensions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseExtensionsOperations() + .define("polybaseimport") + .withExistingDatabase( + "rg_20cbe0f0-c2d9-4522-9177-5469aad53029", + "srv_1ffd1cf8-9951-47fb-807d-a9c384763849", + "878e303f-1ea0-4f17-aa3d-a22ac5e9da08") + .withOperationMode(OperationMode.POLYBASE_IMPORT) + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") + .withStorageUri("https://teststorage.blob.core.windows.net/testcontainer/Manifest.xml") + .create(); + } +} +``` + +### DatabaseExtensionsOperation_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseExtensionsOperation Get. */ +public final class DatabaseExtensionsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetDatabaseExtensions.json + */ + /** + * Sample code: Get database extensions. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseExtensions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseExtensionsOperations() + .getWithResponse( + "rg_a1f9d6f8-30d5-4228-9504-8a364361bca3", + "srv_65858e0f-b1d1-4bdc-8351-a7da86ca4939", + "11aa6c5e-58ed-4693-b303-3b8e3131deaa", + "polybaseimport", + Context.NONE); + } +} +``` + +### DatabaseExtensionsOperation_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseExtensionsOperation ListByDatabase. */ +public final class DatabaseExtensionsOperationListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListDatabaseExtensions.json + */ + /** + * Sample code: List database extensions. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseExtensions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseExtensionsOperations() + .listByDatabase( + "rg_4007c5a9-b3b0-41e1-bd46-9eef38768a4a", + "srv_3b67ec2a-519b-43a7-8533-fb62dce3431e", + "719d8fa4-bf0f-48fc-8cd3-ef40fe6ba1fe", + Context.NONE); + } +} +``` + +### DatabaseOperations_Cancel + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for DatabaseOperations Cancel. */ +public final class DatabaseOperationsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CancelDatabaseOperation.json + */ + /** + * Sample code: Cancel the database management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelTheDatabaseManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseOperations() + .cancelWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-6661", + "testdb", + UUID.fromString("f779414b-e748-4925-8cfe-c8598f7660ae"), + Context.NONE); + } +} +``` + +### DatabaseOperations_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseOperations ListByDatabase. */ +public final class DatabaseOperationsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListDatabaseOperations.json + */ + /** + * Sample code: List the database management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheDatabaseManagementOperations(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseOperations().listByDatabase("sqlcrudtest-7398", "sqlcrudtest-4645", "testdb", Context.NONE); + } +} +``` + +### DatabaseRecommendedActions_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseRecommendedActions Get. */ +public final class DatabaseRecommendedActionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionGet.json + */ + /** + * Sample code: Get database recommended action. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseRecommendedAction(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseRecommendedActions() + .getWithResponse( + "workloadinsight-demos", + "misosisvr", + "IndexAdvisor_test_3", + "CreateIndex", + "IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB", + Context.NONE); + } +} +``` + +### DatabaseRecommendedActions_ListByDatabaseAdvisor + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseRecommendedActions ListByDatabaseAdvisor. */ +public final class DatabaseRecommendedActionsListByDatabaseAdvisorSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionList.json + */ + /** + * Sample code: List of database recommended actions. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfDatabaseRecommendedActions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseRecommendedActions() + .listByDatabaseAdvisorWithResponse( + "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "CreateIndex", Context.NONE); + } +} +``` + +### DatabaseRecommendedActions_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionCurrentState; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionStateInfo; + +/** Samples for DatabaseRecommendedActions Update. */ +public final class DatabaseRecommendedActionsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionUpdate.json + */ + /** + * Sample code: Update database recommended action. + * + * @param manager Entry point to SqlManager. + */ + public static void updateDatabaseRecommendedAction(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseRecommendedActions() + .updateWithResponse( + "workloadinsight-demos", + "misosisvr", + "IndexAdvisor_test_3", + "CreateIndex", + "IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB", + new RecommendedActionInner() + .withState( + new RecommendedActionStateInfo().withCurrentValue(RecommendedActionCurrentState.PENDING)), + Context.NONE); + } +} +``` + +### DatabaseSchemas_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseSchemas Get. */ +public final class DatabaseSchemasGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSchemaGet.json + */ + /** + * Sample code: Get database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseSchemas().getWithResponse("myRG", "serverName", "myDatabase", "dbo", Context.NONE); + } +} +``` + +### DatabaseSchemas_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseSchemas ListByDatabase. */ +public final class DatabaseSchemasListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSchemaListByDatabase.json + */ + /** + * Sample code: List database schemas. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseSchemas(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseSchemas().listByDatabase("myRG", "serverName", "myDatabase", null, Context.NONE); + } +} +``` + +### DatabaseSecurityAlertPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import java.util.Arrays; + +/** Samples for DatabaseSecurityAlertPolicies CreateOrUpdate. */ +public final class DatabaseSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertCreateMax.json + */ + /** + * Sample code: Update a database's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DatabaseSecurityAlertPolicy resource = + manager + .databaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertsPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Sql_Injection", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("test@microsoft.com", "user@microsoft.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(6) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertCreateMin.json + */ + /** + * Sample code: Update a database's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DatabaseSecurityAlertPolicy resource = + manager + .databaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertsPolicyState.ENABLED).apply(); + } +} +``` + +### DatabaseSecurityAlertPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for DatabaseSecurityAlertPolicies Get. */ +public final class DatabaseSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertGet.json + */ + /** + * Sample code: Get a database's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSThreatDetectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-6852", "securityalert-2080", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### DatabaseSecurityAlertPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseSecurityAlertPolicies ListByDatabase. */ +public final class DatabaseSecurityAlertPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertListByDatabase.json + */ + /** + * Sample code: Get the database's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheDatabaseSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSecurityAlertPolicies() + .listByDatabase("securityalert-6852", "securityalert-2080", "testdb", Context.NONE); + } +} +``` + +### DatabaseTables_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseTables Get. */ +public final class DatabaseTablesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseTableGet.json + */ + /** + * Sample code: Get database table. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseTable(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseTables().getWithResponse("myRG", "serverName", "myDatabase", "dbo", "table1", Context.NONE); + } +} +``` + +### DatabaseTables_ListBySchema + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseTables ListBySchema. */ +public final class DatabaseTablesListBySchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseTableListBySchema.json + */ + /** + * Sample code: List database tables. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseTables(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseTables().listBySchema("myRG", "serverName", "myDatabase", "dbo", null, Context.NONE); + } +} +``` + +### DatabaseUsages_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseUsages ListByDatabase. */ +public final class DatabaseUsagesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetDatabaseUsages.json + */ + /** + * Sample code: Gets database usages. + * + * @param manager Entry point to SqlManager. + */ + public static void getsDatabaseUsages(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseUsages().listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessmentRuleBaselines_CreateOrUpdate + +```java +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.Arrays; + +/** Samples for DatabaseVulnerabilityAssessmentRuleBaselines CreateOrUpdate. */ +public final class DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineCreate.json + */ + /** + * Sample code: Creates or updates a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentRuleBaselines() + .define(VulnerabilityAssessmentPolicyBaselineName.DEFAULT) + .withExistingRule( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001") + .withBaselineResults( + Arrays + .asList( + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userA", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userB", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userC", "SELECT", "tableId_4")))) + .create(); + } +} +``` + +### DatabaseVulnerabilityAssessmentRuleBaselines_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for DatabaseVulnerabilityAssessmentRuleBaselines Delete. */ +public final class DatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineDelete.json + */ + /** + * Sample code: Removes a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void removesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentRuleBaselines() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessmentRuleBaselines_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for DatabaseVulnerabilityAssessmentRuleBaselines Get. */ +public final class DatabaseVulnerabilityAssessmentRuleBaselinesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineGet.json + */ + /** + * Sample code: Gets a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.MASTER, + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessmentScans_Export + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans Export. */ +public final class DatabaseVulnerabilityAssessmentScansExportSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanExport.json + */ + /** + * Sample code: Export a database's vulnerability assessment scan results. + * + * @param manager Entry point to SqlManager. + */ + public static void exportADatabaseSVulnerabilityAssessmentScanResults( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .exportWithResponse( + "vulnerabilityassessmenttest-4799", + "vulnerabilityassessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessmentScans_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans Get. */ +public final class DatabaseVulnerabilityAssessmentScansGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanRecordsGet.json + */ + /** + * Sample code: Gets a database vulnerability assessment scan record by scan ID. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseVulnerabilityAssessmentScanRecordByScanID( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessmentScans_InitiateScan + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans InitiateScan. */ +public final class DatabaseVulnerabilityAssessmentScansInitiateScanSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScansExecute.json + */ + /** + * Sample code: Executes a database's vulnerability assessment scan. + * + * @param manager Entry point to SqlManager. + */ + public static void executesADatabaseSVulnerabilityAssessmentScan( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .initiateScan( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan01", + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessmentScans_ListByDatabase + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans ListByDatabase. */ +public final class DatabaseVulnerabilityAssessmentScansListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanRecordsListByDatabase.json + */ + /** + * Sample code: Gets the list of a database vulnerability assessment scan records. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheListOfADatabaseVulnerabilityAssessmentScanRecords( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .listByDatabase( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessments_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for DatabaseVulnerabilityAssessments CreateOrUpdate. */ +public final class DatabaseVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateContainerSasKeyMin.json + */ + /** + * Sample code: Create a database's vulnerability assessment with minimal parameters, when storageContainerSasKey is + * specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createADatabaseSVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingDatabase("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a database's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createADatabaseSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingDatabase("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateStorageAccessKeyMin.json + */ + /** + * Sample code: Create a database's vulnerability assessment with minimal parameters, when storageAccountAccessKey + * is specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createADatabaseSVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingDatabase("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } +} +``` + +### DatabaseVulnerabilityAssessments_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessments Delete. */ +public final class DatabaseVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessments_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessments Get. */ +public final class DatabaseVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessments_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseVulnerabilityAssessments ListByDatabase. */ +public final class DatabaseVulnerabilityAssessmentsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentListByDatabase.json + */ + /** + * Sample code: Get the database's vulnerability assessment policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheDatabaseSVulnerabilityAssessmentPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .listByDatabase( + "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", Context.NONE); + } +} +``` + +### Databases_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CreateMode; +import com.azure.resourcemanager.sql.generated.models.SecondaryType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.time.OffsetDateTime; + +/** Samples for Databases CreateOrUpdate. */ +public final class DatabasesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseConfiguredBackupStorageRedundancy.json + */ + /** + * Sample code: Creates a database with specified backup storage redundancy. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithSpecifiedBackupStorageRedundancy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.ZONE) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseDefaultMode.json + */ + /** + * Sample code: Creates a database with default mode. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithDefaultMode(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S0").withTier("Standard")) + .withCreateMode(CreateMode.DEFAULT) + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withMaxSizeBytes(1073741824L) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateVCoreDatabaseByServiceObjective.json + */ + /** + * Sample code: Creates a VCore database by specifying service objective name. + * + * @param manager Entry point to SqlManager. + */ + public static void createsAVCoreDatabaseBySpecifyingServiceObjectiveName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("BC").withFamily("Gen4").withCapacity(2)) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseMin.json + */ + /** + * Sample code: Creates a database with minimum number of parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithMinimumNumberOfParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionRecovery.json + */ + /** + * Sample code: Creates a data warehouse database as a cross-subscription restore from a geo-backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromAGeoBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdw") + .withRegion("westus") + .withExistingServer("Default-SQL-WestUS", "testsvr") + .withCreateMode(CreateMode.RECOVERY) + .withSourceResourceId( + "/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-EastUS/providers/Microsoft.Sql/servers/srcsvr/recoverabledatabases/srcdw") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseMaintenanceConfiguration.json + */ + /** + * Sample code: Creates a database with preferred maintenance window. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithPreferredMaintenanceWindow( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S2").withTier("Standard")) + .withCreateMode(CreateMode.DEFAULT) + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withMaxSizeBytes(1073741824L) + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseCopyMode.json + */ + /** + * Sample code: Creates a database as a copy. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseAsACopy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("dbcopy") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S0").withTier("Standard")) + .withCreateMode(CreateMode.COPY) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabasePITRMode.json + */ + /** + * Sample code: Creates a database from PointInTimeRestore. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseFromPointInTimeRestore( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("dbpitr") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SoutheastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb") + .withRestorePointInTime(OffsetDateTime.parse("2020-10-22T05:35:31.503Z")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseLedger.json + */ + /** + * Sample code: Creates a database with ledger on. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithLedgerOn(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withIsLedgerOn(true) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionPITR.json + */ + /** + * Sample code: Creates a data warehouse database as a cross-subscription restore from a restore point of an + * existing database. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromARestorePointOfAnExistingDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdw") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) + .withRestorePointInTime(OffsetDateTime.parse("2022-01-22T05:35:31.503Z")) + .withSourceResourceId( + "/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/srcsvr/databases/srcdw") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateVCoreDatabaseBySkuNameCapacity.json + */ + /** + * Sample code: Creates a VCore database by specifying sku name and capacity. + * + * @param manager Entry point to SqlManager. + */ + public static void createsAVCoreDatabaseBySpecifyingSkuNameAndCapacity( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("BC_Gen4").withCapacity(2)) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionRestore.json + */ + /** + * Sample code: Creates a data warehouse database as a cross-subscription restore from a backup of a dropped + * database. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromABackupOfADroppedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdw") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withCreateMode(CreateMode.RESTORE) + .withSourceResourceId( + "/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/srcsvr/restorableDroppedDatabases/srcdw,131403269876900000") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseNamedReplica.json + */ + /** + * Sample code: Creates a database as named replica secondary. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseAsNamedReplicaSecondary( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("HS_Gen4").withTier("Hyperscale").withCapacity(2)) + .withCreateMode(CreateMode.SECONDARY) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-NorthEurope/providers/Microsoft.Sql/servers/testsvr1/databases/primarydb") + .withSecondaryType(SecondaryType.NAMED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseSecondaryMode.json + */ + /** + * Sample code: Creates a database as an on-line secondary. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseAsAnOnLineSecondary(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S0").withTier("Standard")) + .withCreateMode(CreateMode.SECONDARY) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-NorthEurope/providers/Microsoft.Sql/servers/testsvr1/databases/testdb") + .withSecondaryType(SecondaryType.GEO) + .create(); + } +} +``` + +### Databases_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Databases Delete. */ +public final class DatabasesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/DeleteDatabase.json + */ + /** + * Sample code: Deletes a database. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().delete("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} +``` + +### Databases_Export + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ExportDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.NetworkIsolationSettings; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for Databases Export. */ +public final class DatabasesExportSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ExportDatabase.json + */ + /** + * Sample code: Exports a database. + * + * @param manager Entry point to SqlManager. + */ + public static void exportsADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .export( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ExportDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey( + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("password") + .withAuthenticationType("Sql"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ExportDatabaseWithNetworkIsolation.json + */ + /** + * Sample code: Exports a database, using private link to communicate with SQL server and storage account. + * + * @param manager Entry point to SqlManager. + */ + public static void exportsADatabaseUsingPrivateLinkToCommunicateWithSQLServerAndStorageAccount( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .export( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ExportDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey( + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("password") + .withAuthenticationType("Sql") + .withNetworkIsolation( + new NetworkIsolationSettings() + .withStorageAccountResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink") + .withSqlServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr")), + Context.NONE); + } +} +``` + +### Databases_Failover + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; + +/** Samples for Databases Failover. */ +public final class DatabasesFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/FailoverDatabase.json + */ + /** + * Sample code: Failover an database. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAnDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().failover("group1", "testServer", "testDatabase", ReplicaType.PRIMARY, Context.NONE); + } +} +``` + +### Databases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Databases Get. */ +public final class DatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetVCoreDatabase.json + */ + /** + * Sample code: Gets a database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} +``` + +### Databases_ImportMethod + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ImportExistingDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.NetworkIsolationSettings; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for Databases ImportMethod. */ +public final class DatabasesImportMethodSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ImportDatabase.json + */ + /** + * Sample code: Imports to an existing empty database. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToAnExistingEmptyDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .importMethod( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ImportExistingDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey( + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("password") + .withAuthenticationType("Sql"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ImportDatabaseWithNetworkIsolation.json + */ + /** + * Sample code: Imports to an existing empty database, using private link to communicate with SQL server and storage + * account. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToAnExistingEmptyDatabaseUsingPrivateLinkToCommunicateWithSQLServerAndStorageAccount( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .importMethod( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ImportExistingDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey( + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("password") + .withAuthenticationType("Sql") + .withNetworkIsolation( + new NetworkIsolationSettings() + .withStorageAccountResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink") + .withSqlServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr")), + Context.NONE); + } +} +``` + +### Databases_ListByElasticPool + +```java +import com.azure.core.util.Context; + +/** Samples for Databases ListByElasticPool. */ +public final class DatabasesListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListDatabasesByElasticPool.json + */ + /** + * Sample code: Gets a list of databases in an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabasesInAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listByElasticPool("Default-SQL-SouthEastAsia", "testsvr", "pool1", Context.NONE); + } +} +``` + +### Databases_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for Databases ListByServer. */ +public final class DatabasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListVCoreDatabasesByServer.json + */ + /** + * Sample code: Gets a list of databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listByServer("Default-SQL-SouthEastAsia", "testsvr", null, Context.NONE); + } +} +``` + +### Databases_ListInaccessibleByServer + +```java +import com.azure.core.util.Context; + +/** Samples for Databases ListInaccessibleByServer. */ +public final class DatabasesListInaccessibleByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListVCoreInaccessibleDatabasesByServer.json + */ + /** + * Sample code: Gets a list of inaccessible databases in a logical server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfInaccessibleDatabasesInALogicalServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listInaccessibleByServer("Default-SQL-SouthEastAsia", "testsvr", Context.NONE); + } +} +``` + +### Databases_ListMetricDefinitions + +```java +import com.azure.core.util.Context; + +/** Samples for Databases ListMetricDefinitions. */ +public final class DatabasesListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DatabaseMetricsDefinitionsList.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listMetricDefinitions("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", Context.NONE); + } +} +``` + +### Databases_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for Databases ListMetrics. */ +public final class DatabasesListMetricsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DatabaseMetricsListWithFilter.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .listMetrics( + "sqlcrudtest-6730", + "sqlcrudtest-9007", + "3481", + "name/value eq 'cpu_percent' and timeGrain eq '00:10:00' and startTime eq '2017-06-02T18:35:00Z' and" + + " endTime eq '2017-06-02T18:55:00Z'", + Context.NONE); + } +} +``` + +### Databases_Pause + +```java +import com.azure.core.util.Context; + +/** Samples for Databases Pause. */ +public final class DatabasesPauseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/PauseDatabase.json + */ + /** + * Sample code: Pauses a database. + * + * @param manager Entry point to SqlManager. + */ + public static void pausesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().pause("Default-SQL-SouthEastAsia", "testsvr", "testdwdb", Context.NONE); + } +} +``` + +### Databases_Rename + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ResourceMoveDefinition; + +/** Samples for Databases Rename. */ +public final class DatabasesRenameSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/RenameDatabase.json + */ + /** + * Sample code: Renames a database. + * + * @param manager Entry point to SqlManager. + */ + public static void renamesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .renameWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ResourceMoveDefinition() + .withId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/newtestdb"), + Context.NONE); + } +} +``` + +### Databases_Resume + +```java +import com.azure.core.util.Context; + +/** Samples for Databases Resume. */ +public final class DatabasesResumeSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResumeDatabase.json + */ + /** + * Sample code: Resumes a database. + * + * @param manager Entry point to SqlManager. + */ + public static void resumesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().resume("Default-SQL-SouthEastAsia", "testsvr", "testdwdb", Context.NONE); + } +} +``` + +### Databases_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.Database; +import com.azure.resourcemanager.sql.generated.models.DatabaseLicenseType; +import com.azure.resourcemanager.sql.generated.models.Sku; + +/** Samples for Databases Update. */ +public final class DatabasesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/PatchVCoreDatabaseAssignMaintenanceConfiguration.json + */ + /** + * Sample code: Assigns maintenance window to a database. + * + * @param manager Entry point to SqlManager. + */ + public static void assignsMaintenanceWindowToADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen5_4")) + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/PatchVCoreDatabaseResetMaintenanceConfiguration.json + */ + /** + * Sample code: Resets maintenance window of a database to default. + * + * @param manager Entry point to SqlManager. + */ + public static void resetsMaintenanceWindowOfADatabaseToDefault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen5_4")) + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/PatchVCoreDatabase.json + */ + /** + * Sample code: Updates a database. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen4_4")) + .withMaxSizeBytes(1073741824L) + .withLicenseType(DatabaseLicenseType.LICENSE_INCLUDED) + .apply(); + } +} +``` + +### Databases_UpgradeDataWarehouse + +```java +import com.azure.core.util.Context; + +/** Samples for Databases UpgradeDataWarehouse. */ +public final class DatabasesUpgradeDataWarehouseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/UpgradeDataWarehouse.json + */ + /** + * Sample code: Upgrades a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void upgradesADataWarehouse(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().upgradeDataWarehouse("Default-SQL-SouthEastAsia", "testsvr", "testdwdb", Context.NONE); + } +} +``` + +### DeletedServers_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DeletedServers Get. */ +public final class DeletedServersGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerGet.json + */ + /** + * Sample code: Get deleted server. + * + * @param manager Entry point to SqlManager. + */ + public static void getDeletedServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().getWithResponse("japaneast", "sqlcrudtest-d-1414", Context.NONE); + } +} +``` + +### DeletedServers_List + +```java +import com.azure.core.util.Context; + +/** Samples for DeletedServers List. */ +public final class DeletedServersListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerListBySubscription.json + */ + /** + * Sample code: List deleted servers in a subscription. + * + * @param manager Entry point to SqlManager. + */ + public static void listDeletedServersInASubscription(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().list(Context.NONE); + } +} +``` + +### DeletedServers_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for DeletedServers ListByLocation. */ +public final class DeletedServersListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerList.json + */ + /** + * Sample code: List deleted servers. + * + * @param manager Entry point to SqlManager. + */ + public static void listDeletedServers(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().listByLocation("japaneast", Context.NONE); + } +} +``` + +### DeletedServers_Recover + +```java +import com.azure.core.util.Context; + +/** Samples for DeletedServers Recover. */ +public final class DeletedServersRecoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerRecover.json + */ + /** + * Sample code: Recover deleted server. + * + * @param manager Entry point to SqlManager. + */ + public static void recoverDeletedServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().recover("japaneast", "sqlcrudtest-d-1414", Context.NONE); + } +} +``` + +### DistributedAvailabilityGroups_CreateOrUpdate + +```java +/** Samples for DistributedAvailabilityGroups CreateOrUpdate. */ +public final class DistributedAvailabilityGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsCreate.json + */ + /** + * Sample code: Create a distributed availability group. + * + * @param manager Entry point to SqlManager. + */ + public static void createADistributedAvailabilityGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .distributedAvailabilityGroups() + .define("dag") + .withExistingManagedInstance("testrg", "testcl") + .withTargetDatabase("testdb") + .withSourceEndpoint("TCP://SERVER:7022") + .withPrimaryAvailabilityGroupName("BoxLocalAg1") + .withSecondaryAvailabilityGroupName("testcl") + .create(); + } +} +``` + +### DistributedAvailabilityGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for DistributedAvailabilityGroups Delete. */ +public final class DistributedAvailabilityGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsDelete.json + */ + /** + * Sample code: Initiate a distributed availability group drop. + * + * @param manager Entry point to SqlManager. + */ + public static void initiateADistributedAvailabilityGroupDrop( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.distributedAvailabilityGroups().delete("testrg", "testcl", "dag", Context.NONE); + } +} +``` + +### DistributedAvailabilityGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DistributedAvailabilityGroups Get. */ +public final class DistributedAvailabilityGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsGet.json + */ + /** + * Sample code: Gets the distributed availability group info. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheDistributedAvailabilityGroupInfo( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.distributedAvailabilityGroups().getWithResponse("testrg", "testcl", "dag", Context.NONE); + } +} +``` + +### DistributedAvailabilityGroups_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for DistributedAvailabilityGroups ListByInstance. */ +public final class DistributedAvailabilityGroupsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsListByInstance.json + */ + /** + * Sample code: Lists all distributed availability groups in instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listsAllDistributedAvailabilityGroupsInInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.distributedAvailabilityGroups().listByInstance("testrg", "testcl", Context.NONE); + } +} +``` + +### DistributedAvailabilityGroups_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DistributedAvailabilityGroup; +import com.azure.resourcemanager.sql.generated.models.ReplicationMode; + +/** Samples for DistributedAvailabilityGroups Update. */ +public final class DistributedAvailabilityGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsUpdate.json + */ + /** + * Sample code: Update the distributed availability group replication mode before deleting it. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheDistributedAvailabilityGroupReplicationModeBeforeDeletingIt( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DistributedAvailabilityGroup resource = + manager.distributedAvailabilityGroups().getWithResponse("testrg", "testcl", "dag", Context.NONE).getValue(); + resource.update().withReplicationMode(ReplicationMode.SYNC).apply(); + } +} +``` + +### ElasticPoolActivities_ListByElasticPool + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPoolActivities ListByElasticPool. */ +public final class ElasticPoolActivitiesListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ElasticPoolActivityList.json + */ + /** + * Sample code: List Elastic pool activity. + * + * @param manager Entry point to SqlManager. + */ + public static void listElasticPoolActivity(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPoolActivities().listByElasticPool("sqlcrudtest-4291", "sqlcrudtest-6574", "8749", Context.NONE); + } +} +``` + +### ElasticPoolDatabaseActivities_ListByElasticPool + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPoolDatabaseActivities ListByElasticPool. */ +public final class ElasticPoolDatabaseActivitiesListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ElasticPoolDatabaseActivityList.json + */ + /** + * Sample code: List elastic pool database activity. + * + * @param manager Entry point to SqlManager. + */ + public static void listElasticPoolDatabaseActivity(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPoolDatabaseActivities() + .listByElasticPool("sqlcrudtest-4673", "sqlcrudtest-603", "7537", Context.NONE); + } +} +``` + +### ElasticPoolOperations_Cancel + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for ElasticPoolOperations Cancel. */ +public final class ElasticPoolOperationsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelElasticPoolOperation.json + */ + /** + * Sample code: Cancel the elastic pool management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelTheElasticPoolManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPoolOperations() + .cancelWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-6661", + "testpool", + UUID.fromString("f779414b-e748-4925-8cfe-c8598f7660ae"), + Context.NONE); + } +} +``` + +### ElasticPoolOperations_ListByElasticPool + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPoolOperations ListByElasticPool. */ +public final class ElasticPoolOperationsListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListElasticPoolOperations.json + */ + /** + * Sample code: List the elastic pool management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheElasticPoolManagementOperations( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPoolOperations() + .listByElasticPool("sqlcrudtestgroup", "sqlcrudtestserver", "testpool", Context.NONE); + } +} +``` + +### ElasticPools_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ElasticPoolPerDatabaseSettings; +import com.azure.resourcemanager.sql.generated.models.Sku; + +/** Samples for ElasticPools CreateOrUpdate. */ +public final class ElasticPoolsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateMax.json + */ + /** + * Sample code: Create or update elastic pool with all parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateElasticPoolWithAllParameter( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .withSku(new Sku().withName("GP_Gen4_2").withTier("GeneralPurpose").withCapacity(2)) + .withPerDatabaseSettings(new ElasticPoolPerDatabaseSettings().withMinCapacity(0.25).withMaxCapacity(2.0)) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolCreateOrUpdateSetHighAvailabilityReplicaCount.json + */ + /** + * Sample code: Create or update Hyperscale elastic pool with high availability replica count parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateHyperscaleElasticPoolWithHighAvailabilityReplicaCountParameter( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .withSku(new Sku().withName("HS_Gen5_4")) + .withHighAvailabilityReplicaCount(2) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateSetMaintenanceConfiguration.json + */ + /** + * Sample code: Create or update elastic pool with maintenance configuration parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateElasticPoolWithMaintenanceConfigurationParameter( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_1") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateMin.json + */ + /** + * Sample code: Create or update elastic pool with minimum parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateElasticPoolWithMinimumParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .create(); + } +} +``` + +### ElasticPools_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPools Delete. */ +public final class ElasticPoolsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolDelete.json + */ + /** + * Sample code: Delete an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().delete("sqlcrudtest-3129", "sqlcrudtest-228", "sqlcrudtest-3851", Context.NONE); + } +} +``` + +### ElasticPools_Failover + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPools Failover. */ +public final class ElasticPoolsFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/FailoverElasticPool.json + */ + /** + * Sample code: Failover an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().failover("group1", "testServer", "testElasticPool", Context.NONE); + } +} +``` + +### ElasticPools_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPools Get. */ +public final class ElasticPoolsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolGet.json + */ + /** + * Sample code: Get a Hyperscale elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getAHyperscaleElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolGet.json + */ + /** + * Sample code: Get an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE); + } +} +``` + +### ElasticPools_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPools ListByServer. */ +public final class ElasticPoolsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolListByServer.json + */ + /** + * Sample code: Get all elastic pools in a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllElasticPoolsInAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().listByServer("sqlcrudtest-2369", "sqlcrudtest-8069", null, Context.NONE); + } +} +``` + +### ElasticPools_ListMetricDefinitions + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPools ListMetricDefinitions. */ +public final class ElasticPoolsListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ElasticPoolMetricsDefinitionsList.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().listMetricDefinitions("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", Context.NONE); + } +} +``` + +### ElasticPools_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPools ListMetrics. */ +public final class ElasticPoolsListMetricsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ElasticPoolMetricsListWithFilter.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .listMetrics( + "sqlcrudtest-6730", + "sqlcrudtest-9007", + "3481", + "name/value eq 'cpu_percent' and timeGrain eq '00:10:00' and startTime eq '2017-06-02T18:35:00Z' and" + + " endTime eq '2017-06-02T18:55:00Z'", + Context.NONE); + } +} +``` + +### ElasticPools_Update + +```java +import com.azure.core.util.Context; +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.Sku; + +/** Samples for ElasticPools Update. */ +public final class ElasticPoolsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateMax.json + */ + /** + * Sample code: Update an elastic pool with all parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnElasticPoolWithAllParameter(com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen4").withTier("BusinessCritical").withCapacity(2)) + .withPerDatabaseSettings(new ElasticPoolPerDatabaseSettings().withMinCapacity(0.25).withMaxCapacity(1.0)) + .withZoneRedundant(true) + .withLicenseType(ElasticPoolLicenseType.LICENSE_INCLUDED) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolUpdateSetHighAvailabilityReplicaCount.json + */ + /** + * Sample code: Update high availability replica count of a Hyperscale elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void updateHighAvailabilityReplicaCountOfAHyperscaleElasticPool( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource.update().withHighAvailabilityReplicaCount(2).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateMin.json + */ + /** + * Sample code: Update an elastic pool with minimum parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnElasticPoolWithMinimumParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource.update().apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateAssignMaintenanceConfiguration.json + */ + /** + * Sample code: Assigns maintenance configuration to an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void assignsMaintenanceConfigurationToAnElasticPool( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_1") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateResetMaintenanceConfiguration.json + */ + /** + * Sample code: Resets maintenance configuration of an elastic pool to default. + * + * @param manager Entry point to SqlManager. + */ + public static void resetsMaintenanceConfigurationOfAnElasticPoolToDefault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default") + .apply(); + } +} +``` + +### EncryptionProtectors_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtector; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for EncryptionProtectors CreateOrUpdate. */ +public final class EncryptionProtectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorCreateOrUpdateKeyVault.json + */ + /** + * Sample code: Update the encryption protector to key vault. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToKeyVault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + EncryptionProtector resource = + manager + .encryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource + .update() + .withServerKeyName("someVault_someKey_01234567890123456789012345678901") + .withAutoRotationEnabled(false) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorCreateOrUpdateServiceManaged.json + */ + /** + * Sample code: Update the encryption protector to service managed. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToServiceManaged( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + EncryptionProtector resource = + manager + .encryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource.update().withServerKeyName("ServiceManaged").apply(); + } +} +``` + +### EncryptionProtectors_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for EncryptionProtectors Get. */ +public final class EncryptionProtectorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorGet.json + */ + /** + * Sample code: Get the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .encryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} +``` + +### EncryptionProtectors_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for EncryptionProtectors ListByServer. */ +public final class EncryptionProtectorsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorList.json + */ + /** + * Sample code: List encryption protectors by server. + * + * @param manager Entry point to SqlManager. + */ + public static void listEncryptionProtectorsByServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.encryptionProtectors().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### EncryptionProtectors_Revalidate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for EncryptionProtectors Revalidate. */ +public final class EncryptionProtectorsRevalidateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorRevalidate.json + */ + /** + * Sample code: Revalidates the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void revalidatesTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .encryptionProtectors() + .revalidate("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} +``` + +### EndpointCertificates_Get + +```java +import com.azure.core.util.Context; + +/** Samples for EndpointCertificates Get. */ +public final class EndpointCertificatesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/EndpointCertificatesGet.json + */ + /** + * Sample code: Gets an endpoint certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAnEndpointCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.endpointCertificates().getWithResponse("testrg", "testcl", "DATABASE_MIRRORING", Context.NONE); + } +} +``` + +### EndpointCertificates_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for EndpointCertificates ListByInstance. */ +public final class EndpointCertificatesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/EndpointCertificatesListByInstance.json + */ + /** + * Sample code: Get a list of endpoint certificates. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfEndpointCertificates(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.endpointCertificates().listByInstance("testrg", "testcl", Context.NONE); + } +} +``` + +### ExtendedDatabaseBlobAuditingPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for ExtendedDatabaseBlobAuditingPolicies CreateOrUpdate. */ +public final class ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingCreateMin.json + */ + /** + * Sample code: Create or update an extended database's blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAnExtendedDatabaseSBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingCreateMax.json + */ + /** + * Sample code: Create or update an extended database's blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAnExtendedDatabaseSBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withPredicateExpression("statement = 'select 1'") + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "DATABASE_LOGOUT_GROUP", + "DATABASE_ROLE_MEMBER_CHANGE_GROUP", + "UPDATE on database::TestDatabaseName by public")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseAzureMonitorAuditingCreateMin.json + */ + /** + * Sample code: Create or update an extended database's azure monitor auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAnExtendedDatabaseSAzureMonitorAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withIsAzureMonitorTargetEnabled(true) + .withState(BlobAuditingPolicyState.ENABLED) + .create(); + } +} +``` + +### ExtendedDatabaseBlobAuditingPolicies_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ExtendedDatabaseBlobAuditingPolicies Get. */ +public final class ExtendedDatabaseBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingGet.json + */ + /** + * Sample code: Get an extended database's blob auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAnExtendedDatabaseSBlobAuditingPolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .getWithResponse("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} +``` + +### ExtendedDatabaseBlobAuditingPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ExtendedDatabaseBlobAuditingPolicies ListByDatabase. */ +public final class ExtendedDatabaseBlobAuditingPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseExtendedAuditingSettingsList.json + */ + /** + * Sample code: List extended auditing settings of a database. + * + * @param manager Entry point to SqlManager. + */ + public static void listExtendedAuditingSettingsOfADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .listByDatabase("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} +``` + +### ExtendedServerBlobAuditingPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ExtendedServerBlobAuditingPolicy; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for ExtendedServerBlobAuditingPolicies CreateOrUpdate. */ +public final class ExtendedServerBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingCreateMin.json + */ + /** + * Sample code: Update a server's extended blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSExtendedBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ExtendedServerBlobAuditingPolicy resource = + manager + .extendedServerBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingCreateMax.json + */ + /** + * Sample code: Update a server's extended blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSExtendedBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ExtendedServerBlobAuditingPolicy resource = + manager + .extendedServerBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withPredicateExpression("object_name = 'SensitiveData'") + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP", + "FAILED_DATABASE_AUTHENTICATION_GROUP", + "BATCH_COMPLETED_GROUP")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .apply(); + } +} +``` + +### ExtendedServerBlobAuditingPolicies_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ExtendedServerBlobAuditingPolicies Get. */ +public final class ExtendedServerBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingGet.json + */ + /** + * Sample code: Get a server's blob extended auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSBlobExtendedAuditingPolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedServerBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} +``` + +### ExtendedServerBlobAuditingPolicies_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ExtendedServerBlobAuditingPolicies ListByServer. */ +public final class ExtendedServerBlobAuditingPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerExtendedAuditingSettingsList.json + */ + /** + * Sample code: List extended auditing settings of a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listExtendedAuditingSettingsOfAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedServerBlobAuditingPolicies() + .listByServer("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} +``` + +### FailoverGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.PartnerInfo; +import com.azure.resourcemanager.sql.generated.models.ReadOnlyEndpointFailoverPolicy; +import com.azure.resourcemanager.sql.generated.models.ReadWriteEndpointFailoverPolicy; +import java.util.Arrays; + +/** Samples for FailoverGroups CreateOrUpdate. */ +public final class FailoverGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupCreateOrUpdate.json + */ + /** + * Sample code: Create failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void createFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .define("failover-group-test-3") + .withExistingServer("Default", "failover-group-primary-server") + .withReadWriteEndpoint( + new FailoverGroupReadWriteEndpoint() + .withFailoverPolicy(ReadWriteEndpointFailoverPolicy.AUTOMATIC) + .withFailoverWithDataLossGracePeriodMinutes(480)) + .withReadOnlyEndpoint( + new FailoverGroupReadOnlyEndpoint().withFailoverPolicy(ReadOnlyEndpointFailoverPolicy.DISABLED)) + .withPartnerServers( + Arrays + .asList( + new PartnerInfo() + .withId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server"))) + .withDatabases( + Arrays + .asList( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-1", + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-2")) + .create(); + } +} +``` + +### FailoverGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for FailoverGroups Delete. */ +public final class FailoverGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupDelete.json + */ + /** + * Sample code: Delete failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .delete("Default", "failover-group-primary-server", "failover-group-test-1", Context.NONE); + } +} +``` + +### FailoverGroups_Failover + +```java +import com.azure.core.util.Context; + +/** Samples for FailoverGroups Failover. */ +public final class FailoverGroupsFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupFailover.json + */ + /** + * Sample code: Planned failover of a failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void plannedFailoverOfAFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .failover("Default", "failover-group-secondary-server", "failover-group-test-3", Context.NONE); + } +} +``` + +### FailoverGroups_ForceFailoverAllowDataLoss + +```java +import com.azure.core.util.Context; + +/** Samples for FailoverGroups ForceFailoverAllowDataLoss. */ +public final class FailoverGroupsForceFailoverAllowDataLossSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupForceFailoverAllowDataLoss.json + */ + /** + * Sample code: Forced failover of a failover group allowing data loss. + * + * @param manager Entry point to SqlManager. + */ + public static void forcedFailoverOfAFailoverGroupAllowingDataLoss( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .forceFailoverAllowDataLoss( + "Default", "failover-group-secondary-server", "failover-group-test-3", Context.NONE); + } +} +``` + +### FailoverGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for FailoverGroups Get. */ +public final class FailoverGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupGet.json + */ + /** + * Sample code: Get failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void getFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .getWithResponse("Default", "failover-group-primary-server", "failover-group-test", Context.NONE); + } +} +``` + +### FailoverGroups_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for FailoverGroups ListByServer. */ +public final class FailoverGroupsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupList.json + */ + /** + * Sample code: List failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void listFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.failoverGroups().listByServer("Default", "failover-group-primary-server", Context.NONE); + } +} +``` + +### FailoverGroups_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.FailoverGroup; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.ReadWriteEndpointFailoverPolicy; +import java.util.Arrays; + +/** Samples for FailoverGroups Update. */ +public final class FailoverGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupUpdate.json + */ + /** + * Sample code: Update failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void updateFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + FailoverGroup resource = + manager + .failoverGroups() + .getWithResponse("Default", "failover-group-primary-server", "failover-group-test-1", Context.NONE) + .getValue(); + resource + .update() + .withReadWriteEndpoint( + new FailoverGroupReadWriteEndpoint() + .withFailoverPolicy(ReadWriteEndpointFailoverPolicy.AUTOMATIC) + .withFailoverWithDataLossGracePeriodMinutes(120)) + .withDatabases( + Arrays + .asList( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-1")) + .apply(); + } +} +``` + +### FirewallRules_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.FirewallRule; + +/** Samples for FirewallRules CreateOrUpdate. */ +public final class FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleCreate.json + */ + /** + * Sample code: Create a firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void createAFirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .define("firewallrulecrudtest-5370") + .withExistingServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285") + .withStartIpAddress("0.0.0.3") + .withEndIpAddress("0.0.0.3") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleUpdate.json + */ + /** + * Sample code: Update a firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAFirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + FirewallRule resource = + manager + .firewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-3927", Context.NONE) + .getValue(); + resource.update().withStartIpAddress("0.0.0.1").withEndIpAddress("0.0.0.1").apply(); + } +} +``` + +### FirewallRules_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for FirewallRules Delete. */ +public final class FirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleDelete.json + */ + /** + * Sample code: Delete a firewall rule. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAFirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .deleteWithResponse( + "firewallrulecrudtest-9886", "firewallrulecrudtest-2368", "firewallrulecrudtest-7011", Context.NONE); + } +} +``` + +### FirewallRules_Get + +```java +import com.azure.core.util.Context; + +/** Samples for FirewallRules Get. */ +public final class FirewallRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleGet.json + */ + /** + * Sample code: Get Firewall Rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getFirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-2304", Context.NONE); + } +} +``` + +### FirewallRules_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for FirewallRules ListByServer. */ +public final class FirewallRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleList.json + */ + /** + * Sample code: List Firewall Rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listFirewallRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.firewallRules().listByServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285", Context.NONE); + } +} +``` + +### FirewallRules_Replace + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.FirewallRuleList; +import java.util.Arrays; + +/** Samples for FirewallRules Replace. */ +public final class FirewallRulesReplaceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleReplace.json + */ + /** + * Sample code: Replace firewall rules. + * + * @param manager Entry point to SqlManager. + */ + public static void replaceFirewallRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .replaceWithResponse( + "firewallrulecrudtest-12", + "firewallrulecrudtest-6285", + new FirewallRuleList() + .withValues( + Arrays + .asList( + new FirewallRuleInner() + .withName("firewallrulecrudtest-5370 ") + .withStartIpAddress("0.0.0.0") + .withEndIpAddress("100.0.0.0"))), + Context.NONE); + } +} +``` + +### GeoBackupPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicy; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyState; + +/** Samples for GeoBackupPolicies CreateOrUpdate. */ +public final class GeoBackupPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesCreateOrUpdate.json + */ + /** + * Sample code: Update geo backup policy. + * + * @param manager Entry point to SqlManager. + */ + public static void updateGeoBackupPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + GeoBackupPolicy resource = + manager + .geoBackupPolicies() + .getWithResponse( + "sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", GeoBackupPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(GeoBackupPolicyState.ENABLED).apply(); + } +} +``` + +### GeoBackupPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; + +/** Samples for GeoBackupPolicies Get. */ +public final class GeoBackupPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesGet.json + */ + /** + * Sample code: Get geo backup policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getGeoBackupPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .geoBackupPolicies() + .getWithResponse( + "sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", GeoBackupPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### GeoBackupPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for GeoBackupPolicies ListByDatabase. */ +public final class GeoBackupPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesList.json + */ + /** + * Sample code: List geo backup policies. + * + * @param manager Entry point to SqlManager. + */ + public static void listGeoBackupPolicies(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.geoBackupPolicies().listByDatabase("sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", Context.NONE); + } +} +``` + +### IPv6FirewallRules_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.IPv6FirewallRule; + +/** Samples for IPv6FirewallRules CreateOrUpdate. */ +public final class IPv6FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleCreate.json + */ + /** + * Sample code: Create an IPv6 firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void createAnIPv6FirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .iPv6FirewallRules() + .define("firewallrulecrudtest-5370") + .withExistingServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285") + .withStartIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0003") + .withEndIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0003") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleUpdate.json + */ + /** + * Sample code: Update an IPv6 firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnIPv6FirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + IPv6FirewallRule resource = + manager + .iPv6FirewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-3927", Context.NONE) + .getValue(); + resource + .update() + .withStartIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0001") + .withEndIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0001") + .apply(); + } +} +``` + +### IPv6FirewallRules_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for IPv6FirewallRules Delete. */ +public final class IPv6FirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleDelete.json + */ + /** + * Sample code: Delete an IPv6 firewall rule. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAnIPv6FirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .iPv6FirewallRules() + .deleteWithResponse( + "firewallrulecrudtest-9886", "firewallrulecrudtest-2368", "firewallrulecrudtest-7011", Context.NONE); + } +} +``` + +### IPv6FirewallRules_Get + +```java +import com.azure.core.util.Context; + +/** Samples for IPv6FirewallRules Get. */ +public final class IPv6FirewallRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleGet.json + */ + /** + * Sample code: Get IPv6 Firewall Rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getIPv6FirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .iPv6FirewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-2304", Context.NONE); + } +} +``` + +### IPv6FirewallRules_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for IPv6FirewallRules ListByServer. */ +public final class IPv6FirewallRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleList.json + */ + /** + * Sample code: List IPv6 Firewall Rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listIPv6FirewallRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.iPv6FirewallRules().listByServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285", Context.NONE); + } +} +``` + +### InstanceFailoverGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePairInfo; +import com.azure.resourcemanager.sql.generated.models.PartnerRegionInfo; +import com.azure.resourcemanager.sql.generated.models.ReadOnlyEndpointFailoverPolicy; +import com.azure.resourcemanager.sql.generated.models.ReadWriteEndpointFailoverPolicy; +import java.util.Arrays; + +/** Samples for InstanceFailoverGroups CreateOrUpdate. */ +public final class InstanceFailoverGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupCreateOrUpdate.json + */ + /** + * Sample code: Create failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void createFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instanceFailoverGroups() + .define("failover-group-test-3") + .withExistingLocation("Default", "Japan East") + .withReadWriteEndpoint( + new InstanceFailoverGroupReadWriteEndpoint() + .withFailoverPolicy(ReadWriteEndpointFailoverPolicy.AUTOMATIC) + .withFailoverWithDataLossGracePeriodMinutes(480)) + .withReadOnlyEndpoint( + new InstanceFailoverGroupReadOnlyEndpoint().withFailoverPolicy(ReadOnlyEndpointFailoverPolicy.DISABLED)) + .withPartnerRegions(Arrays.asList(new PartnerRegionInfo().withLocation("Japan West"))) + .withManagedInstancePairs( + Arrays + .asList( + new ManagedInstancePairInfo() + .withPrimaryManagedInstanceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance") + .withPartnerManagedInstanceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance"))) + .create(); + } +} +``` + +### InstanceFailoverGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups Delete. */ +public final class InstanceFailoverGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupDelete.json + */ + /** + * Sample code: Delete failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().delete("Default", "Japan East", "failover-group-test-1", Context.NONE); + } +} +``` + +### InstanceFailoverGroups_Failover + +```java +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups Failover. */ +public final class InstanceFailoverGroupsFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupFailover.json + */ + /** + * Sample code: Planned failover of a failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void plannedFailoverOfAFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().failover("Default", "Japan West", "failover-group-test-3", Context.NONE); + } +} +``` + +### InstanceFailoverGroups_ForceFailoverAllowDataLoss + +```java +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups ForceFailoverAllowDataLoss. */ +public final class InstanceFailoverGroupsForceFailoverAllowDataLossSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupForceFailoverAllowDataLoss.json + */ + /** + * Sample code: Forced failover of a failover group allowing data loss. + * + * @param manager Entry point to SqlManager. + */ + public static void forcedFailoverOfAFailoverGroupAllowingDataLoss( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instanceFailoverGroups() + .forceFailoverAllowDataLoss("Default", "Japan West", "failover-group-test-3", Context.NONE); + } +} +``` + +### InstanceFailoverGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups Get. */ +public final class InstanceFailoverGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupGet.json + */ + /** + * Sample code: Get failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void getFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().getWithResponse("Default", "Japan East", "failover-group-test", Context.NONE); + } +} +``` + +### InstanceFailoverGroups_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups ListByLocation. */ +public final class InstanceFailoverGroupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupList.json + */ + /** + * Sample code: List failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void listFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().listByLocation("Default", "Japan East", Context.NONE); + } +} +``` + +### InstancePools_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.InstancePoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; + +/** Samples for InstancePools CreateOrUpdate. */ +public final class InstancePoolsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateInstancePoolMax.json + */ + /** + * Sample code: Create an instance pool with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createAnInstancePoolWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instancePools() + .define("testIP") + .withRegion("japaneast") + .withExistingResourceGroup("group1") + .withTags(mapOf("a", "b")) + .withSku(new Sku().withName("GP_Gen5").withTier("GeneralPurpose").withFamily("Gen5")) + .withSubnetId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet1") + .withVCores(8) + .withLicenseType(InstancePoolLicenseType.LICENSE_INCLUDED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateInstancePoolMin.json + */ + /** + * Sample code: Create an instance pool with min properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createAnInstancePoolWithMinProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instancePools() + .define("testIP") + .withRegion("japaneast") + .withExistingResourceGroup("group1") + .withSku(new Sku().withName("GP_Gen5").withTier("GeneralPurpose").withFamily("Gen5")) + .withSubnetId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet1") + .withVCores(8) + .withLicenseType(InstancePoolLicenseType.LICENSE_INCLUDED) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### InstancePools_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for InstancePools Delete. */ +public final class InstancePoolsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteInstancePool.json + */ + /** + * Sample code: Delete an instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAnInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().delete("group1", "testIP", Context.NONE); + } +} +``` + +### InstancePools_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for InstancePools GetByResourceGroup. */ +public final class InstancePoolsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetInstancePool.json + */ + /** + * Sample code: Get an instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getAnInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().getByResourceGroupWithResponse("group1", "testIP", Context.NONE); + } +} +``` + +### InstancePools_List + +```java +import com.azure.core.util.Context; + +/** Samples for InstancePools List. */ +public final class InstancePoolsListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListInstancePoolsBySubscriptionId.json + */ + /** + * Sample code: List instance pools in the subscription. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolsInTheSubscription(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().list(Context.NONE); + } +} +``` + +### InstancePools_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for InstancePools ListByResourceGroup. */ +public final class InstancePoolsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListInstancePoolsByResourceGroup.json + */ + /** + * Sample code: List instance pools by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolsByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().listByResourceGroup("group1", Context.NONE); + } +} +``` + +### InstancePools_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.InstancePool; +import java.util.HashMap; +import java.util.Map; + +/** Samples for InstancePools Update. */ +public final class InstancePoolsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PatchInstancePool.json + */ + /** + * Sample code: Patch an instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void patchAnInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + InstancePool resource = + manager.instancePools().getByResourceGroupWithResponse("group1", "testIP", Context.NONE).getValue(); + resource.update().withTags(mapOf("x", "y")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### JobAgents_CreateOrUpdate + +```java +/** Samples for JobAgents CreateOrUpdate. */ +public final class JobAgentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobAgent.json + */ + /** + * Sample code: Create or update a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobAgents() + .define("agent1") + .withRegion("southeastasia") + .withExistingServer("group1", "server1") + .withDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1") + .create(); + } +} +``` + +### JobAgents_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for JobAgents Delete. */ +public final class JobAgentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobAgent.json + */ + /** + * Sample code: Delete a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobAgents().delete("group1", "server1", "agent1", Context.NONE); + } +} +``` + +### JobAgents_Get + +```java +import com.azure.core.util.Context; + +/** Samples for JobAgents Get. */ +public final class JobAgentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobAgent.json + */ + /** + * Sample code: Get a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobAgents().getWithResponse("group1", "server1", "agent1", Context.NONE); + } +} +``` + +### JobAgents_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for JobAgents ListByServer. */ +public final class JobAgentsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobAgentsByServer.json + */ + /** + * Sample code: List job agents in a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobAgentsInAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobAgents().listByServer("group1", "server1", Context.NONE); + } +} +``` + +### JobAgents_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.JobAgent; +import java.util.HashMap; +import java.util.Map; + +/** Samples for JobAgents Update. */ +public final class JobAgentsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateJobAgent.json + */ + /** + * Sample code: Update a job agent's tags. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAJobAgentSTags(com.azure.resourcemanager.sql.generated.SqlManager manager) { + JobAgent resource = manager.jobAgents().getWithResponse("group1", "server1", "agent1", Context.NONE).getValue(); + resource.update().withTags(mapOf("mytag1", "myvalue1")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### JobCredentials_CreateOrUpdate + +```java +/** Samples for JobCredentials CreateOrUpdate. */ +public final class JobCredentialsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobCredential.json + */ + /** + * Sample code: Create or update a credential. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateACredential(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobCredentials() + .define("cred1") + .withExistingJobAgent("group1", "server1", "agent1") + .withUsername("myuser") + .withPassword("") + .create(); + } +} +``` + +### JobCredentials_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for JobCredentials Delete. */ +public final class JobCredentialsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobCredential.json + */ + /** + * Sample code: Delete a credential. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteACredential(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobCredentials().deleteWithResponse("group1", "server1", "agent1", "cred1", Context.NONE); + } +} +``` + +### JobCredentials_Get + +```java +import com.azure.core.util.Context; + +/** Samples for JobCredentials Get. */ +public final class JobCredentialsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobCredential.json + */ + /** + * Sample code: Get a credential. + * + * @param manager Entry point to SqlManager. + */ + public static void getACredential(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobCredentials().getWithResponse("group1", "server1", "agent1", "cred1", Context.NONE); + } +} +``` + +### JobCredentials_ListByAgent + +```java +import com.azure.core.util.Context; + +/** Samples for JobCredentials ListByAgent. */ +public final class JobCredentialsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobCredentialsByAgent.json + */ + /** + * Sample code: List credentials in a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void listCredentialsInAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobCredentials().listByAgent("group1", "server1", "agent1", Context.NONE); + } +} +``` + +### JobExecutions_Cancel + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobExecutions Cancel. */ +public final class JobExecutionsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelJobExecution.json + */ + /** + * Sample code: Cancel a job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelAJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .cancelWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + Context.NONE); + } +} +``` + +### JobExecutions_Create + +```java +import com.azure.core.util.Context; + +/** Samples for JobExecutions Create. */ +public final class JobExecutionsCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateJobExecution.json + */ + /** + * Sample code: Start a job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void startAJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobExecutions().create("group1", "server1", "agent1", "job1", Context.NONE); + } +} +``` + +### JobExecutions_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobExecutions CreateOrUpdate. */ +public final class JobExecutionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobExecution.json + */ + /** + * Sample code: Create job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void createJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .createOrUpdate( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + Context.NONE); + } +} +``` + +### JobExecutions_Get + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobExecutions Get. */ +public final class JobExecutionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecution.json + */ + /** + * Sample code: Get a job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .getWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + Context.NONE); + } +} +``` + +### JobExecutions_ListByAgent + +```java +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Samples for JobExecutions ListByAgent. */ +public final class JobExecutionsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByAgent.json + */ + /** + * Sample code: List all job executions in a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void listAllJobExecutionsInAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .listByAgent("group1", "server1", "agent1", null, null, null, null, null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByAgentWithFilter.json + */ + /** + * Sample code: List all job executions in a job agent with filtering. + * + * @param manager Entry point to SqlManager. + */ + public static void listAllJobExecutionsInAJobAgentWithFiltering( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .listByAgent( + "group1", + "server1", + "agent1", + OffsetDateTime.parse("2017-03-21T19:00:00Z"), + OffsetDateTime.parse("2017-03-21T19:05:00Z"), + OffsetDateTime.parse("2017-03-21T19:20:00Z"), + OffsetDateTime.parse("2017-03-21T19:25:00Z"), + false, + null, + null, + Context.NONE); + } +} +``` + +### JobExecutions_ListByJob + +```java +import com.azure.core.util.Context; + +/** Samples for JobExecutions ListByJob. */ +public final class JobExecutionsListByJobSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByJob.json + */ + /** + * Sample code: List a job's executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listAJobSExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .listByJob("group1", "server1", "agent1", "job1", null, null, null, null, null, null, null, Context.NONE); + } +} +``` + +### JobStepExecutions_Get + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobStepExecutions Get. */ +public final class JobStepExecutionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecutionStep.json + */ + /** + * Sample code: Get a job step execution. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobStepExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobStepExecutions() + .getWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + "step1", + Context.NONE); + } +} +``` + +### JobStepExecutions_ListByJobExecution + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobStepExecutions ListByJobExecution. */ +public final class JobStepExecutionsListByJobExecutionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionSteps.json + */ + /** + * Sample code: List job step executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobStepExecutions() + .listByJobExecution( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} +``` + +### JobSteps_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.JobStepAction; +import com.azure.resourcemanager.sql.generated.models.JobStepActionSource; +import com.azure.resourcemanager.sql.generated.models.JobStepActionType; +import com.azure.resourcemanager.sql.generated.models.JobStepExecutionOptions; +import com.azure.resourcemanager.sql.generated.models.JobStepOutput; +import com.azure.resourcemanager.sql.generated.models.JobStepOutputType; +import java.util.UUID; + +/** Samples for JobSteps CreateOrUpdate. */ +public final class JobStepsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobStepMin.json + */ + /** + * Sample code: Create or update a job step with minimal properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAJobStepWithMinimalPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobSteps() + .define("step1") + .withExistingJob("group1", "server1", "agent1", "job1") + .withTargetGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup0") + .withCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0") + .withAction(new JobStepAction().withValue("select 1")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobStepMax.json + */ + /** + * Sample code: Create or update a job step with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAJobStepWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobSteps() + .define("step1") + .withExistingJob("group1", "server1", "agent1", "job1") + .withStepId(1) + .withTargetGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1") + .withCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1") + .withAction( + new JobStepAction() + .withType(JobStepActionType.TSQL) + .withSource(JobStepActionSource.INLINE) + .withValue("select 2")) + .withOutput( + new JobStepOutput() + .withType(JobStepOutputType.SQL_DATABASE) + .withSubscriptionId(UUID.fromString("3501b905-a848-4b5d-96e8-b253f62d735a")) + .withResourceGroupName("group3") + .withServerName("server3") + .withDatabaseName("database3") + .withSchemaName("myschema1234") + .withTableName("mytable5678") + .withCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0")) + .withExecutionOptions( + new JobStepExecutionOptions() + .withTimeoutSeconds(1234) + .withRetryAttempts(42) + .withInitialRetryIntervalSeconds(11) + .withMaximumRetryIntervalSeconds(222) + .withRetryIntervalBackoffMultiplier(3.0f)) + .create(); + } +} +``` + +### JobSteps_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for JobSteps Delete. */ +public final class JobStepsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobStep.json + */ + /** + * Sample code: Delete a job step. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAJobStep(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().deleteWithResponse("group1", "server1", "agent1", "job1", "step1", Context.NONE); + } +} +``` + +### JobSteps_Get + +```java +import com.azure.core.util.Context; + +/** Samples for JobSteps Get. */ +public final class JobStepsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobStepByJob.json + */ + /** + * Sample code: Get the latest version of a job step. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLatestVersionOfAJobStep(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().getWithResponse("group1", "server1", "agent1", "job1", "step1", Context.NONE); + } +} +``` + +### JobSteps_GetByVersion + +```java +import com.azure.core.util.Context; + +/** Samples for JobSteps GetByVersion. */ +public final class JobStepsGetByVersionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobStepByVersion.json + */ + /** + * Sample code: Get the specified version of a job step. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheSpecifiedVersionOfAJobStep(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().getByVersionWithResponse("group1", "server1", "agent1", "job1", 1, "step1", Context.NONE); + } +} +``` + +### JobSteps_ListByJob + +```java +import com.azure.core.util.Context; + +/** Samples for JobSteps ListByJob. */ +public final class JobStepsListByJobSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobStepsByJob.json + */ + /** + * Sample code: List job steps for the latest version of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepsForTheLatestVersionOfAJob( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().listByJob("group1", "server1", "agent1", "job1", Context.NONE); + } +} +``` + +### JobSteps_ListByVersion + +```java +import com.azure.core.util.Context; + +/** Samples for JobSteps ListByVersion. */ +public final class JobStepsListByVersionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobStepsByVersion.json + */ + /** + * Sample code: List job steps for the specified version of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepsForTheSpecifiedVersionOfAJob( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().listByVersion("group1", "server1", "agent1", "job1", 1, Context.NONE); + } +} +``` + +### JobTargetExecutions_Get + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobTargetExecutions Get. */ +public final class JobTargetExecutionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecutionTarget.json + */ + /** + * Sample code: Get a job step target execution. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobStepTargetExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetExecutions() + .getWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + "step1", + UUID.fromString("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), + Context.NONE); + } +} +``` + +### JobTargetExecutions_ListByJobExecution + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobTargetExecutions ListByJobExecution. */ +public final class JobTargetExecutionsListByJobExecutionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionTargetsByExecution.json + */ + /** + * Sample code: List job step target executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepTargetExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetExecutions() + .listByJobExecution( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} +``` + +### JobTargetExecutions_ListByStep + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobTargetExecutions ListByStep. */ +public final class JobTargetExecutionsListByStepSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionTargetsByStep.json + */ + /** + * Sample code: List job step target executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepTargetExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetExecutions() + .listByStep( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + "step1", + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} +``` + +### JobTargetGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.JobTarget; +import com.azure.resourcemanager.sql.generated.models.JobTargetGroupMembershipType; +import com.azure.resourcemanager.sql.generated.models.JobTargetType; +import java.util.Arrays; + +/** Samples for JobTargetGroups CreateOrUpdate. */ +public final class JobTargetGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobTargetGroupMin.json + */ + /** + * Sample code: Create or update a target group with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateATargetGroupWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetGroups() + .define("targetGroup1") + .withExistingJobAgent("group1", "server1", "agent1") + .withMembers(Arrays.asList()) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobTargetGroupMax.json + */ + /** + * Sample code: Create or update a target group with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateATargetGroupWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetGroups() + .define("targetGroup1") + .withExistingJobAgent("group1", "server1", "agent1") + .withMembers( + Arrays + .asList( + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.EXCLUDE) + .withType(JobTargetType.SQL_DATABASE) + .withServerName("server1") + .withDatabaseName("database1"), + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.INCLUDE) + .withType(JobTargetType.SQL_SERVER) + .withServerName("server1") + .withRefreshCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.INCLUDE) + .withType(JobTargetType.SQL_ELASTIC_POOL) + .withServerName("server2") + .withElasticPoolName("pool1") + .withRefreshCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.INCLUDE) + .withType(JobTargetType.SQL_SHARD_MAP) + .withServerName("server3") + .withShardMapName("shardMap1") + .withRefreshCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"))) + .create(); + } +} +``` + +### JobTargetGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for JobTargetGroups Delete. */ +public final class JobTargetGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobTargetGroup.json + */ + /** + * Sample code: Delete a target group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteATargetGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobTargetGroups().deleteWithResponse("group1", "server1", "agent1", "targetGroup1", Context.NONE); + } +} +``` + +### JobTargetGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for JobTargetGroups Get. */ +public final class JobTargetGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobTargetGroup.json + */ + /** + * Sample code: Get a target group. + * + * @param manager Entry point to SqlManager. + */ + public static void getATargetGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobTargetGroups().getWithResponse("group1", "server1", "agent1", "targetGroup1", Context.NONE); + } +} +``` + +### JobTargetGroups_ListByAgent + +```java +import com.azure.core.util.Context; + +/** Samples for JobTargetGroups ListByAgent. */ +public final class JobTargetGroupsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobTargetGroups.json + */ + /** + * Sample code: Get all target groups in an agent. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllTargetGroupsInAnAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobTargetGroups().listByAgent("group1", "server1", "agent1", Context.NONE); + } +} +``` + +### JobVersions_Get + +```java +import com.azure.core.util.Context; + +/** Samples for JobVersions Get. */ +public final class JobVersionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobVersion.json + */ + /** + * Sample code: Get a version of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void getAVersionOfAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobVersions().getWithResponse("group1", "server1", "agent1", "job1", 1, Context.NONE); + } +} +``` + +### JobVersions_ListByJob + +```java +import com.azure.core.util.Context; + +/** Samples for JobVersions ListByJob. */ +public final class JobVersionsListByJobSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobVersions.json + */ + /** + * Sample code: Get all versions of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllVersionsOfAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobVersions().listByJob("group1", "server1", "agent1", "job1", Context.NONE); + } +} +``` + +### Jobs_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.JobSchedule; +import com.azure.resourcemanager.sql.generated.models.JobScheduleType; +import java.time.OffsetDateTime; + +/** Samples for Jobs CreateOrUpdate. */ +public final class JobsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobMin.json + */ + /** + * Sample code: Create a job with default properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createAJobWithDefaultProperties(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().define("job1").withExistingJobAgent("group1", "server1", "agent1").create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobMax.json + */ + /** + * Sample code: Create a job with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAJobWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobs() + .define("job1") + .withExistingJobAgent("group1", "server1", "agent1") + .withDescription("my favourite job") + .withSchedule( + new JobSchedule() + .withStartTime(OffsetDateTime.parse("2015-09-24T18:30:01Z")) + .withEndTime(OffsetDateTime.parse("2015-09-24T23:59:59Z")) + .withType(JobScheduleType.RECURRING) + .withEnabled(true) + .withInterval("PT5M")) + .create(); + } +} +``` + +### Jobs_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Jobs Delete. */ +public final class JobsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJob.json + */ + /** + * Sample code: Delete a job. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().deleteWithResponse("group1", "server1", "agent1", "job1", Context.NONE); + } +} +``` + +### Jobs_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Jobs Get. */ +public final class JobsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJob.json + */ + /** + * Sample code: Get a job. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().getWithResponse("group1", "server1", "agent1", "job1", Context.NONE); + } +} +``` + +### Jobs_ListByAgent + +```java +import com.azure.core.util.Context; + +/** Samples for Jobs ListByAgent. */ +public final class JobsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobsByAgent.json + */ + /** + * Sample code: List jobs in a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobsInAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().listByAgent("group1", "server1", "agent1", Context.NONE); + } +} +``` + +### LedgerDigestUploadsOperation_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; + +/** Samples for LedgerDigestUploadsOperation CreateOrUpdate. */ +public final class LedgerDigestUploadsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsEnable.json + */ + /** + * Sample code: Enables ledger digest upload configuration for a database. + * + * @param manager Entry point to SqlManager. + */ + public static void enablesLedgerDigestUploadConfigurationForADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .define(LedgerDigestUploadsName.CURRENT) + .withExistingDatabase("ledgertestrg", "ledgertestserver", "testdb") + .withDigestStorageEndpoint("https://MyAccount.blob.core.windows.net") + .create(); + } +} +``` + +### LedgerDigestUploadsOperation_Disable + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; + +/** Samples for LedgerDigestUploadsOperation Disable. */ +public final class LedgerDigestUploadsOperationDisableSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsDisable.json + */ + /** + * Sample code: Disables uploading ledger digests for a database. + * + * @param manager Entry point to SqlManager. + */ + public static void disablesUploadingLedgerDigestsForADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .disable("ledgertestrg", "ledgertestserver", "testdb", LedgerDigestUploadsName.CURRENT, Context.NONE); + } +} +``` + +### LedgerDigestUploadsOperation_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; + +/** Samples for LedgerDigestUploadsOperation Get. */ +public final class LedgerDigestUploadsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsGet.json + */ + /** + * Sample code: Gets the current ledger digest upload configuration for a database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheCurrentLedgerDigestUploadConfigurationForADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .getWithResponse( + "ledgertestrg", "ledgertestserver", "testdb", LedgerDigestUploadsName.CURRENT, Context.NONE); + } +} +``` + +### LedgerDigestUploadsOperation_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for LedgerDigestUploadsOperation ListByDatabase. */ +public final class LedgerDigestUploadsOperationListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsList.json + */ + /** + * Sample code: Gets list of ledger digest upload settings on a database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfLedgerDigestUploadSettingsOnADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .listByDatabase("ledgertestrg", "ledgertestserver", "testdb", Context.NONE); + } +} +``` + +### LongTermRetentionBackups_Copy + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CopyLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups Copy. */ +public final class LongTermRetentionBackupsCopySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupCopy.json + */ + /** + * Sample code: Copy the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void copyTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .copy( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new CopyLongTermRetentionBackupParameters() + .withTargetServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver2") + .withTargetDatabaseName("testDatabase2") + .withTargetBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} +``` + +### LongTermRetentionBackups_CopyByResourceGroup + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CopyLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups CopyByResourceGroup. */ +public final class LongTermRetentionBackupsCopyByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupCopy.json + */ + /** + * Sample code: Copy the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void copyTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .copyByResourceGroup( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new CopyLongTermRetentionBackupParameters() + .withTargetServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver2") + .withTargetDatabaseName("testDatabase2") + .withTargetBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} +``` + +### LongTermRetentionBackups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups Delete. */ +public final class LongTermRetentionBackupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .delete( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionBackups_DeleteByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups DeleteByResourceGroup. */ +public final class LongTermRetentionBackupsDeleteByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .deleteByResourceGroup( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionBackups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups Get. */ +public final class LongTermRetentionBackupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .getWithResponse( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionBackups_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups GetByResourceGroup. */ +public final class LongTermRetentionBackupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .getByResourceGroupWithResponse( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionBackups_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByDatabase. */ +public final class LongTermRetentionBackupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByDatabase("japaneast", "testserver", "testDatabase", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionBackups_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByLocation. */ +public final class LongTermRetentionBackupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionBackups().listByLocation("japaneast", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionBackups_ListByResourceGroupDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByResourceGroupDatabase. */ +public final class LongTermRetentionBackupsListByResourceGroupDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByResourceGroupDatabase( + "testResourceGroup", "japaneast", "testserver", "testDatabase", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionBackups_ListByResourceGroupLocation + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByResourceGroupLocation. */ +public final class LongTermRetentionBackupsListByResourceGroupLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByResourceGroupLocation("testResourceGroup", "japaneast", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionBackups_ListByResourceGroupServer + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByResourceGroupServer. */ +public final class LongTermRetentionBackupsListByResourceGroupServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByServer.json + */ + /** + * Sample code: Get all long term retention backups under the server. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByResourceGroupServer("testResourceGroup", "japaneast", "testserver", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionBackups_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByServer. */ +public final class LongTermRetentionBackupsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByServer.json + */ + /** + * Sample code: Get all long term retention backups under the server. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionBackups().listByServer("japaneast", "testserver", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionBackups_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.UpdateLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups Update. */ +public final class LongTermRetentionBackupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupUpdate.json + */ + /** + * Sample code: Update the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .update( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new UpdateLongTermRetentionBackupParameters() + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} +``` + +### LongTermRetentionBackups_UpdateByResourceGroup + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.UpdateLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups UpdateByResourceGroup. */ +public final class LongTermRetentionBackupsUpdateByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupUpdate.json + */ + /** + * Sample code: Update the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .updateByResourceGroup( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new UpdateLongTermRetentionBackupParameters() + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups Delete. */ +public final class LongTermRetentionManagedInstanceBackupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .delete( + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_DeleteByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups DeleteByResourceGroup. */ +public final class LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .deleteByResourceGroup( + "testResourceGroup", + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups Get. */ +public final class LongTermRetentionManagedInstanceBackupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup of a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackupOfAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .getWithResponse( + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups GetByResourceGroup. */ +public final class LongTermRetentionManagedInstanceBackupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .getByResourceGroupWithResponse( + "testResourceGroup", + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByDatabase. */ +public final class LongTermRetentionManagedInstanceBackupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByDatabase("japaneast", "testInstance", "testDatabase", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByInstance. */ +public final class LongTermRetentionManagedInstanceBackupsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByInstance.json + */ + /** + * Sample code: Get all long term retention backups under the managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByInstance("japaneast", "testInstance", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByLocation. */ +public final class LongTermRetentionManagedInstanceBackupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionManagedInstanceBackups().listByLocation("japaneast", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_ListByResourceGroupDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByResourceGroupDatabase. */ +public final class LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByResourceGroupDatabase( + "testResourceGroup", "japaneast", "testInstance", "testDatabase", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_ListByResourceGroupInstance + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByResourceGroupInstance. */ +public final class LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByInstance.json + */ + /** + * Sample code: Get all long term retention backups under the managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByResourceGroupInstance("testResourceGroup", "japaneast", "testInstance", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_ListByResourceGroupLocation + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByResourceGroupLocation. */ +public final class LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByResourceGroupLocation("testResourceGroup", "japaneast", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; + +/** Samples for LongTermRetentionPolicies CreateOrUpdate. */ +public final class LongTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyCreateOrUpdate.json + */ + /** + * Sample code: Create or update the long term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateTheLongTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionPolicies() + .define(LongTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("resourceGroup", "testserver", "testDatabase") + .withWeeklyRetention("P1M") + .withMonthlyRetention("P1Y") + .withYearlyRetention("P5Y") + .withWeekOfYear(5) + .create(); + } +} +``` + +### LongTermRetentionPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; + +/** Samples for LongTermRetentionPolicies Get. */ +public final class LongTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyGet.json + */ + /** + * Sample code: Get the long term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionPolicies() + .getWithResponse( + "resourceGroup", "testserver", "testDatabase", LongTermRetentionPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### LongTermRetentionPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionPolicies ListByDatabase. */ +public final class LongTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyListByDatabase.json + */ + /** + * Sample code: Get the long term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionPolicies().listByDatabase("resourceGroup", "testserver", "testDatabase", Context.NONE); + } +} +``` + +### MaintenanceWindowOptionsOperation_Get + +```java +import com.azure.core.util.Context; + +/** Samples for MaintenanceWindowOptionsOperation Get. */ +public final class MaintenanceWindowOptionsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetMaintenanceWindowOptions.json + */ + /** + * Sample code: Gets a list of available maintenance windows for a selected database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAvailableMaintenanceWindowsForASelectedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .maintenanceWindowOptionsOperations() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", "current", Context.NONE); + } +} +``` + +### MaintenanceWindowsOperation_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner; +import com.azure.resourcemanager.sql.generated.models.DayOfWeek; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import java.util.Arrays; + +/** Samples for MaintenanceWindowsOperation CreateOrUpdate. */ +public final class MaintenanceWindowsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateMaintenanceWindows.json + */ + /** + * Sample code: Sets maintenance window settings for a selected database. + * + * @param manager Entry point to SqlManager. + */ + public static void setsMaintenanceWindowSettingsForASelectedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .maintenanceWindowsOperations() + .createOrUpdateWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdwdb", + "current", + new MaintenanceWindowsInner() + .withTimeRanges( + Arrays + .asList( + new MaintenanceWindowTimeRange() + .withDayOfWeek(DayOfWeek.SATURDAY) + .withStartTime("00:00:00") + .withDuration("PT60M"))), + Context.NONE); + } +} +``` + +### MaintenanceWindowsOperation_Get + +```java +import com.azure.core.util.Context; + +/** Samples for MaintenanceWindowsOperation Get. */ +public final class MaintenanceWindowsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetMaintenanceWindows.json + */ + /** + * Sample code: Gets maintenance window settings for a selected database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsMaintenanceWindowSettingsForASelectedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .maintenanceWindowsOperations() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", "current", Context.NONE); + } +} +``` + +### ManagedBackupShortTermRetentionPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedBackupShortTermRetentionPolicies CreateOrUpdate. */ +public final class ManagedBackupShortTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedBackupShortTermRetentionPolicies() + .define(ManagedShortTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("resourceGroup", "testsvr", "testdb") + .withRetentionDays(14) + .create(); + } +} +``` + +### ManagedBackupShortTermRetentionPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedBackupShortTermRetentionPolicies Get. */ +public final class ManagedBackupShortTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedBackupShortTermRetentionPolicies() + .getWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + ManagedShortTermRetentionPolicyName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedBackupShortTermRetentionPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedBackupShortTermRetentionPolicies ListByDatabase. */ +public final class ManagedBackupShortTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetListManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Get the short term retention policy list for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyListForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedBackupShortTermRetentionPolicies() + .listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} +``` + +### ManagedBackupShortTermRetentionPolicies_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedBackupShortTermRetentionPolicies Update. */ +public final class ManagedBackupShortTermRetentionPoliciesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedBackupShortTermRetentionPolicy resource = + manager + .managedBackupShortTermRetentionPolicies() + .getWithResponse( + "resourceGroup", "testsvr", "testdb", ManagedShortTermRetentionPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withRetentionDays(14).apply(); + } +} +``` + +### ManagedDatabaseColumns_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseColumns Get. */ +public final class ManagedDatabaseColumnsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnGet.json + */ + /** + * Sample code: Get managed database column. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedDatabaseColumn(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .getWithResponse("myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", "column1", Context.NONE); + } +} +``` + +### ManagedDatabaseColumns_ListByDatabase + +```java +import com.azure.core.util.Context; +import java.util.Arrays; + +/** Samples for ManagedDatabaseColumns ListByDatabase. */ +public final class ManagedDatabaseColumnsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedColumnsListByDatabaseMin.json + */ + /** + * Sample code: List managed database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .listByDatabase("myRG", "serverName", "myDatabase", null, null, null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedColumnsListByDatabaseMax.json + */ + /** + * Sample code: Filter managed database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void filterManagedDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .listByDatabase( + "myRG", + "serverName", + "myDatabase", + Arrays.asList("dbo"), + Arrays.asList("customer", "address"), + Arrays.asList("username"), + Arrays.asList("schema asc", "table", "column desc"), + null, + Context.NONE); + } +} +``` + +### ManagedDatabaseColumns_ListByTable + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseColumns ListByTable. */ +public final class ManagedDatabaseColumnsListByTableSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnListByTable.json + */ + /** + * Sample code: List managed database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .listByTable("myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", null, Context.NONE); + } +} +``` + +### ManagedDatabaseQueries_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseQueries Get. */ +public final class ManagedDatabaseQueriesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryGet.json + */ + /** + * Sample code: Obtain query properties. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryProperties(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "database_1", "42", Context.NONE); + } +} +``` + +### ManagedDatabaseQueries_ListByQuery + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; + +/** Samples for ManagedDatabaseQueries ListByQuery. */ +public final class ManagedDatabaseQueriesListByQuerySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsListMax.json + */ + /** + * Sample code: Obtain query execution statistics. Example with all request parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryExecutionStatisticsExampleWithAllRequestParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .listByQuery( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "database_1", + "42", + "03/01/2020 16:23:09", + "03/11/2020 14:00:00", + QueryTimeGrainType.P1D, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsList.json + */ + /** + * Sample code: Obtain query execution statistics. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryExecutionStatistics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .listByQuery("sqlcrudtest-7398", "sqlcrudtest-4645", "database_1", "42", null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsListMin.json + */ + /** + * Sample code: Obtain query execution statistics. Minimal example with only mandatory request parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryExecutionStatisticsMinimalExampleWithOnlyMandatoryRequestParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .listByQuery( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "database_1", + "42", + null, + null, + QueryTimeGrainType.PT1H, + Context.NONE); + } +} +``` + +### ManagedDatabaseRecommendedSensitivityLabels_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdate; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for ManagedDatabaseRecommendedSensitivityLabels Update. */ +public final class ManagedDatabaseRecommendedSensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsRecommendedUpdate.json + */ + /** + * Sample code: Update recommended sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateRecommendedSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseRecommendedSensitivityLabels() + .updateWithResponse( + "myRG", + "myManagedInstanceName", + "myDatabase", + new RecommendedSensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.ENABLE) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.DISABLE) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.DISABLE) + .withSchema("dbo") + .withTable("Table1") + .withColumn("Column3"))), + Context.NONE); + } +} +``` + +### ManagedDatabaseRestoreDetails_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.RestoreDetailsName; + +/** Samples for ManagedDatabaseRestoreDetails Get. */ +public final class ManagedDatabaseRestoreDetailsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseRestoreDetails.json + */ + /** + * Sample code: Managed database restore details. + * + * @param manager Entry point to SqlManager. + */ + public static void managedDatabaseRestoreDetails(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseRestoreDetails() + .getWithResponse( + "Default-SQL-SouthEastAsia", "managedInstance", "testdb", RestoreDetailsName.DEFAULT, Context.NONE); + } +} +``` + +### ManagedDatabaseSchemas_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSchemas Get. */ +public final class ManagedDatabaseSchemasGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSchemaGet.json + */ + /** + * Sample code: Get managed database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSchemas() + .getWithResponse("myRG", "myManagedInstanceName", "myDatabase", "dbo", Context.NONE); + } +} +``` + +### ManagedDatabaseSchemas_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSchemas ListByDatabase. */ +public final class ManagedDatabaseSchemasListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSchemaListByDatabase.json + */ + /** + * Sample code: List managed database schemas. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseSchemas(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSchemas() + .listByDatabase("myRG", "myManagedInstanceName", "myDatabase", null, Context.NONE); + } +} +``` + +### ManagedDatabaseSecurityAlertPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +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.util.Arrays; + +/** Samples for ManagedDatabaseSecurityAlertPolicies CreateOrUpdate. */ +public final class ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertCreateMax.json + */ + /** + * Sample code: Update a database's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabaseSecurityAlertPolicy resource = + manager + .managedDatabaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Sql_Injection", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("test@contoso.com", "user@contoso.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(6) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertCreateMin.json + */ + /** + * Sample code: Update a database's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabaseSecurityAlertPolicy resource = + manager + .managedDatabaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertPolicyState.ENABLED).apply(); + } +} +``` + +### ManagedDatabaseSecurityAlertPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for ManagedDatabaseSecurityAlertPolicies Get. */ +public final class ManagedDatabaseSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertGet.json + */ + /** + * Sample code: Get a database's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSThreatDetectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-6852", "securityalert-2080", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### ManagedDatabaseSecurityAlertPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSecurityAlertPolicies ListByDatabase. */ +public final class ManagedDatabaseSecurityAlertPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertListByDatabase.json + */ + /** + * Sample code: Get a list of the database's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfTheDatabaseSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityAlertPolicies() + .listByDatabase("securityalert-6852", "securityalert-2080", "testdb", Context.NONE); + } +} +``` + +### ManagedDatabaseSecurityEvents_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSecurityEvents ListByDatabase. */ +public final class ManagedDatabaseSecurityEventsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityEventsGetMin.json + */ + /** + * Sample code: Get the managed database's security events with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedDatabaseSSecurityEventsWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityEvents() + .listByDatabase("testrg", "testcl", "database1", null, null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityEventsGetMax.json + */ + /** + * Sample code: Get the managed database's security events with maximal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedDatabaseSSecurityEventsWithMaximalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityEvents() + .listByDatabase( + "testrg", + "testcl", + "database1", + "ShowServerRecords eq true", + 0, + 1, + "eyJCbG9iTmFtZURhdGVUaW1lIjoiXC9EYXRlKDE1MTIyODg4MTIwMTArMDIwMClcLyIsIkJsb2JOYW1lUm9sbG92ZXJJbmRleCI6IjAiLCJFbmREYXRlIjoiXC9EYXRlKDE1MTI0NjYyMDA1MjkpXC8iLCJJc1NraXBUb2tlblNldCI6ZmFsc2UsIklzVjJCbG9iVGltZUZvcm1hdCI6dHJ1ZSwiU2hvd1NlcnZlclJlY29yZHMiOmZhbHNlLCJTa2lwVmFsdWUiOjAsIlRha2VWYWx1ZSI6MTB9", + Context.NONE); + } +} +``` + +### ManagedDatabaseSensitivityLabels_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; + +/** Samples for ManagedDatabaseSensitivityLabels CreateOrUpdate. */ +public final class ManagedDatabaseSensitivityLabelsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelCreate.json + */ + /** + * Sample code: Updates or creates a sensitivity label of a given column with all parameters in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesOrCreatesASensitivityLabelOfAGivenColumnWithAllParametersInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .define() + .withExistingColumn("myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn") + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646") + .withRank(SensitivityLabelRank.HIGH) + .create(); + } +} +``` + +### ManagedDatabaseSensitivityLabels_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels Delete. */ +public final class ManagedDatabaseSensitivityLabelsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelDelete.json + */ + /** + * Sample code: Deletes the sensitivity label of a given column in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesTheSensitivityLabelOfAGivenColumnInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .deleteWithResponse( + "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} +``` + +### ManagedDatabaseSensitivityLabels_DisableRecommendation + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels DisableRecommendation. */ +public final class ManagedDatabaseSensitivityLabelsDisableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseRecommendedColumnSensitivityLabelDisable.json + */ + /** + * Sample code: Disables the sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void disablesTheSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .disableRecommendationWithResponse( + "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} +``` + +### ManagedDatabaseSensitivityLabels_EnableRecommendation + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels EnableRecommendation. */ +public final class ManagedDatabaseSensitivityLabelsEnableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseRecommendedColumnSensitivityLabelEnable.json + */ + /** + * Sample code: Enables the sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void enablesTheSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .enableRecommendationWithResponse( + "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} +``` + +### ManagedDatabaseSensitivityLabels_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; + +/** Samples for ManagedDatabaseSensitivityLabels Get. */ +public final class ManagedDatabaseSensitivityLabelsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelGet.json + */ + /** + * Sample code: Gets the sensitivity label of a given column in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheSensitivityLabelOfAGivenColumnInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .getWithResponse( + "myRG", + "myManagedInstanceName", + "myDatabase", + "dbo", + "myTable", + "myColumn", + SensitivityLabelSource.CURRENT, + Context.NONE); + } +} +``` + +### ManagedDatabaseSensitivityLabels_ListCurrentByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels ListCurrentByDatabase. */ +public final class ManagedDatabaseSensitivityLabelsListCurrentByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsListByDatabaseCurrent.json + */ + /** + * Sample code: Gets the current sensitivity labels of a given database in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheCurrentSensitivityLabelsOfAGivenDatabaseInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .listCurrentByDatabase("myRG", "myManagedInstanceName", "myDatabase", null, null, null, Context.NONE); + } +} +``` + +### ManagedDatabaseSensitivityLabels_ListRecommendedByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels ListRecommendedByDatabase. */ +public final class ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsListByDatabaseRecommended.json + */ + /** + * Sample code: Gets the recommended sensitivity labels of a given database in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheRecommendedSensitivityLabelsOfAGivenDatabaseInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .listRecommendedByDatabase("myRG", "myManagedInstanceName", "myDatabase", null, null, null, Context.NONE); + } +} +``` + +### ManagedDatabaseSensitivityLabels_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for ManagedDatabaseSensitivityLabels Update. */ +public final class ManagedDatabaseSensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsCurrentUpdate.json + */ + /** + * Sample code: Update sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .updateWithResponse( + "myRG", + "myManagedInstanceName", + "myDatabase", + new SensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("Highly Confidential") + .withLabelId("3A477B16-9423-432B-AA97-6069B481CEC3") + .withInformationType("Financial") + .withInformationTypeId("1D3652D6-422C-4115-82F1-65DAEBC665C8")), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646")), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.REMOVE) + .withSchema("dbo") + .withTable("Table1") + .withColumn("Column3"))), + Context.NONE); + } +} +``` + +### ManagedDatabaseTables_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseTables Get. */ +public final class ManagedDatabaseTablesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseTableGet.json + */ + /** + * Sample code: Get managed database table. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedDatabaseTable(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTables() + .getWithResponse("myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", Context.NONE); + } +} +``` + +### ManagedDatabaseTables_ListBySchema + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseTables ListBySchema. */ +public final class ManagedDatabaseTablesListBySchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseTableListBySchema.json + */ + /** + * Sample code: List managed database tables. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseTables(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTables() + .listBySchema("myRG", "myManagedInstanceName", "myDatabase", "dbo", null, Context.NONE); + } +} +``` + +### ManagedDatabaseTransparentDataEncryption_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; + +/** Samples for ManagedDatabaseTransparentDataEncryption CreateOrUpdate. */ +public final class ManagedDatabaseTransparentDataEncryptionCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionUpdate.json + */ + /** + * Sample code: Update a database's Transparent Data Encryption state with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSTransparentDataEncryptionStateWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedTransparentDataEncryption resource = + manager + .managedDatabaseTransparentDataEncryptions() + .getWithResponse( + "securitytde-42-rg", + "securitytde-42", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE) + .getValue(); + resource.update().withState(TransparentDataEncryptionState.ENABLED).apply(); + } +} +``` + +### ManagedDatabaseTransparentDataEncryption_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +/** Samples for ManagedDatabaseTransparentDataEncryption Get. */ +public final class ManagedDatabaseTransparentDataEncryptionGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionGet.json + */ + /** + * Sample code: Get a database's transparent data encryption. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSTransparentDataEncryption( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTransparentDataEncryptions() + .getWithResponse( + "security-tde-resourcegroup", + "securitytde", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE); + } +} +``` + +### ManagedDatabaseTransparentDataEncryption_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseTransparentDataEncryption ListByDatabase. */ +public final class ManagedDatabaseTransparentDataEncryptionListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionList.json + */ + /** + * Sample code: Get a list of the database's transparent data encryptions. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfTheDatabaseSTransparentDataEncryptions( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTransparentDataEncryptions() + .listByDatabase("security-tde-resourcegroup", "securitytde", "testdb", Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessmentRuleBaselines_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +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.Arrays; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentRuleBaselines CreateOrUpdate. */ +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineCreate.json + */ + /** + * Sample code: Creates or updates a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.DEFAULT, + new DatabaseVulnerabilityAssessmentRuleBaselineInner() + .withBaselineResults( + Arrays + .asList( + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userA", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userB", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userC", "SELECT", "tableId_4")))), + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessmentRuleBaselines_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentRuleBaselines Delete. */ +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineDelete.json + */ + /** + * Sample code: Removes a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void removesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentRuleBaselines() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessmentRuleBaselines_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentRuleBaselines Get. */ +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineGet.json + */ + /** + * Sample code: Gets a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.MASTER, + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessmentScans_Export + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans Export. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansExportSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanExport.json + */ + /** + * Sample code: Export a database's vulnerability assessment scan results. + * + * @param manager Entry point to SqlManager. + */ + public static void exportADatabaseSVulnerabilityAssessmentScanResults( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .exportWithResponse( + "vulnerabilityassessmenttest-4799", + "vulnerabilityassessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessmentScans_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans Get. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanRecordsGet.json + */ + /** + * Sample code: Gets a database vulnerability assessment scan record by scan ID. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseVulnerabilityAssessmentScanRecordByScanID( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessmentScans_InitiateScan + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans InitiateScan. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansInitiateScanSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScansExecute.json + */ + /** + * Sample code: Executes a database's vulnerability assessment scan. + * + * @param manager Entry point to SqlManager. + */ + public static void executesADatabaseSVulnerabilityAssessmentScan( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .initiateScan( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan01", + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessmentScans_ListByDatabase + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans ListByDatabase. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanRecordsListByDatabase.json + */ + /** + * Sample code: Gets the list of a database vulnerability assessment scan records. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheListOfADatabaseVulnerabilityAssessmentScanRecords( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .listByDatabase( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessments_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for ManagedDatabaseVulnerabilityAssessments CreateOrUpdate. */ +public final class ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a database's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createADatabaseSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + new DatabaseVulnerabilityAssessmentInner() + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentCreateMin.json + */ + /** + * Sample code: Create a database's vulnerability assessment with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createADatabaseSVulnerabilityAssessmentWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + new DatabaseVulnerabilityAssessmentInner() + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessments_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessments Delete. */ +public final class ManagedDatabaseVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessments_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessments Get. */ +public final class ManagedDatabaseVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessments_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseVulnerabilityAssessments ListByDatabase. */ +public final class ManagedDatabaseVulnerabilityAssessmentsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentListByDatabase.json + */ + /** + * Sample code: Get a database's vulnerability assessments list. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSVulnerabilityAssessmentsList( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .listByDatabase( + "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", Context.NONE); + } +} +``` + +### ManagedDatabases_CompleteRestore + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.CompleteDatabaseRestoreDefinition; + +/** Samples for ManagedDatabases CompleteRestore. */ +public final class ManagedDatabasesCompleteRestoreSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCompleteExternalRestore.json + */ + /** + * Sample code: Completes a managed database external backup restore. + * + * @param manager Entry point to SqlManager. + */ + public static void completesAManagedDatabaseExternalBackupRestore( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .completeRestore( + "myRG", + "myManagedInstanceName", + "myDatabase", + new CompleteDatabaseRestoreDefinition().withLastBackupName("testdb1_log4"), + Context.NONE); + } +} +``` + +### ManagedDatabases_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseCreateMode; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedDatabases CreateOrUpdate. */ +public final class ManagedDatabasesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateRecovery.json + */ + /** + * Sample code: Creates a new managed database from restoring a geo-replicated backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseFromRestoringAGeoReplicatedBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("testdb_recovered") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "server1") + .withCreateMode(ManagedDatabaseCreateMode.RECOVERY) + .withRecoverableDatabaseId( + "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Default-SQL-WestEurope/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateRestoreExternalBackup.json + */ + /** + * Sample code: Creates a new managed database by restoring from an external backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseByRestoringFromAnExternalBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withCreateMode(ManagedDatabaseCreateMode.RESTORE_EXTERNAL_BACKUP) + .withStorageContainerUri("https://myaccountname.blob.core.windows.net/backups") + .withStorageContainerSasToken("sv=2015-12-11&sr=c&sp=rl&sig=1234") + .withAutoCompleteRestore(true) + .withLastBackupName("last_backup_name") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateMax.json + */ + /** + * Sample code: Creates a new managed database with maximal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseWithMaximalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withTags(mapOf("tagKey1", "TagValue1")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateMin.json + */ + /** + * Sample code: Creates a new managed database with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreatePointInTimeRestore.json + */ + /** + * Sample code: Creates a new managed database using point in time restore. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseUsingPointInTimeRestore( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withRestorePointInTime(OffsetDateTime.parse("2017-07-14T05:35:31.503Z")) + .withCreateMode(ManagedDatabaseCreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateRestoreLtrBackup.json + */ + /** + * Sample code: Creates a new managed database from restoring a long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseFromRestoringALongTermRetentionBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withCreateMode(ManagedDatabaseCreateMode.RESTORE_EXTERNAL_BACKUP) + .withStorageContainerUri("https://myaccountname.blob.core.windows.net/backups") + .withStorageContainerSasToken("sv=2015-12-11&sr=c&sp=rl&sig=1234") + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ManagedDatabases_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases Delete. */ +public final class ManagedDatabasesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseDelete.json + */ + /** + * Sample code: Delete managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteManagedDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().delete("Default-SQL-SouthEastAsia", "managedInstance", "testdb", Context.NONE); + } +} +``` + +### ManagedDatabases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases Get. */ +public final class ManagedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseGet.json + */ + /** + * Sample code: Gets a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAManagedDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().getWithResponse("Test1", "managedInstance", "managedDatabase", Context.NONE); + } +} +``` + +### ManagedDatabases_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases ListByInstance. */ +public final class ManagedDatabasesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseListByManagedInstance.json + */ + /** + * Sample code: List databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabasesByManagedInstances(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().listByInstance("Test1", "managedInstance", Context.NONE); + } +} +``` + +### ManagedDatabases_ListInaccessibleByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases ListInaccessibleByInstance. */ +public final class ManagedDatabasesListInaccessibleByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InaccessibleManagedDatabaseListByManagedInstance.json + */ + /** + * Sample code: List inaccessible managed databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listInaccessibleManagedDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().listInaccessibleByInstance("testrg", "testcl", Context.NONE); + } +} +``` + +### ManagedDatabases_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabase; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedDatabases Update. */ +public final class ManagedDatabasesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseUpdateMax.json + */ + /** + * Sample code: Updates a managed database with maximal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesAManagedDatabaseWithMaximalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabase resource = + manager + .managedDatabases() + .getWithResponse("Default-SQL-SouthEastAsia", "managedInstance", "testdb", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey1", "TagValue1")).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseUpdateMin.json + */ + /** + * Sample code: Updates a managed database with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesAManagedDatabaseWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabase resource = + manager + .managedDatabases() + .getWithResponse("Default-SQL-SouthEastAsia", "managedInstance", "testdb", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey1", "TagValue1")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ManagedInstanceAdministrators_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministratorType; +import java.util.UUID; + +/** Samples for ManagedInstanceAdministrators CreateOrUpdate. */ +public final class ManagedInstanceAdministratorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorCreate.json + */ + /** + * Sample code: Create administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void createAdministratorOfManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .define(AdministratorName.ACTIVE_DIRECTORY) + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withAdministratorType(ManagedInstanceAdministratorType.ACTIVE_DIRECTORY) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("44444444-3333-2222-1111-000000000000")) + .withTenantId(UUID.fromString("55555555-4444-3333-2222-111111111111")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorUpdate.json + */ + /** + * Sample code: Update administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAdministratorOfManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceAdministrator resource = + manager + .managedInstanceAdministrators() + .getWithResponse( + "Default-SQL-SouthEastAsia", "managedInstance", AdministratorName.ACTIVE_DIRECTORY, Context.NONE) + .getValue(); + resource + .update() + .withAdministratorType(ManagedInstanceAdministratorType.ACTIVE_DIRECTORY) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("44444444-3333-2222-1111-000000000000")) + .withTenantId(UUID.fromString("55555555-4444-3333-2222-111111111111")) + .apply(); + } +} +``` + +### ManagedInstanceAdministrators_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ManagedInstanceAdministrators Delete. */ +public final class ManagedInstanceAdministratorsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorDelete.json + */ + /** + * Sample code: Delete administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAdministratorOfManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .delete("Default-SQL-SouthEastAsia", "managedInstance", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} +``` + +### ManagedInstanceAdministrators_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ManagedInstanceAdministrators Get. */ +public final class ManagedInstanceAdministratorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorGet.json + */ + /** + * Sample code: Get administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getAdministratorOfManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .getWithResponse( + "Default-SQL-SouthEastAsia", "managedInstance", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} +``` + +### ManagedInstanceAdministrators_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceAdministrators ListByInstance. */ +public final class ManagedInstanceAdministratorsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorListByInstance.json + */ + /** + * Sample code: List administrators of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listAdministratorsOfManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .listByInstance("Default-SQL-SouthEastAsia", "managedInstance", Context.NONE); + } +} +``` + +### ManagedInstanceAzureADOnlyAuthentications_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications CreateOrUpdate. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .define(AuthenticationName.DEFAULT) + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withAzureADOnlyAuthentication(false) + .create(); + } +} +``` + +### ManagedInstanceAzureADOnlyAuthentications_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications Delete. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthDelete.json + */ + /** + * Sample code: Deletes Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .delete("Default-SQL-SouthEastAsia", "managedInstance", AuthenticationName.DEFAULT, Context.NONE); + } +} +``` + +### ManagedInstanceAzureADOnlyAuthentications_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications Get. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthGet.json + */ + /** + * Sample code: Gets a Azure Active Directory only authentication property. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAAzureActiveDirectoryOnlyAuthenticationProperty( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .getWithResponse("Default-SQL-SouthEastAsia", "managedInstance", AuthenticationName.DEFAULT, Context.NONE); + } +} +``` + +### ManagedInstanceAzureADOnlyAuthentications_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications ListByInstance. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthListByInstance.json + */ + /** + * Sample code: Gets a list of Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .listByInstance("Default-SQL-SouthEastAsia", "managedInstance", Context.NONE); + } +} +``` + +### ManagedInstanceEncryptionProtectors_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceEncryptionProtector; + +/** Samples for ManagedInstanceEncryptionProtectors CreateOrUpdate. */ +public final class ManagedInstanceEncryptionProtectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorCreateOrUpdateKeyVault.json + */ + /** + * Sample code: Update the encryption protector to key vault. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToKeyVault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceEncryptionProtector resource = + manager + .managedInstanceEncryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource + .update() + .withServerKeyName("someVault_someKey_01234567890123456789012345678901") + .withAutoRotationEnabled(false) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorCreateOrUpdateServiceManaged.json + */ + /** + * Sample code: Update the encryption protector to service managed. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToServiceManaged( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceEncryptionProtector resource = + manager + .managedInstanceEncryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource.update().withServerKeyName("ServiceManaged").apply(); + } +} +``` + +### ManagedInstanceEncryptionProtectors_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for ManagedInstanceEncryptionProtectors Get. */ +public final class ManagedInstanceEncryptionProtectorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorGet.json + */ + /** + * Sample code: Get the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceEncryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} +``` + +### ManagedInstanceEncryptionProtectors_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceEncryptionProtectors ListByInstance. */ +public final class ManagedInstanceEncryptionProtectorsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorList.json + */ + /** + * Sample code: List encryption protectors by managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listEncryptionProtectorsByManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceEncryptionProtectors() + .listByInstance("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### ManagedInstanceEncryptionProtectors_Revalidate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for ManagedInstanceEncryptionProtectors Revalidate. */ +public final class ManagedInstanceEncryptionProtectorsRevalidateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorRevalidate.json + */ + /** + * Sample code: Revalidates the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void revalidatesTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceEncryptionProtectors() + .revalidate("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} +``` + +### ManagedInstanceKeys_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +/** Samples for ManagedInstanceKeys CreateOrUpdate. */ +public final class ManagedInstanceKeysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates a managed instance key. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAManagedInstanceKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceKeys() + .define("someVault_someKey_01234567890123456789012345678901") + .withExistingManagedInstance("sqlcrudtest-7398", "sqlcrudtest-4645") + .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) + .withUri("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901") + .create(); + } +} +``` + +### ManagedInstanceKeys_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceKeys Delete. */ +public final class ManagedInstanceKeysDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyDelete.json + */ + /** + * Sample code: Delete the managed instance key. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheManagedInstanceKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceKeys() + .delete( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} +``` + +### ManagedInstanceKeys_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceKeys Get. */ +public final class ManagedInstanceKeysGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyGet.json + */ + /** + * Sample code: Get the managed instance key. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedInstanceKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceKeys() + .getWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} +``` + +### ManagedInstanceKeys_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceKeys ListByInstance. */ +public final class ManagedInstanceKeysListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyList.json + */ + /** + * Sample code: List the keys for a managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheKeysForAManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstanceKeys().listByInstance("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE); + } +} +``` + +### ManagedInstanceLongTermRetentionPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; + +/** Samples for ManagedInstanceLongTermRetentionPolicies CreateOrUpdate. */ +public final class ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyCreateOrUpdate.json + */ + /** + * Sample code: Create or update the LTR policy for the managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateTheLTRPolicyForTheManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceLongTermRetentionPolicies() + .define(ManagedInstanceLongTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("testResourceGroup", "testInstance", "testDatabase") + .withWeeklyRetention("P1M") + .withMonthlyRetention("P1Y") + .withYearlyRetention("P5Y") + .withWeekOfYear(5) + .create(); + } +} +``` + +### ManagedInstanceLongTermRetentionPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; + +/** Samples for ManagedInstanceLongTermRetentionPolicies Get. */ +public final class ManagedInstanceLongTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyGet.json + */ + /** + * Sample code: Get the long term retention policy for the managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPolicyForTheManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceLongTermRetentionPolicies() + .getWithResponse( + "testResourceGroup", + "testInstance", + "testDatabase", + ManagedInstanceLongTermRetentionPolicyName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedInstanceLongTermRetentionPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceLongTermRetentionPolicies ListByDatabase. */ +public final class ManagedInstanceLongTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyListByDatabase.json + */ + /** + * Sample code: Get the long term retention policies for the managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPoliciesForTheManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceLongTermRetentionPolicies() + .listByDatabase("testResourceGroup", "testInstance", "testDatabase", Context.NONE); + } +} +``` + +### ManagedInstanceOperations_Cancel + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for ManagedInstanceOperations Cancel. */ +public final class ManagedInstanceOperationsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelManagedInstanceOperation.json + */ + /** + * Sample code: Cancel the managed instance management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelTheManagedInstanceManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceOperations() + .cancelWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + UUID.fromString("11111111-1111-1111-1111-111111111111"), + Context.NONE); + } +} +``` + +### ManagedInstanceOperations_Get + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for ManagedInstanceOperations Get. */ +public final class ManagedInstanceOperationsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedInstanceOperation.json + */ + /** + * Sample code: Gets the managed instance management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheManagedInstanceManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceOperations() + .getWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + UUID.fromString("00000000-1111-2222-3333-444444444444"), + Context.NONE); + } +} +``` + +### ManagedInstanceOperations_ListByManagedInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceOperations ListByManagedInstance. */ +public final class ManagedInstanceOperationsListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListManagedInstanceOperations.json + */ + /** + * Sample code: List the managed instance management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheManagedInstanceManagementOperations( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstanceOperations().listByManagedInstance("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### ManagedInstancePrivateEndpointConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkServiceConnectionStateProperty; + +/** Samples for ManagedInstancePrivateEndpointConnections CreateOrUpdate. */ +public final class ManagedInstancePrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstancePrivateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingManagedInstance("Default", "test-cl") + .withPrivateLinkServiceConnectionState( + new ManagedInstancePrivateLinkServiceConnectionStateProperty() + .withStatus("Approved") + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} +``` + +### ManagedInstancePrivateEndpointConnections_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateEndpointConnections Delete. */ +public final class ManagedInstancePrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstancePrivateEndpointConnections() + .delete("Default", "test-cl", "private-endpoint-connection-name", Context.NONE); + } +} +``` + +### ManagedInstancePrivateEndpointConnections_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateEndpointConnections Get. */ +public final class ManagedInstancePrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateEndpointConnection(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstancePrivateEndpointConnections() + .getWithResponse("Default", "test-cl", "private-endpoint-connection-name", Context.NONE); + } +} +``` + +### ManagedInstancePrivateEndpointConnections_ListByManagedInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateEndpointConnections ListByManagedInstance. */ +public final class ManagedInstancePrivateEndpointConnectionsListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstancePrivateEndpointConnections().listByManagedInstance("Default", "test-cl", Context.NONE); + } +} +``` + +### ManagedInstancePrivateLinkResources_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateLinkResources Get. */ +public final class ManagedInstancePrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateLinkResourcesGet.json + */ + /** + * Sample code: Gets a private link resource for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAPrivateLinkResourceForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstancePrivateLinkResources().getWithResponse("Default", "test-cl", "plr", Context.NONE); + } +} +``` + +### ManagedInstancePrivateLinkResources_ListByManagedInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateLinkResources ListByManagedInstance. */ +public final class ManagedInstancePrivateLinkResourcesListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateLinkResourcesList.json + */ + /** + * Sample code: Gets private link resources for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateLinkResourcesForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstancePrivateLinkResources().listByManagedInstance("Default", "test-cl", Context.NONE); + } +} +``` + +### ManagedInstanceTdeCertificates_Create + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; + +/** Samples for ManagedInstanceTdeCertificates Create. */ +public final class ManagedInstanceTdeCertificatesCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTdeCertificate.json + */ + /** + * Sample code: Upload a TDE certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void uploadATDECertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceTdeCertificates() + .create("testtdecert", "testtdecert", new TdeCertificate().withPrivateBlob("MIIXXXXXXXX"), Context.NONE); + } +} +``` + +### ManagedInstanceVulnerabilityAssessments_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for ManagedInstanceVulnerabilityAssessments CreateOrUpdate. */ +public final class ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateStorageAccessKeyMin.json + */ + /** + * Sample code: Create a managed instance's vulnerability assessment with minimal parameters, when + * storageAccountAccessKey is specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createAManagedInstanceSVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingManagedInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateContainerSasKeyMin.json + */ + /** + * Sample code: Create a managed instance's vulnerability assessment with minimal parameters, when + * storageContainerSasKey is specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createAManagedInstanceSVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingManagedInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a managed instance's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createAManagedInstanceSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingManagedInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))) + .create(); + } +} +``` + +### ManagedInstanceVulnerabilityAssessments_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedInstanceVulnerabilityAssessments Delete. */ +public final class ManagedInstanceVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a managed instance's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeAManagedInstanceSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedInstanceVulnerabilityAssessments_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedInstanceVulnerabilityAssessments Get. */ +public final class ManagedInstanceVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a managed instance's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedInstanceSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedInstanceVulnerabilityAssessments_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceVulnerabilityAssessments ListByInstance. */ +public final class ManagedInstanceVulnerabilityAssessmentsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentListByInstance.json + */ + /** + * Sample code: Get a managed instance's vulnerability assessment policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedInstanceSVulnerabilityAssessmentPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .listByInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", Context.NONE); + } +} +``` + +### ManagedInstances_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLicenseType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceProxyOverride; +import com.azure.resourcemanager.sql.generated.models.PrincipalType; +import com.azure.resourcemanager.sql.generated.models.ServicePrincipal; +import com.azure.resourcemanager.sql.generated.models.ServicePrincipalType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** Samples for ManagedInstances CreateOrUpdate. */ +public final class ManagedInstancesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceCreateMin.json + */ + /** + * Sample code: Create managed instance with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createManagedInstanceWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .define("testinstance") + .withRegion("Japan East") + .withExistingResourceGroup("testrg") + .withSku(new Sku().withName("GP_Gen4").withTier("GeneralPurpose")) + .withAdministratorLogin("dummylogin") + .withAdministratorLoginPassword("PLACEHOLDER") + .withSubnetId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1") + .withLicenseType(ManagedInstanceLicenseType.LICENSE_INCLUDED) + .withVCores(8) + .withStorageSizeInGB(1024) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceCreateMax.json + */ + /** + * Sample code: Create managed instance with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createManagedInstanceWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .define("testinstance") + .withRegion("Japan East") + .withExistingResourceGroup("testrg") + .withTags(mapOf("tagKey1", "TagValue1")) + .withSku(new Sku().withName("GP_Gen5").withTier("GeneralPurpose")) + .withAdministratorLogin("dummylogin") + .withAdministratorLoginPassword("PLACEHOLDER") + .withSubnetId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1") + .withLicenseType(ManagedInstanceLicenseType.LICENSE_INCLUDED) + .withVCores(8) + .withStorageSizeInGB(1024) + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withDnsZonePartner( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance") + .withPublicDataEndpointEnabled(false) + .withProxyOverride(ManagedInstanceProxyOverride.REDIRECT) + .withTimezoneId("UTC") + .withInstancePoolId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/instancePools/pool1") + .withMaintenanceConfigurationId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1") + .withMinimalTlsVersion("1.2") + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.GEO) + .withAdministrators( + new ManagedInstanceExternalAdministrator() + .withPrincipalType(PrincipalType.USER) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withTenantId(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withAzureADOnlyAuthentication(true)) + .withServicePrincipal(new ServicePrincipal().withType(ServicePrincipalType.SYSTEM_ASSIGNED)) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ManagedInstances_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstances Delete. */ +public final class ManagedInstancesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceDelete.json + */ + /** + * Sample code: Delete managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().delete("testrg", "testinstance", Context.NONE); + } +} +``` + +### ManagedInstances_Failover + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; + +/** Samples for ManagedInstances Failover. */ +public final class ManagedInstancesFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/FailoverManagedInstance.json + */ + /** + * Sample code: Failover a managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().failover("group1", "instanceName", ReplicaType.PRIMARY, Context.NONE); + } +} +``` + +### ManagedInstances_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstances GetByResourceGroup. */ +public final class ManagedInstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json + */ + /** + * Sample code: Get managed instance with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedInstanceWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceGet.json + */ + /** + * Sample code: Get managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE); + } +} +``` + +### ManagedInstances_List + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstances List. */ +public final class ManagedInstancesListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceList.json + */ + /** + * Sample code: List managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstances(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().list(null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List managed instances with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().list(null, Context.NONE); + } +} +``` + +### ManagedInstances_ListByInstancePool + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstances ListByInstancePool. */ +public final class ManagedInstancesListByInstancePoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByInstancePool.json + */ + /** + * Sample code: List managed instances by instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByInstancePool("Test1", "pool1", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByInstancePoolWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List managed instances by instance pool with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByInstancePoolWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByInstancePool("Test1", "pool1", null, Context.NONE); + } +} +``` + +### ManagedInstances_ListByManagedInstance + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.MetricType; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; + +/** Samples for ManagedInstances ListByManagedInstance. */ +public final class ManagedInstancesListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesList.json + */ + /** + * Sample code: Obtain list of instance's top resource consuming queries. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainListOfInstanceSTopResourceConsumingQueries( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .listByManagedInstance( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + null, + null, + null, + null, + QueryTimeGrainType.PT1H, + null, + MetricType.DURATION, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesListMax.json + */ + /** + * Sample code: Obtain list of instance's top resource consuming queries. Full-blown request and response. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainListOfInstanceSTopResourceConsumingQueriesFullBlownRequestAndResponse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .listByManagedInstance( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + null, + "db1,db2", + "2020-03-10T12:00:00Z", + "2020-03-12T12:00:00Z", + QueryTimeGrainType.P1D, + null, + MetricType.CPU, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesListMin.json + */ + /** + * Sample code: Obtain list of instance's top resource consuming queries. Minimal request and response. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainListOfInstanceSTopResourceConsumingQueriesMinimalRequestAndResponse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .listByManagedInstance( + "sqlcrudtest-7398", "sqlcrudtest-4645", null, null, null, null, null, null, null, Context.NONE); + } +} +``` + +### ManagedInstances_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstances ListByResourceGroup. */ +public final class ManagedInstancesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByResourceGroupWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List managed instances by resource group with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByResourceGroupWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByResourceGroup("Test1", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByResourceGroup.json + */ + /** + * Sample code: List managed instances by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByResourceGroup("Test1", null, Context.NONE); + } +} +``` + +### ManagedInstances_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedInstance; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLicenseType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceProxyOverride; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedInstances Update. */ +public final class ManagedInstancesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceUpdateMin.json + */ + /** + * Sample code: Update managed instance with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updateManagedInstanceWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstance resource = + manager + .managedInstances() + .getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey1", "TagValue1")).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceUpdateMax.json + */ + /** + * Sample code: Update managed instance with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updateManagedInstanceWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstance resource = + manager + .managedInstances() + .getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("tagKey1", "TagValue1")) + .withSku(new Sku().withName("GP_Gen4").withTier("GeneralPurpose").withCapacity(8)) + .withAdministratorLoginPassword("PLACEHOLDER") + .withLicenseType(ManagedInstanceLicenseType.BASE_PRICE) + .withVCores(8) + .withStorageSizeInGB(448) + .withPublicDataEndpointEnabled(false) + .withProxyOverride(ManagedInstanceProxyOverride.REDIRECT) + .withMaintenanceConfigurationId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1") + .withMinimalTlsVersion("1.2") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceRemoveMaintenanceConfiguration.json + */ + /** + * Sample code: Remove maintenance policy from managed instance (select default maintenance policy). + * + * @param manager Entry point to SqlManager. + */ + public static void removeMaintenancePolicyFromManagedInstanceSelectDefaultMaintenancePolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstance resource = + manager + .managedInstances() + .getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceConfigurationId( + "/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default") + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies CreateOrUpdate. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Update the short term retention policy for the restorable dropped database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheRestorableDroppedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .createOrUpdate( + "resourceGroup", + "testsvr", + "testdb,131403269876900000", + ManagedShortTermRetentionPolicyName.DEFAULT, + new ManagedBackupShortTermRetentionPolicyInner().withRetentionDays(14), + Context.NONE); + } +} +``` + +### ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies Get. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .getWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb,131403269876900000", + ManagedShortTermRetentionPolicyName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_ListByRestorableDroppedDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies ListByRestorableDroppedDatabase. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseS { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetListManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Get the short term retention policy list for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyListForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .listByRestorableDroppedDatabase( + "Default-SQL-SouthEastAsia", "testsvr", "testdb,131403269876900000", Context.NONE); + } +} +``` + +### ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies Update. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Update the short term retention policy for the restorable dropped database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheRestorableDroppedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .update( + "resourceGroup", + "testsvr", + "testdb,131403269876900000", + ManagedShortTermRetentionPolicyName.DEFAULT, + new ManagedBackupShortTermRetentionPolicyInner().withRetentionDays(14), + Context.NONE); + } +} +``` + +### ManagedServerSecurityAlertPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedServerSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import java.util.Arrays; + +/** Samples for ManagedServerSecurityAlertPolicies CreateOrUpdate. */ +public final class ManagedServerSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertCreateMin.json + */ + /** + * Sample code: Update a managed server's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedServerSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedServerSecurityAlertPolicy resource = + manager + .managedServerSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertsPolicyState.ENABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertCreateMax.json + */ + /** + * Sample code: Update a managed server's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedServerSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedServerSecurityAlertPolicy resource = + manager + .managedServerSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertsPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Access_Anomaly", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("testSecurityAlert@microsoft.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(5) + .apply(); + } +} +``` + +### ManagedServerSecurityAlertPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for ManagedServerSecurityAlertPolicies Get. */ +public final class ManagedServerSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertGet.json + */ + /** + * Sample code: Get a managed server's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedServerSThreatDetectionPolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedServerSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### ManagedServerSecurityAlertPolicies_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedServerSecurityAlertPolicies ListByInstance. */ +public final class ManagedServerSecurityAlertPoliciesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertListByInstance.json + */ + /** + * Sample code: Get the managed server's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedServerSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedServerSecurityAlertPolicies() + .listByInstance("securityalert-4799", "securityalert-6440", Context.NONE); + } +} +``` + +### OutboundFirewallRules_CreateOrUpdate + +```java +/** Samples for OutboundFirewallRules CreateOrUpdate. */ +public final class OutboundFirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleCreate.json + */ + /** + * Sample code: Approve or reject a outbound firewall rule with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void approveOrRejectAOutboundFirewallRuleWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .outboundFirewallRules() + .define("server.database.windows.net") + .withExistingServer("sqlcrudtest-7398", "sqlcrudtest-4645") + .create(); + } +} +``` + +### OutboundFirewallRules_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for OutboundFirewallRules Delete. */ +public final class OutboundFirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleDelete.json + */ + /** + * Sample code: Deletes a outbound firewall rule with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAOutboundFirewallRuleWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .outboundFirewallRules() + .delete("sqlcrudtest-7398", "sqlcrudtest-6661", "server.database.windows.net", Context.NONE); + } +} +``` + +### OutboundFirewallRules_Get + +```java +import com.azure.core.util.Context; + +/** Samples for OutboundFirewallRules Get. */ +public final class OutboundFirewallRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleGet.json + */ + /** + * Sample code: Gets outbound firewall rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getsOutboundFirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .outboundFirewallRules() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "server.database.windows.net", Context.NONE); + } +} +``` + +### OutboundFirewallRules_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for OutboundFirewallRules ListByServer. */ +public final class OutboundFirewallRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleList.json + */ + /** + * Sample code: Gets list of outbound firewall rules on a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfOutboundFirewallRulesOnAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.outboundFirewallRules().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkServiceConnectionStateStatus; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingServer("Default", "test-svr") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty() + .withStatus(PrivateLinkServiceConnectionStateStatus.APPROVED) + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} +``` + +### PrivateEndpointConnections_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .privateEndpointConnections() + .delete("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateEndpointConnection(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByServer. */ +public final class PrivateEndpointConnectionsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.privateEndpointConnections().listByServer("Default", "test-svr", Context.NONE); + } +} +``` + +### PrivateLinkResources_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateLinkResourcesGet.json + */ + /** + * Sample code: Gets a private link resource for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAPrivateLinkResourceForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.privateLinkResources().getWithResponse("Default", "test-svr", "plr", Context.NONE); + } +} +``` + +### PrivateLinkResources_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByServer. */ +public final class PrivateLinkResourcesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateLinkResourcesList.json + */ + /** + * Sample code: Gets private link resources for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateLinkResourcesForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.privateLinkResources().listByServer("Default", "test-svr", Context.NONE); + } +} +``` + +### RecommendedSensitivityLabels_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdate; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for RecommendedSensitivityLabels Update. */ +public final class RecommendedSensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsRecommendedUpdate.json + */ + /** + * Sample code: Update recommended sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateRecommendedSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .recommendedSensitivityLabels() + .updateWithResponse( + "myRG", + "myServer", + "myDatabase", + new RecommendedSensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.ENABLE) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.ENABLE) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.DISABLE) + .withSchema("dbo") + .withTable("table1") + .withColumn("column3"))), + Context.NONE); + } +} +``` + +### RecoverableDatabases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for RecoverableDatabases Get. */ +public final class RecoverableDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/RecoverableDatabaseGet.json + */ + /** + * Sample code: Get a recoverable database. + * + * @param manager Entry point to SqlManager. + */ + public static void getARecoverableDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .recoverableDatabases() + .getWithResponse( + "recoverabledatabasetest-6852", + "recoverabledatabasetest-2080", + "recoverabledatabasetest-9187", + Context.NONE); + } +} +``` + +### RecoverableDatabases_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for RecoverableDatabases ListByServer. */ +public final class RecoverableDatabasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/RecoverableDatabaseList.json + */ + /** + * Sample code: Get list of restorable dropped databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getListOfRestorableDroppedDatabases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .recoverableDatabases() + .listByServer("recoverabledatabasetest-1234", "recoverabledatabasetest-7177", Context.NONE); + } +} +``` + +### RecoverableManagedDatabases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for RecoverableManagedDatabases Get. */ +public final class RecoverableManagedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetRecoverableManagedDatabase.json + */ + /** + * Sample code: Gets a recoverable databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void getsARecoverableDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.recoverableManagedDatabases().getWithResponse("Test1", "managedInstance", "testdb", Context.NONE); + } +} +``` + +### RecoverableManagedDatabases_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for RecoverableManagedDatabases ListByInstance. */ +public final class RecoverableManagedDatabasesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListRecoverableManagedDatabasesByServer.json + */ + /** + * Sample code: List recoverable databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listRecoverableDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.recoverableManagedDatabases().listByInstance("Test1", "managedInstance", Context.NONE); + } +} +``` + +### ReplicationLinks_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks Delete. */ +public final class ReplicationLinksDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ReplicationLinkDelete.json + */ + /** + * Sample code: Delete a replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .deleteWithResponse( + "sqlcrudtest-4799", "sqlcrudtest-6440", "testdb", "5b301b68-03f6-4b26-b0f4-73ebb8634238", Context.NONE); + } +} +``` + +### ReplicationLinks_Failover + +```java +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks Failover. */ +public final class ReplicationLinksFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ReplicationLinkFailover.json + */ + /** + * Sample code: Failover a replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .failover( + "sqlcrudtest-8931", "sqlcrudtest-2137", "testdb", "f0550bf5-07ce-4270-8e4b-71737975973a", Context.NONE); + } +} +``` + +### ReplicationLinks_FailoverAllowDataLoss + +```java +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks FailoverAllowDataLoss. */ +public final class ReplicationLinksFailoverAllowDataLossSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ReplicationLinkFailover.json + */ + /** + * Sample code: Failover a replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .failoverAllowDataLoss( + "sqlcrudtest-8931", "sqlcrudtest-2137", "testdb", "f0550bf5-07ce-4270-8e4b-71737975973a", Context.NONE); + } +} +``` + +### ReplicationLinks_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks Get. */ +public final class ReplicationLinksGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ReplicationLinkGet.json + */ + /** + * Sample code: Gets the replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .getWithResponse("Default", "sourcesvr", "gamma-db", "4891ca10-ebd0-47d7-9182-c722651780fb", Context.NONE); + } +} +``` + +### ReplicationLinks_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks ListByDatabase. */ +public final class ReplicationLinksListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ReplicationLinkListByDatabase.json + */ + /** + * Sample code: List replication links on server on database. + * + * @param manager Entry point to SqlManager. + */ + public static void listReplicationLinksOnServerOnDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.replicationLinks().listByDatabase("Default", "sourcesvr", "tetha-db", Context.NONE); + } +} +``` + +### ReplicationLinks_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks ListByServer. */ +public final class ReplicationLinksListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ReplicationLinkListByServer.json + */ + /** + * Sample code: List replication links on server. + * + * @param manager Entry point to SqlManager. + */ + public static void listReplicationLinksOnServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.replicationLinks().listByServer("Default", "sourcesvr", Context.NONE); + } +} +``` + +### ReplicationLinks_Unlink + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.UnlinkParameters; + +/** Samples for ReplicationLinks Unlink. */ +public final class ReplicationLinksUnlinkSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ReplicationLinkUnlink.json + */ + /** + * Sample code: Delete replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .unlink( + "sqlcrudtest-8931", + "sqlcrudtest-2137", + "testdb", + "f0550bf5-07ce-4270-8e4b-71737975973a", + new UnlinkParameters().withForcedTermination(true), + Context.NONE); + } +} +``` + +### RestorableDroppedDatabases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedDatabases Get. */ +public final class RestorableDroppedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetRestorableDroppedDatabase.json + */ + /** + * Sample code: Gets a restorable dropped database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsARestorableDroppedDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorableDroppedDatabases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb,131403269876900000", Context.NONE); + } +} +``` + +### RestorableDroppedDatabases_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedDatabases ListByServer. */ +public final class RestorableDroppedDatabasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListRestorableDroppedDatabasesByServer.json + */ + /** + * Sample code: Gets a list of restorable dropped databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfRestorableDroppedDatabases( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorableDroppedDatabases().listByServer("Default-SQL-SouthEastAsia", "testsvr", Context.NONE); + } +} +``` + +### RestorableDroppedManagedDatabases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedManagedDatabases Get. */ +public final class RestorableDroppedManagedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetRestorableDroppedManagedDatabase.json + */ + /** + * Sample code: Gets a restorable dropped managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsARestorableDroppedManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorableDroppedManagedDatabases() + .getWithResponse("Test1", "managedInstance", "testdb,131403269876900000", Context.NONE); + } +} +``` + +### RestorableDroppedManagedDatabases_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedManagedDatabases ListByInstance. */ +public final class RestorableDroppedManagedDatabasesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/RestorableDroppedManagedDatabaseListByManagedInstance.json + */ + /** + * Sample code: List restorable dropped databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listRestorableDroppedDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorableDroppedManagedDatabases().listByInstance("Test1", "managedInstance", Context.NONE); + } +} +``` + +### RestorePoints_Create + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.CreateDatabaseRestorePointDefinition; + +/** Samples for RestorePoints Create. */ +public final class RestorePointsCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsPost.json + */ + /** + * Sample code: Creates datawarehouse database restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void createsDatawarehouseDatabaseRestorePoint( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .create( + "Default-SQL-SouthEastAsia", + "testserver", + "testDatabase", + new CreateDatabaseRestorePointDefinition().withRestorePointLabel("mylabel"), + Context.NONE); + } +} +``` + +### RestorePoints_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for RestorePoints Delete. */ +public final class RestorePointsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsDelete.json + */ + /** + * Sample code: Deletes a restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesARestorePoint(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .deleteWithResponse( + "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", Context.NONE); + } +} +``` + +### RestorePoints_Get + +```java +import com.azure.core.util.Context; + +/** Samples for RestorePoints Get. */ +public final class RestorePointsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsGet.json + */ + /** + * Sample code: Gets a database restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseRestorePoint(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DataWarehouseRestorePointsGet.json + */ + /** + * Sample code: Gets a datawarehouse database restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatawarehouseDatabaseRestorePoint( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", Context.NONE); + } +} +``` + +### RestorePoints_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for RestorePoints ListByDatabase. */ +public final class RestorePointsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsListByDatabase.json + */ + /** + * Sample code: List database restore points. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseRestorePoints(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorePoints().listByDatabase("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DataWarehouseRestorePointsListByDatabase.json + */ + /** + * Sample code: List datawarehouse database restore points. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatawarehouseDatabaseRestorePoints( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorePoints().listByDatabase("Default-SQL-SouthEastAsia", "testserver", "testDatabase", Context.NONE); + } +} +``` + +### SensitivityLabels_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; + +/** Samples for SensitivityLabels CreateOrUpdate. */ +public final class SensitivityLabelsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelCreateMax.json + */ + /** + * Sample code: Updates the sensitivity label of a given column with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesTheSensitivityLabelOfAGivenColumnWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .createOrUpdateWithResponse( + "myRG", + "myServer", + "myDatabase", + "dbo", + "myTable", + "myColumn", + new SensitivityLabelInner() + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646") + .withRank(SensitivityLabelRank.LOW), + Context.NONE); + } +} +``` + +### SensitivityLabels_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels Delete. */ +public final class SensitivityLabelsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelDelete.json + */ + /** + * Sample code: Deletes the sensitivity label of a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesTheSensitivityLabelOfAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .deleteWithResponse("myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} +``` + +### SensitivityLabels_DisableRecommendation + +```java +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels DisableRecommendation. */ +public final class SensitivityLabelsDisableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/RecommendedColumnSensitivityLabelDisable.json + */ + /** + * Sample code: Disables sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void disablesSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .disableRecommendationWithResponse( + "myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} +``` + +### SensitivityLabels_EnableRecommendation + +```java +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels EnableRecommendation. */ +public final class SensitivityLabelsEnableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/RecommendedColumnSensitivityLabelEnable.json + */ + /** + * Sample code: Enables sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void enablesSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .enableRecommendationWithResponse( + "myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} +``` + +### SensitivityLabels_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; + +/** Samples for SensitivityLabels Get. */ +public final class SensitivityLabelsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelGet.json + */ + /** + * Sample code: Gets the sensitivity label of a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheSensitivityLabelOfAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .getWithResponse( + "myRG", + "myServer", + "myDatabase", + "dbo", + "myTable", + "myColumn", + SensitivityLabelSource.CURRENT, + Context.NONE); + } +} +``` + +### SensitivityLabels_ListCurrentByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels ListCurrentByDatabase. */ +public final class SensitivityLabelsListCurrentByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsListByDatabaseWithSourceCurrent.json + */ + /** + * Sample code: Gets the current sensitivity labels of a given database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheCurrentSensitivityLabelsOfAGivenDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .listCurrentByDatabase("myRG", "myServer", "myDatabase", null, null, null, Context.NONE); + } +} +``` + +### SensitivityLabels_ListRecommendedByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels ListRecommendedByDatabase. */ +public final class SensitivityLabelsListRecommendedByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsListByDatabaseWithSourceRecommended.json + */ + /** + * Sample code: Gets the recommended sensitivity labels of a given database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheRecommendedSensitivityLabelsOfAGivenDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .listRecommendedByDatabase("myRG", "myServer", "myDatabase", null, null, null, Context.NONE); + } +} +``` + +### SensitivityLabels_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for SensitivityLabels Update. */ +public final class SensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsCurrentUpdate.json + */ + /** + * Sample code: Update sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .updateWithResponse( + "myRG", + "myServer", + "myDatabase", + new SensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("Highly Confidential") + .withLabelId("3A477B16-9423-432B-AA97-6069B481CEC3") + .withInformationType("Financial") + .withInformationTypeId("1D3652D6-422C-4115-82F1-65DAEBC665C8") + .withRank(SensitivityLabelRank.LOW)), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646") + .withRank(SensitivityLabelRank.CRITICAL)), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.REMOVE) + .withSchema("dbo") + .withTable("Table1") + .withColumn("Column3"))), + Context.NONE); + } +} +``` + +### ServerAdvisors_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerAdvisors Get. */ +public final class ServerAdvisorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorGet.json + */ + /** + * Sample code: Get server advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAdvisors().getWithResponse("workloadinsight-demos", "misosisvr", "CreateIndex", Context.NONE); + } +} +``` + +### ServerAdvisors_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerAdvisors ListByServer. */ +public final class ServerAdvisorsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorList.json + */ + /** + * Sample code: List of server advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfServerAdvisors(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAdvisors().listByServerWithResponse("workloadinsight-demos", "misosisvr", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerRecommendedActionListExpand.json + */ + /** + * Sample code: List of server recommended actions for all advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfServerRecommendedActionsForAllAdvisors( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAdvisors() + .listByServerWithResponse("workloadinsight-demos", "misosisvr", "recommendedActions", Context.NONE); + } +} +``` + +### ServerAdvisors_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatus; + +/** Samples for ServerAdvisors Update. */ +public final class ServerAdvisorsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorUpdate.json + */ + /** + * Sample code: Update server advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void updateServerAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAdvisors() + .updateWithResponse( + "workloadinsight-demos", + "misosisvr", + "CreateIndex", + new AdvisorInner().withAutoExecuteStatus(AutoExecuteStatus.DISABLED), + Context.NONE); + } +} +``` + +### ServerAutomaticTuning_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerAutomaticTuning Get. */ +public final class ServerAutomaticTuningGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningGet.json + */ + /** + * Sample code: Get a server's automatic tuning settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSAutomaticTuningSettings(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAutomaticTunings().getWithResponse("default-sql-onebox", "testsvr11", Context.NONE); + } +} +``` + +### ServerAutomaticTuning_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptionModeDesired; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerOptions; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ServerAutomaticTuning Update. */ +public final class ServerAutomaticTuningUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningUpdateMax.json + */ + /** + * Sample code: Updates server automatic tuning settings with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesServerAutomaticTuningSettingsWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + new ServerAutomaticTuningInner() + .withDesiredState(AutomaticTuningServerMode.AUTO) + .withOptions( + mapOf( + "createIndex", + new AutomaticTuningServerOptions().withDesiredState(AutomaticTuningOptionModeDesired.OFF), + "dropIndex", + new AutomaticTuningServerOptions().withDesiredState(AutomaticTuningOptionModeDesired.ON), + "forceLastGoodPlan", + new AutomaticTuningServerOptions() + .withDesiredState(AutomaticTuningOptionModeDesired.DEFAULT))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningUpdateMin.json + */ + /** + * Sample code: Updates server automatic tuning settings with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesServerAutomaticTuningSettingsWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + new ServerAutomaticTuningInner().withDesiredState(AutomaticTuningServerMode.AUTO), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ServerAzureADAdministrators_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.AdministratorType; +import java.util.UUID; + +/** Samples for ServerAzureADAdministrators CreateOrUpdate. */ +public final class ServerAzureADAdministratorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates an existing Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAnExistingAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADAdministrators() + .define(AdministratorName.ACTIVE_DIRECTORY) + .withExistingServer("sqlcrudtest-4799", "sqlcrudtest-6440") + .withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")) + .withTenantId(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")) + .create(); + } +} +``` + +### ServerAzureADAdministrators_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ServerAzureADAdministrators Delete. */ +public final class ServerAzureADAdministratorsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorDelete.json + */ + /** + * Sample code: Delete Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADAdministrators() + .delete("sqlcrudtest-4799", "sqlcrudtest-6440", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} +``` + +### ServerAzureADAdministrators_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ServerAzureADAdministrators Get. */ +public final class ServerAzureADAdministratorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorGet.json + */ + /** + * Sample code: Gets a Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADAdministrators() + .getWithResponse("sqlcrudtest-4799", "sqlcrudtest-6440", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} +``` + +### ServerAzureADAdministrators_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerAzureADAdministrators ListByServer. */ +public final class ServerAzureADAdministratorsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorList.json + */ + /** + * Sample code: Gets a list of Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAzureADAdministrators().listByServer("sqlcrudtest-4799", "sqlcrudtest-6440", Context.NONE); + } +} +``` + +### ServerAzureADOnlyAuthentications_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ServerAzureADOnlyAuthentications CreateOrUpdate. */ +public final class ServerAzureADOnlyAuthenticationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADOnlyAuthentications() + .define(AuthenticationName.DEFAULT) + .withExistingServer("sqlcrudtest-4799", "sqlcrudtest-6440") + .withAzureADOnlyAuthentication(false) + .create(); + } +} +``` + +### ServerAzureADOnlyAuthentications_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ServerAzureADOnlyAuthentications Delete. */ +public final class ServerAzureADOnlyAuthenticationsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthDelete.json + */ + /** + * Sample code: Deletes Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADOnlyAuthentications() + .delete("sqlcrudtest-4799", "sqlcrudtest-6440", AuthenticationName.DEFAULT, Context.NONE); + } +} +``` + +### ServerAzureADOnlyAuthentications_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ServerAzureADOnlyAuthentications Get. */ +public final class ServerAzureADOnlyAuthenticationsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthGet.json + */ + /** + * Sample code: Gets a Azure Active Directory only authentication property. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAAzureActiveDirectoryOnlyAuthenticationProperty( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADOnlyAuthentications() + .getWithResponse("sqlcrudtest-4799", "sqlcrudtest-6440", AuthenticationName.DEFAULT, Context.NONE); + } +} +``` + +### ServerAzureADOnlyAuthentications_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerAzureADOnlyAuthentications ListByServer. */ +public final class ServerAzureADOnlyAuthenticationsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthList.json + */ + /** + * Sample code: Gets a list of Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAzureADOnlyAuthentications().listByServer("sqlcrudtest-4799", "sqlcrudtest-6440", Context.NONE); + } +} +``` + +### ServerBlobAuditingPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerBlobAuditingPolicy; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for ServerBlobAuditingPolicies CreateOrUpdate. */ +public final class ServerBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingCreateMin.json + */ + /** + * Sample code: Update a server's blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerBlobAuditingPolicy resource = + manager + .serverBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingCreateMax.json + */ + /** + * Sample code: Update a server's blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerBlobAuditingPolicy resource = + manager + .serverBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP", + "FAILED_DATABASE_AUTHENTICATION_GROUP", + "BATCH_COMPLETED_GROUP")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .apply(); + } +} +``` + +### ServerBlobAuditingPolicies_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerBlobAuditingPolicies Get. */ +public final class ServerBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingGet.json + */ + /** + * Sample code: Get a server's blob auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSBlobAuditingPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} +``` + +### ServerBlobAuditingPolicies_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerBlobAuditingPolicies ListByServer. */ +public final class ServerBlobAuditingPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAuditingSettingsList.json + */ + /** + * Sample code: List auditing settings of a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listAuditingSettingsOfAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverBlobAuditingPolicies() + .listByServer("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} +``` + +### ServerCommunicationLinks_CreateOrUpdate + +```java +/** Samples for ServerCommunicationLinks CreateOrUpdate. */ +public final class ServerCommunicationLinksCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkCreateOrUpdate.json + */ + /** + * Sample code: Create a server communication link. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerCommunicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverCommunicationLinks() + .define("link1") + .withExistingServer("sqlcrudtest-7398", "sqlcrudtest-4645") + .withPartnerServer("sqldcrudtest-test") + .create(); + } +} +``` + +### ServerCommunicationLinks_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ServerCommunicationLinks Delete. */ +public final class ServerCommunicationLinksDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkDelete.json + */ + /** + * Sample code: Delete a server communication link. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAServerCommunicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverCommunicationLinks() + .deleteWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "link1", Context.NONE); + } +} +``` + +### ServerCommunicationLinks_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerCommunicationLinks Get. */ +public final class ServerCommunicationLinksGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkGet.json + */ + /** + * Sample code: Get a server communication link. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerCommunicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverCommunicationLinks() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "link1", Context.NONE); + } +} +``` + +### ServerCommunicationLinks_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerCommunicationLinks ListByServer. */ +public final class ServerCommunicationLinksListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkList.json + */ + /** + * Sample code: List server communication links. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerCommunicationLinks(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverCommunicationLinks().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### ServerConnectionPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionPolicy; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionType; + +/** Samples for ServerConnectionPolicies CreateOrUpdate. */ +public final class ServerConnectionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesUpdate.json + */ + /** + * Sample code: Updates a server connection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesAServerConnectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerConnectionPolicy resource = + manager + .serverConnectionPolicies() + .getWithResponse("testrg", "testserver", ConnectionPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withConnectionType(ServerConnectionType.REDIRECT).apply(); + } +} +``` + +### ServerConnectionPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; + +/** Samples for ServerConnectionPolicies Get. */ +public final class ServerConnectionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesGet.json + */ + /** + * Sample code: Gets a server connection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAServerConnectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverConnectionPolicies() + .getWithResponse("rgtest-12", "servertest-6285", ConnectionPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### ServerConnectionPolicies_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerConnectionPolicies ListByServer. */ +public final class ServerConnectionPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesList.json + */ + /** + * Sample code: Lists a servers connection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void listsAServersConnectionPolicies(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverConnectionPolicies().listByServer("rgtest-12", "servertest-6285", Context.NONE); + } +} +``` + +### ServerDevOpsAuditSettings_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerDevOpsAuditingSettings; +import java.util.UUID; + +/** Samples for ServerDevOpsAuditSettings CreateOrUpdate. */ +public final class ServerDevOpsAuditSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDevOpsAuditCreateMin.json + */ + /** + * Sample code: Update a server's DevOps audit settings with minimal input. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSDevOpsAuditSettingsWithMinimalInput( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerDevOpsAuditingSettings resource = + manager + .serverDevOpsAuditSettings() + .getWithResponse("devAuditTestRG", "devOpsAuditTestSvr", "default", Context.NONE) + .getValue(); + resource + .update() + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDevOpsAuditCreateMax.json + */ + /** + * Sample code: Update a server's DevOps audit settings with all params. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSDevOpsAuditSettingsWithAllParams( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerDevOpsAuditingSettings resource = + manager + .serverDevOpsAuditSettings() + .getWithResponse("devAuditTestRG", "devOpsAuditTestSvr", "default", Context.NONE) + .getValue(); + resource + .update() + .withIsAzureMonitorTargetEnabled(true) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .apply(); + } +} +``` + +### ServerDevOpsAuditSettings_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerDevOpsAuditSettings Get. */ +public final class ServerDevOpsAuditSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDevOpsAuditGet.json + */ + /** + * Sample code: Get a server's DevOps audit settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSDevOpsAuditSettings(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverDevOpsAuditSettings() + .getWithResponse("devAuditTestRG", "devOpsAuditTestSvr", "default", Context.NONE); + } +} +``` + +### ServerDevOpsAuditSettings_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerDevOpsAuditSettings ListByServer. */ +public final class ServerDevOpsAuditSettingsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDevOpsAuditSettingsList.json + */ + /** + * Sample code: List DevOps audit settings of a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listDevOpsAuditSettingsOfAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDevOpsAuditSettings().listByServer("devAuditTestRG", "devOpsAuditTestSvr", Context.NONE); + } +} +``` + +### ServerDnsAliases_Acquire + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliasAcquisition; + +/** Samples for ServerDnsAliases Acquire. */ +public final class ServerDnsAliasesAcquireSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasAcquire.json + */ + /** + * Sample code: Acquire server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void acquireServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverDnsAliases() + .acquire( + "Default", + "dns-alias-new-server", + "dns-alias-name-1", + new ServerDnsAliasAcquisition() + .withOldServerDnsAliasId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-old-server/dnsAliases/dns-alias-name-1"), + Context.NONE); + } +} +``` + +### ServerDnsAliases_CreateOrUpdate + +```java +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases CreateOrUpdate. */ +public final class ServerDnsAliasesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasCreateOrUpdate.json + */ + /** + * Sample code: Create server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void createServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().createOrUpdate("Default", "dns-alias-server", "dns-alias-name-1", Context.NONE); + } +} +``` + +### ServerDnsAliases_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases Delete. */ +public final class ServerDnsAliasesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasDelete.json + */ + /** + * Sample code: Delete server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().delete("Default", "dns-alias-server", "dns-alias-name-1", Context.NONE); + } +} +``` + +### ServerDnsAliases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases Get. */ +public final class ServerDnsAliasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasGet.json + */ + /** + * Sample code: Get server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().getWithResponse("Default", "dns-alias-server", "dns-alias-name-1", Context.NONE); + } +} +``` + +### ServerDnsAliases_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases ListByServer. */ +public final class ServerDnsAliasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasList.json + */ + /** + * Sample code: List server DNS aliases. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerDNSAliases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().listByServer("Default", "dns-alias-server", Context.NONE); + } +} +``` + +### ServerKeys_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +/** Samples for ServerKeys CreateOrUpdate. */ +public final class ServerKeysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates a server key. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAServerKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverKeys() + .define("someVault_someKey_01234567890123456789012345678901") + .withExistingServer("sqlcrudtest-7398", "sqlcrudtest-4645") + .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) + .withUri("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901") + .create(); + } +} +``` + +### ServerKeys_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ServerKeys Delete. */ +public final class ServerKeysDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyDelete.json + */ + /** + * Sample code: Delete the server key. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheServerKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverKeys() + .delete( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} +``` + +### ServerKeys_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerKeys Get. */ +public final class ServerKeysGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyGet.json + */ + /** + * Sample code: Get the server key. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheServerKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverKeys() + .getWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} +``` + +### ServerKeys_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerKeys ListByServer. */ +public final class ServerKeysListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyList.json + */ + /** + * Sample code: List the server keys by server. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheServerKeysByServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverKeys().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### ServerOperations_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerOperations ListByServer. */ +public final class ServerOperationsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListServerOperations.json + */ + /** + * Sample code: List the server management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheServerManagementOperations(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverOperations().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### ServerSecurityAlertPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicy; +import java.util.Arrays; + +/** Samples for ServerSecurityAlertPolicies CreateOrUpdate. */ +public final class ServerSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsCreateMin.json + */ + /** + * Sample code: Update a server's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerSecurityAlertPolicy resource = + manager + .serverSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertsPolicyState.ENABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsCreateMax.json + */ + /** + * Sample code: Update a server's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerSecurityAlertPolicy resource = + manager + .serverSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertsPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Access_Anomaly", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("testSecurityAlert@microsoft.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(5) + .apply(); + } +} +``` + +### ServerSecurityAlertPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for ServerSecurityAlertPolicies Get. */ +public final class ServerSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsGet.json + */ + /** + * Sample code: Get a server's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSThreatDetectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### ServerSecurityAlertPolicies_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerSecurityAlertPolicies ListByServer. */ +public final class ServerSecurityAlertPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsListByServer.json + */ + /** + * Sample code: List the server's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheServerSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverSecurityAlertPolicies().listByServer("securityalert-4799", "securityalert-6440", Context.NONE); + } +} +``` + +### ServerTrustCertificates_CreateOrUpdate + +```java +/** Samples for ServerTrustCertificates CreateOrUpdate. */ +public final class ServerTrustCertificatesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesCreate.json + */ + /** + * Sample code: Create server trust certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void createServerTrustCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverTrustCertificates() + .define("customerCertificateName") + .withExistingManagedInstance("testrg", "testcl") + .withPublicBlob("308203AE30820296A0030201020210") + .create(); + } +} +``` + +### ServerTrustCertificates_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ServerTrustCertificates Delete. */ +public final class ServerTrustCertificatesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesDelete.json + */ + /** + * Sample code: Delete server trust certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteServerTrustCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustCertificates().delete("testrg", "testcl", "customerCertificateName", Context.NONE); + } +} +``` + +### ServerTrustCertificates_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerTrustCertificates Get. */ +public final class ServerTrustCertificatesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesGet.json + */ + /** + * Sample code: Gets server trust certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void getsServerTrustCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustCertificates().getWithResponse("testrg", "testcl", "customerCertificateName", Context.NONE); + } +} +``` + +### ServerTrustCertificates_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ServerTrustCertificates ListByInstance. */ +public final class ServerTrustCertificatesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesListByInstance.json + */ + /** + * Sample code: Gets a list of server trust certificates on a given server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfServerTrustCertificatesOnAGivenServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustCertificates().listByInstance("testrg", "testcl", Context.NONE); + } +} +``` + +### ServerTrustGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ServerInfo; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroupPropertiesTrustScopesItem; +import java.util.Arrays; + +/** Samples for ServerTrustGroups CreateOrUpdate. */ +public final class ServerTrustGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupCreate.json + */ + /** + * Sample code: Create server trust group. + * + * @param manager Entry point to SqlManager. + */ + public static void createServerTrustGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverTrustGroups() + .define("server-trust-group-test") + .withExistingLocation("Default", "Japan East") + .withGroupMembers( + Arrays + .asList( + new ServerInfo() + .withServerId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-1"), + new ServerInfo() + .withServerId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-2"))) + .withTrustScopes( + Arrays + .asList( + ServerTrustGroupPropertiesTrustScopesItem.GLOBAL_TRANSACTIONS, + ServerTrustGroupPropertiesTrustScopesItem.SERVICE_BROKER)) + .create(); + } +} +``` + +### ServerTrustGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups Delete. */ +public final class ServerTrustGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupDelete.json + */ + /** + * Sample code: Drop server trust group. + * + * @param manager Entry point to SqlManager. + */ + public static void dropServerTrustGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().delete("Default", "Japan East", "server-trust-group-test", Context.NONE); + } +} +``` + +### ServerTrustGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups Get. */ +public final class ServerTrustGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupGet.json + */ + /** + * Sample code: Get server trust group. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerTrustGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().getWithResponse("Default", "Japan East", "server-trust-group-test", Context.NONE); + } +} +``` + +### ServerTrustGroups_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups ListByInstance. */ +public final class ServerTrustGroupsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupListByManagedInstance.json + */ + /** + * Sample code: List server trust groups by managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerTrustGroupsByManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().listByInstance("Default-SQL-SouthEastAsia", "managedInstance-1", Context.NONE); + } +} +``` + +### ServerTrustGroups_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups ListByLocation. */ +public final class ServerTrustGroupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupList.json + */ + /** + * Sample code: List server trust groups. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerTrustGroups(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().listByLocation("Default", "Japan East", Context.NONE); + } +} +``` + +### ServerUsages_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerUsages ListByServer. */ +public final class ServerUsagesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ServerUsageMetricsList.json + */ + /** + * Sample code: List servers usages. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersUsages(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverUsages().listByServer("sqlcrudtest-6730", "sqlcrudtest-9007", Context.NONE); + } +} +``` + +### ServerVulnerabilityAssessments_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for ServerVulnerabilityAssessments CreateOrUpdate. */ +public final class ServerVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a server's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateStorageAccessKeyMin.json + */ + /** + * Sample code: Create a server's vulnerability assessment with minimal parameters, when storageAccountAccessKey is + * specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerSVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateContainerSasKeyMin.json + */ + /** + * Sample code: Create a server's vulnerability assessment with minimal parameters, when storageContainerSasKey is + * specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerSVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } +} +``` + +### ServerVulnerabilityAssessments_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ServerVulnerabilityAssessments Delete. */ +public final class ServerVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a server's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeAServerSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### ServerVulnerabilityAssessments_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ServerVulnerabilityAssessments Get. */ +public final class ServerVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a server's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSVulnerabilityAssessment(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### ServerVulnerabilityAssessments_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerVulnerabilityAssessments ListByServer. */ +public final class ServerVulnerabilityAssessmentsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentListByServer.json + */ + /** + * Sample code: Get a server's vulnerability assessment policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSVulnerabilityAssessmentPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .listByServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", Context.NONE); + } +} +``` + +### Servers_CheckNameAvailability + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityRequest; + +/** Samples for Servers CheckNameAvailability. */ +public final class ServersCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerAvailable.json + */ + /** + * Sample code: Check for a server name that is available. + * + * @param manager Entry point to SqlManager. + */ + public static void checkForAServerNameThatIsAvailable(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("server1"), Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerAlreadyExists.json + */ + /** + * Sample code: Check for a server name that already exists. + * + * @param manager Entry point to SqlManager. + */ + public static void checkForAServerNameThatAlreadyExists( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("server1"), Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerInvalid.json + */ + /** + * Sample code: Check for a server name that is invalid. + * + * @param manager Entry point to SqlManager. + */ + public static void checkForAServerNameThatIsInvalid(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("SERVER1"), Context.NONE); + } +} +``` + +### Servers_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.PrincipalType; +import com.azure.resourcemanager.sql.generated.models.ServerExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ServerNetworkAccessFlag; +import java.util.UUID; + +/** Samples for Servers CreateOrUpdate. */ +public final class ServersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerCreate.json + */ + /** + * Sample code: Create server. + * + * @param manager Entry point to SqlManager. + */ + public static void createServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .define("sqlcrudtest-4645") + .withRegion("Japan East") + .withExistingResourceGroup("sqlcrudtest-7398") + .withAdministratorLogin("dummylogin") + .withAdministratorLoginPassword("PLACEHOLDER") + .withPublicNetworkAccess(ServerNetworkAccessFlag.ENABLED) + .withAdministrators( + new ServerExternalAdministrator() + .withPrincipalType(PrincipalType.USER) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withTenantId(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withAzureADOnlyAuthentication(true)) + .withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag.ENABLED) + .create(); + } +} +``` + +### Servers_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Servers Delete. */ +public final class ServersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerDelete.json + */ + /** + * Sample code: Delete server. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().delete("sqlcrudtest-7398", "sqlcrudtest-6661", Context.NONE); + } +} +``` + +### Servers_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Servers GetByResourceGroup. */ +public final class ServersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerGetWithExpandEqualsAdministrators.json + */ + /** + * Sample code: Get server with $expand=administrators. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerWithExpandAdministrators(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().getByResourceGroupWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerGet.json + */ + /** + * Sample code: Get server. + * + * @param manager Entry point to SqlManager. + */ + public static void getServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().getByResourceGroupWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE); + } +} +``` + +### Servers_ImportDatabase + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ImportNewDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.NetworkIsolationSettings; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for Servers ImportDatabase. */ +public final class ServersImportDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ImportNewDatabaseWithNetworkIsolation.json + */ + /** + * Sample code: Imports to a new database, using private link for the SQL server and storage account. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToANewDatabaseUsingPrivateLinkForTheSQLServerAndStorageAccount( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .importDatabase( + "Default-SQL-SouthEastAsia", + "testsvr", + new ImportNewDatabaseDefinition() + .withDatabaseName("testdb") + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey( + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("password") + .withAuthenticationType("Sql") + .withNetworkIsolation( + new NetworkIsolationSettings() + .withStorageAccountResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink") + .withSqlServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ImportNewDatabase.json + */ + /** + * Sample code: Imports to a new database. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToANewDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .importDatabase( + "Default-SQL-SouthEastAsia", + "testsvr", + new ImportNewDatabaseDefinition() + .withDatabaseName("testdb") + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey( + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("password") + .withAuthenticationType("Sql"), + Context.NONE); + } +} +``` + +### Servers_List + +```java +import com.azure.core.util.Context; + +/** Samples for Servers List. */ +public final class ServersListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerList.json + */ + /** + * Sample code: List servers. + * + * @param manager Entry point to SqlManager. + */ + public static void listServers(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().list(null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List servers with expand equals administrators. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersWithExpandEqualsAdministrators( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().list(null, Context.NONE); + } +} +``` + +### Servers_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Servers ListByResourceGroup. */ +public final class ServersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListByResourceGroup.json + */ + /** + * Sample code: List servers by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().listByResourceGroup("sqlcrudtest-7398", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListByResourceGroupWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List servers by resource group with $expand=administrators. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersByResourceGroupWithExpandAdministrators( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().listByResourceGroup("sqlcrudtest-7398", null, Context.NONE); + } +} +``` + +### Servers_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.Server; +import com.azure.resourcemanager.sql.generated.models.ServerNetworkAccessFlag; + +/** Samples for Servers Update. */ +public final class ServersUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerUpdate.json + */ + /** + * Sample code: Update a server. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + Server resource = + manager + .servers() + .getByResourceGroupWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE) + .getValue(); + resource + .update() + .withAdministratorLoginPassword("placeholder") + .withPublicNetworkAccess(ServerNetworkAccessFlag.DISABLED) + .withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag.ENABLED) + .apply(); + } +} +``` + +### ServiceObjectives_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServiceObjectives Get. */ +public final class ServiceObjectivesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveGet.json + */ + /** + * Sample code: Get a service objective. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServiceObjective(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serviceObjectives() + .getWithResponse("group1", "sqlcrudtest", "29dd7459-4a7c-4e56-be22-f0adda49440d", Context.NONE); + } +} +``` + +### ServiceObjectives_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServiceObjectives ListByServer. */ +public final class ServiceObjectivesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveList.json + */ + /** + * Sample code: List service objectives. + * + * @param manager Entry point to SqlManager. + */ + public static void listServiceObjectives(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serviceObjectives().listByServer("group1", "sqlcrudtest", Context.NONE); + } +} +``` + +### SqlAgent_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner; +import com.azure.resourcemanager.sql.generated.models.SqlAgentConfigurationPropertiesState; + +/** Samples for SqlAgent CreateOrUpdate. */ +public final class SqlAgentCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlAgentConfigurationPut.json + */ + /** + * Sample code: Puts new sql agent configuration to instance. + * + * @param manager Entry point to SqlManager. + */ + public static void putsNewSqlAgentConfigurationToInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlAgents() + .createOrUpdateWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + new SqlAgentConfigurationInner().withState(SqlAgentConfigurationPropertiesState.ENABLED), + Context.NONE); + } +} +``` + +### SqlAgent_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SqlAgent Get. */ +public final class SqlAgentGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlAgentConfigurationGet.json + */ + /** + * Sample code: Gets current instance sql agent configuration. + * + * @param manager Entry point to SqlManager. + */ + public static void getsCurrentInstanceSqlAgentConfiguration( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.sqlAgents().getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### SubscriptionUsages_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SubscriptionUsages Get. */ +public final class SubscriptionUsagesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SubscriptionUsageGet.json + */ + /** + * Sample code: Get specific subscription usage in the given location. + * + * @param manager Entry point to SqlManager. + */ + public static void getSpecificSubscriptionUsageInTheGivenLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.subscriptionUsages().getWithResponse("WestUS", "ServerQuota", Context.NONE); + } +} +``` + +### SubscriptionUsages_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for SubscriptionUsages ListByLocation. */ +public final class SubscriptionUsagesListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SubscriptionUsageListByLocation.json + */ + /** + * Sample code: List subscription usages in the given location. + * + * @param manager Entry point to SqlManager. + */ + public static void listSubscriptionUsagesInTheGivenLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.subscriptionUsages().listByLocation("WestUS", Context.NONE); + } +} +``` + +### SyncAgents_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncAgent; + +/** Samples for SyncAgents CreateOrUpdate. */ +public final class SyncAgentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentCreate.json + */ + /** + * Sample code: Create a new sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void createANewSyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .define("syncagentcrud-3187") + .withExistingServer("syncagentcrud-65440", "syncagentcrud-8475") + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/databases/sync") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentUpdate.json + */ + /** + * Sample code: Update a sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + SyncAgent resource = + manager + .syncAgents() + .getWithResponse("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE) + .getValue(); + resource + .update() + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/databases/sync") + .apply(); + } +} +``` + +### SyncAgents_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for SyncAgents Delete. */ +public final class SyncAgentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentDelete.json + */ + /** + * Sample code: Delete a sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteASyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.syncAgents().delete("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} +``` + +### SyncAgents_GenerateKey + +```java +import com.azure.core.util.Context; + +/** Samples for SyncAgents GenerateKey. */ +public final class SyncAgentsGenerateKeySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGenerateKey.json + */ + /** + * Sample code: Generate a sync agent key. + * + * @param manager Entry point to SqlManager. + */ + public static void generateASyncAgentKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .generateKeyWithResponse("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} +``` + +### SyncAgents_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SyncAgents Get. */ +public final class SyncAgentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGet.json + */ + /** + * Sample code: Get a sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .getWithResponse("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} +``` + +### SyncAgents_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for SyncAgents ListByServer. */ +public final class SyncAgentsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentListByServer.json + */ + /** + * Sample code: Get sync agents under a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getSyncAgentsUnderAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.syncAgents().listByServer("syncagentcrud-65440", "syncagentcrud-8475", Context.NONE); + } +} +``` + +### SyncAgents_ListLinkedDatabases + +```java +import com.azure.core.util.Context; + +/** Samples for SyncAgents ListLinkedDatabases. */ +public final class SyncAgentsListLinkedDatabasesSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGetLinkedDatabases.json + */ + /** + * Sample code: Get sync agent linked databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getSyncAgentLinkedDatabases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .listLinkedDatabases("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} +``` + +### SyncGroups_CancelSync + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups CancelSync. */ +public final class SyncGroupsCancelSyncSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupCancelSync.json + */ + /** + * Sample code: Cancel a sync group synchronization. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelASyncGroupSynchronization(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .cancelSyncWithResponse( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} +``` + +### SyncGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.SyncConflictResolutionPolicy; + +/** Samples for SyncGroups CreateOrUpdate. */ +public final class SyncGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupUpdate.json + */ + /** + * Sample code: Update a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .define("syncgroupcrud-3187") + .withExistingDatabase("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328") + .withInterval(-1) + .withConflictResolutionPolicy(SyncConflictResolutionPolicy.HUB_WIN) + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withHubDatabaseUsername("hubUser") + .withUsePrivateLinkConnection(true) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupCreate.json + */ + /** + * Sample code: Create a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void createASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .define("syncgroupcrud-3187") + .withExistingDatabase("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328") + .withInterval(-1) + .withConflictResolutionPolicy(SyncConflictResolutionPolicy.HUB_WIN) + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withHubDatabaseUsername("hubUser") + .withUsePrivateLinkConnection(true) + .create(); + } +} +``` + +### SyncGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups Delete. */ +public final class SyncGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupDelete.json + */ + /** + * Sample code: Delete a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .delete( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} +``` + +### SyncGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups Get. */ +public final class SyncGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGet.json + */ + /** + * Sample code: Get a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .getWithResponse( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} +``` + +### SyncGroups_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups ListByDatabase. */ +public final class SyncGroupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupListByDatabase.json + */ + /** + * Sample code: List sync groups under a given database. + * + * @param manager Entry point to SqlManager. + */ + public static void listSyncGroupsUnderAGivenDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .listByDatabase("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", Context.NONE); + } +} +``` + +### SyncGroups_ListHubSchemas + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups ListHubSchemas. */ +public final class SyncGroupsListHubSchemasSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetHubSchema.json + */ + /** + * Sample code: Get a hub database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getAHubDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .listHubSchemas( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} +``` + +### SyncGroups_ListLogs + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncGroupsType; + +/** Samples for SyncGroups ListLogs. */ +public final class SyncGroupsListLogsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetLog.json + */ + /** + * Sample code: Get sync group logs. + * + * @param manager Entry point to SqlManager. + */ + public static void getSyncGroupLogs(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .listLogs( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "2017-01-01T00:00:00", + "2017-12-31T00:00:00", + SyncGroupsType.ALL, + null, + Context.NONE); + } +} +``` + +### SyncGroups_ListSyncDatabaseIds + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups ListSyncDatabaseIds. */ +public final class SyncGroupsListSyncDatabaseIdsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetSyncDatabaseId.json + */ + /** + * Sample code: Get a sync database ID. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncDatabaseID(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.syncGroups().listSyncDatabaseIds("westus", Context.NONE); + } +} +``` + +### SyncGroups_RefreshHubSchema + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups RefreshHubSchema. */ +public final class SyncGroupsRefreshHubSchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupRefreshHubSchema.json + */ + /** + * Sample code: Refresh a hub database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void refreshAHubDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .refreshHubSchema( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} +``` + +### SyncGroups_TriggerSync + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups TriggerSync. */ +public final class SyncGroupsTriggerSyncSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupTriggerSync.json + */ + /** + * Sample code: Trigger a sync group synchronization. + * + * @param manager Entry point to SqlManager. + */ + public static void triggerASyncGroupSynchronization(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .triggerSyncWithResponse( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} +``` + +### SyncGroups_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncConflictResolutionPolicy; +import com.azure.resourcemanager.sql.generated.models.SyncGroup; + +/** Samples for SyncGroups Update. */ +public final class SyncGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupPatch.json + */ + /** + * Sample code: Update a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + SyncGroup resource = + manager + .syncGroups() + .getWithResponse( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + Context.NONE) + .getValue(); + resource + .update() + .withInterval(-1) + .withConflictResolutionPolicy(SyncConflictResolutionPolicy.HUB_WIN) + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withHubDatabaseUsername("hubUser") + .withHubDatabasePassword("hubPassword") + .withUsePrivateLinkConnection(true) + .apply(); + } +} +``` + +### SyncMembers_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.SyncDirection; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; + +/** Samples for SyncMembers CreateOrUpdate. */ +public final class SyncMembersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberCreate.json + */ + /** + * Sample code: Create a new sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void createANewSyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .define("syncmembercrud-4879") + .withExistingSyncGroup( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187") + .withDatabaseType(SyncMemberDbType.AZURE_SQL_DATABASE) + .withSyncMemberAzureDatabaseResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withUsePrivateLinkConnection(true) + .withServerName("syncgroupcrud-3379.database.windows.net") + .withDatabaseName("syncgroupcrud-7421") + .withUsername("myUser") + .withSyncDirection(SyncDirection.BIDIRECTIONAL) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberUpdate.json + */ + /** + * Sample code: Update a sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .define("syncmembercrud-4879") + .withExistingSyncGroup( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187") + .withDatabaseType(SyncMemberDbType.AZURE_SQL_DATABASE) + .withSyncMemberAzureDatabaseResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withUsePrivateLinkConnection(true) + .withServerName("syncgroupcrud-3379.database.windows.net") + .withDatabaseName("syncgroupcrud-7421") + .withUsername("myUser") + .withSyncDirection(SyncDirection.BIDIRECTIONAL) + .create(); + } +} +``` + +### SyncMembers_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for SyncMembers Delete. */ +public final class SyncMembersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberDelete.json + */ + /** + * Sample code: Delete a sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteASyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .delete( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncgroupcrud-4879", + Context.NONE); + } +} +``` + +### SyncMembers_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SyncMembers Get. */ +public final class SyncMembersGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberGet.json + */ + /** + * Sample code: Get a sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .getWithResponse( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncmembercrud-4879", + Context.NONE); + } +} +``` + +### SyncMembers_ListBySyncGroup + +```java +import com.azure.core.util.Context; + +/** Samples for SyncMembers ListBySyncGroup. */ +public final class SyncMembersListBySyncGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberListBySyncGroup.json + */ + /** + * Sample code: List sync members under a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void listSyncMembersUnderASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .listBySyncGroup( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} +``` + +### SyncMembers_ListMemberSchemas + +```java +import com.azure.core.util.Context; + +/** Samples for SyncMembers ListMemberSchemas. */ +public final class SyncMembersListMemberSchemasSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberGetSchema.json + */ + /** + * Sample code: Get a sync member schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncMemberSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .listMemberSchemas( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncgroupcrud-4879", + Context.NONE); + } +} +``` + +### SyncMembers_RefreshMemberSchema + +```java +import com.azure.core.util.Context; + +/** Samples for SyncMembers RefreshMemberSchema. */ +public final class SyncMembersRefreshMemberSchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberRefreshSchema.json + */ + /** + * Sample code: Refresh a sync member database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void refreshASyncMemberDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .refreshMemberSchema( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncgroupcrud-4879", + Context.NONE); + } +} +``` + +### SyncMembers_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncDirection; +import com.azure.resourcemanager.sql.generated.models.SyncMember; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; + +/** Samples for SyncMembers Update. */ +public final class SyncMembersUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberPatch.json + */ + /** + * Sample code: Update an existing sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnExistingSyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + SyncMember resource = + manager + .syncMembers() + .getWithResponse( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncmembercrud-4879", + Context.NONE) + .getValue(); + resource + .update() + .withDatabaseType(SyncMemberDbType.AZURE_SQL_DATABASE) + .withSyncMemberAzureDatabaseResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withUsePrivateLinkConnection(true) + .withServerName("syncgroupcrud-3379.database.windows.net") + .withDatabaseName("syncgroupcrud-7421") + .withUsername("myUser") + .withSyncDirection(SyncDirection.BIDIRECTIONAL) + .apply(); + } +} +``` + +### TdeCertificates_Create + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; + +/** Samples for TdeCertificates Create. */ +public final class TdeCertificatesCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlTdeCertificateCreate.json + */ + /** + * Sample code: Upload a TDE certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void uploadATDECertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .tdeCertificates() + .create("testtdecert", "testtdecert", new TdeCertificate().withPrivateBlob("MIIXXXXXXXX"), Context.NONE); + } +} +``` + +### TimeZones_Get + +```java +import com.azure.core.util.Context; + +/** Samples for TimeZones Get. */ +public final class TimeZonesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTimeZoneGet.json + */ + /** + * Sample code: Get managed instance time zone. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedInstanceTimeZone(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.timeZones().getWithResponse("canadaeast", "Haiti Standard Time", Context.NONE); + } +} +``` + +### TimeZones_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for TimeZones ListByLocation. */ +public final class TimeZonesListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTimeZoneListByLocation.json + */ + /** + * Sample code: List managed instance time zones by location. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstanceTimeZonesByLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.timeZones().listByLocation("canadaeast", Context.NONE); + } +} +``` + +### TransparentDataEncryptions_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LogicalDatabaseTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; + +/** Samples for TransparentDataEncryptions CreateOrUpdate. */ +public final class TransparentDataEncryptionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionUpdate.json + */ + /** + * Sample code: Update a database's Transparent Data Encryption state with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSTransparentDataEncryptionStateWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + LogicalDatabaseTransparentDataEncryption resource = + manager + .transparentDataEncryptions() + .getWithResponse( + "securitytde-42-rg", + "securitytde-42", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE) + .getValue(); + resource.update().withState(TransparentDataEncryptionState.ENABLED).apply(); + } +} +``` + +### TransparentDataEncryptions_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +/** Samples for TransparentDataEncryptions Get. */ +public final class TransparentDataEncryptionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionGet.json + */ + /** + * Sample code: Get a database's transparent data encryption. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSTransparentDataEncryption( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .transparentDataEncryptions() + .getWithResponse( + "security-tde-resourcegroup", + "securitytde", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE); + } +} +``` + +### TransparentDataEncryptions_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for TransparentDataEncryptions ListByDatabase. */ +public final class TransparentDataEncryptionsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionList.json + */ + /** + * Sample code: Get a list of the database's transparent data encryption. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfTheDatabaseSTransparentDataEncryption( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .transparentDataEncryptions() + .listByDatabase("security-tde-resourcegroup", "securitytde", "testdb", Context.NONE); + } +} +``` + +### Usages_ListByInstancePool + +```java +import com.azure.core.util.Context; + +/** Samples for Usages ListByInstancePool. */ +public final class UsagesListByInstancePoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsage.json + */ + /** + * Sample code: List instance pool usages. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolUsages(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.usages().listByInstancePool("group1", "testIP", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsageExpanded.json + */ + /** + * Sample code: List instance pool usages expanded with children. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolUsagesExpandedWithChildren( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.usages().listByInstancePool("group1", "testIP", true, Context.NONE); + } +} +``` + +### VirtualClusters_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualClusters Delete. */ +public final class VirtualClustersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterDelete.json + */ + /** + * Sample code: Delete virtual cluster. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteVirtualCluster(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualClusters().delete("testrg", "vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", Context.NONE); + } +} +``` + +### VirtualClusters_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualClusters GetByResourceGroup. */ +public final class VirtualClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterGet.json + */ + /** + * Sample code: Get virtual cluster. + * + * @param manager Entry point to SqlManager. + */ + public static void getVirtualCluster(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .virtualClusters() + .getByResourceGroupWithResponse("testrg", "vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", Context.NONE); + } +} +``` + +### VirtualClusters_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualClusters List. */ +public final class VirtualClustersListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterList.json + */ + /** + * Sample code: List virtualClusters. + * + * @param manager Entry point to SqlManager. + */ + public static void listVirtualClusters(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualClusters().list(Context.NONE); + } +} +``` + +### VirtualClusters_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualClusters ListByResourceGroup. */ +public final class VirtualClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterListByResourceGroup.json + */ + /** + * Sample code: List virtual clusters by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listVirtualClustersByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualClusters().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### VirtualClusters_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VirtualClusterUpdate; + +/** Samples for VirtualClusters Update. */ +public final class VirtualClustersUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterUpdate.json + */ + /** + * Sample code: Update virtual cluster with tags. + * + * @param manager Entry point to SqlManager. + */ + public static void updateVirtualClusterWithTags(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .virtualClusters() + .update( + "testrg", + "vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", + new VirtualClusterUpdate() + .withMaintenanceConfigurationId( + "/subscriptions/ab0e51c0-83c0-4380-8ae9-025516df392f/resourceGroups/Federation/providers/Microsoft.Maintenance/maintenanceConfigurations/MiPolicy1"), + Context.NONE); + } +} +``` + +### VirtualClusters_UpdateDnsServers + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualClusters UpdateDnsServers. */ +public final class VirtualClustersUpdateDnsServersSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedInstanceDnsServers.json + */ + /** + * Sample code: Synchronizes the DNS server settings used by the managed instances inside the given virtual cluster. + * + * @param manager Entry point to SqlManager. + */ + public static void synchronizesTheDNSServerSettingsUsedByTheManagedInstancesInsideTheGivenVirtualCluster( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualClusters().updateDnsServersWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### VirtualNetworkRules_CreateOrUpdate + +```java +/** Samples for VirtualNetworkRules CreateOrUpdate. */ +public final class VirtualNetworkRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesCreateOrUpdate.json + */ + /** + * Sample code: Create or update a virtual network rule. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAVirtualNetworkRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .virtualNetworkRules() + .define("vnet-firewall-rule") + .withExistingServer("Default", "vnet-test-svr") + .withVirtualNetworkSubnetId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet") + .withIgnoreMissingVnetServiceEndpoint(false) + .create(); + } +} +``` + +### VirtualNetworkRules_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules Delete. */ +public final class VirtualNetworkRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesDelete.json + */ + /** + * Sample code: Delete a virtual network rule. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAVirtualNetworkRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualNetworkRules().delete("Default", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + } +} +``` + +### VirtualNetworkRules_Get + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules Get. */ +public final class VirtualNetworkRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesGet.json + */ + /** + * Sample code: Gets a virtual network rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAVirtualNetworkRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualNetworkRules().getWithResponse("Default", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + } +} +``` + +### VirtualNetworkRules_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules ListByServer. */ +public final class VirtualNetworkRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesList.json + */ + /** + * Sample code: List virtual network rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listVirtualNetworkRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualNetworkRules().listByServer("Default", "vnet-test-svr", Context.NONE); + } +} +``` + +### WorkloadClassifiers_CreateOrUpdate + +```java +/** Samples for WorkloadClassifiers CreateOrUpdate. */ +public final class WorkloadClassifiersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadClassifierMin.json + */ + /** + * Sample code: Create a workload group with the required properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithTheRequiredPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .define("wlm_workloadclassifier") + .withExistingWorkloadGroup("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup") + .withMemberName("dbo") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadClassifierMax.json + */ + /** + * Sample code: Create a workload group with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .define("wlm_workloadclassifier") + .withExistingWorkloadGroup("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup") + .withMemberName("dbo") + .withLabel("test_label") + .withContext("test_context") + .withStartTime("12:00") + .withEndTime("14:00") + .withImportance("high") + .create(); + } +} +``` + +### WorkloadClassifiers_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for WorkloadClassifiers Delete. */ +public final class WorkloadClassifiersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteWorkloadClassifier.json + */ + /** + * Sample code: Delete a workload classifier. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAWorkloadClassifier(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .delete( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + "wlm_workloadgroup", + "wlm_workloadclassifier", + Context.NONE); + } +} +``` + +### WorkloadClassifiers_Get + +```java +import com.azure.core.util.Context; + +/** Samples for WorkloadClassifiers Get. */ +public final class WorkloadClassifiersGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadClassifier.json + */ + /** + * Sample code: Gets a workload classifier for a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAWorkloadClassifierForADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", "wlm_classifier", Context.NONE); + } +} +``` + +### WorkloadClassifiers_ListByWorkloadGroup + +```java +import com.azure.core.util.Context; + +/** Samples for WorkloadClassifiers ListByWorkloadGroup. */ +public final class WorkloadClassifiersListByWorkloadGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadClassifierList.json + */ + /** + * Sample code: Get the list of workload classifiers for a workload group. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheListOfWorkloadClassifiersForAWorkloadGroup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .listByWorkloadGroup("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", Context.NONE); + } +} +``` + +### WorkloadGroups_CreateOrUpdate + +```java +/** Samples for WorkloadGroups CreateOrUpdate. */ +public final class WorkloadGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadGroupMin.json + */ + /** + * Sample code: Create a workload group with the required properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithTheRequiredPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .define("smallrc") + .withExistingDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb") + .withMinResourcePercent(0) + .withMaxResourcePercent(100) + .withMinResourcePercentPerRequest(3.0) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadGroupMax.json + */ + /** + * Sample code: Create a workload group with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .define("smallrc") + .withExistingDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb") + .withMinResourcePercent(0) + .withMaxResourcePercent(100) + .withMinResourcePercentPerRequest(3.0) + .withMaxResourcePercentPerRequest(3.0) + .withImportance("normal") + .withQueryExecutionTimeout(0) + .create(); + } +} +``` + +### WorkloadGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for WorkloadGroups Delete. */ +public final class WorkloadGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteWorkloadGroup.json + */ + /** + * Sample code: Delete a workload group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAWorkloadGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .delete("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", Context.NONE); + } +} +``` + +### WorkloadGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for WorkloadGroups Get. */ +public final class WorkloadGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadGroup.json + */ + /** + * Sample code: Gets a workload group for a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAWorkloadGroupForADataWarehouse(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", "smallrc", Context.NONE); + } +} +``` + +### WorkloadGroups_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for WorkloadGroups ListByDatabase. */ +public final class WorkloadGroupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadGroupList.json + */ + /** + * Sample code: Get the list of workload groups for a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheListOfWorkloadGroupsForADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.workloadGroups().listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} +``` + 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..2833a6dd7a9b5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/pom.xml @@ -0,0 +1,55 @@ + + 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-v5. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.27.0 + + + com.azure + azure-core-management + 1.5.4 + + + 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..2b68f7f0b254c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/SqlManager.java @@ -0,0 +1,1816 @@ +// Copyright (c) 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.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +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.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.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.DataWarehouseUserActivitiesOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseAdvisorsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseAutomaticTuningsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseBlobAuditingPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseColumnsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseExtensionsOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseRecommendedActionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseSchemasImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseSecurityAlertPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseTablesImpl; +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.DeletedServersImpl; +import com.azure.resourcemanager.sql.generated.implementation.DistributedAvailabilityGroupsImpl; +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.EndpointCertificatesImpl; +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.IPv6FirewallRulesImpl; +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.LedgerDigestUploadsOperationsImpl; +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.MaintenanceWindowOptionsOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.MaintenanceWindowsOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedBackupShortTermRetentionPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseColumnsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseQueriesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseRecommendedSensitivityLabelsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseRestoreDetailsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseSchemasImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseSecurityAlertPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseSecurityEventsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseSensitivityLabelsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseTablesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseTransparentDataEncryptionsImpl; +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.ManagedInstancePrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstancePrivateLinkResourcesImpl; +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.OutboundFirewallRulesImpl; +import com.azure.resourcemanager.sql.generated.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.sql.generated.implementation.RecommendedSensitivityLabelsImpl; +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.ServerAdvisorsImpl; +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.ServerOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerSecurityAlertPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerTrustCertificatesImpl; +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.SqlAgentsImpl; +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.TimeZonesImpl; +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.DataWarehouseUserActivitiesOperations; +import com.azure.resourcemanager.sql.generated.models.DatabaseAdvisors; +import com.azure.resourcemanager.sql.generated.models.DatabaseAutomaticTunings; +import com.azure.resourcemanager.sql.generated.models.DatabaseBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.DatabaseColumns; +import com.azure.resourcemanager.sql.generated.models.DatabaseExtensionsOperations; +import com.azure.resourcemanager.sql.generated.models.DatabaseOperations; +import com.azure.resourcemanager.sql.generated.models.DatabaseRecommendedActions; +import com.azure.resourcemanager.sql.generated.models.DatabaseSchemas; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.DatabaseTables; +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.DeletedServers; +import com.azure.resourcemanager.sql.generated.models.DistributedAvailabilityGroups; +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.EndpointCertificates; +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.IPv6FirewallRules; +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.LedgerDigestUploadsOperations; +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.MaintenanceWindowOptionsOperations; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowsOperations; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseColumns; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseQueries; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRecommendedSensitivityLabels; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetails; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSchemas; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityEvents; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSensitivityLabels; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseTables; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseTransparentDataEncryptions; +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.ManagedInstancePrivateEndpointConnections; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkResources; +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.OutboundFirewallRules; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnections; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResources; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabels; +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.ServerAdvisors; +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.ServerOperations; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.ServerTrustCertificates; +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.SqlAgents; +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.TimeZones; +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; +import java.util.stream.Collectors; + +/** + * 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 DataMaskingPolicies dataMaskingPolicies; + + private DataMaskingRules dataMaskingRules; + + private GeoBackupPolicies geoBackupPolicies; + + private Databases databases; + + private ElasticPools elasticPools; + + private ReplicationLinks replicationLinks; + + private ServerCommunicationLinks serverCommunicationLinks; + + private ServiceObjectives serviceObjectives; + + private ElasticPoolActivities elasticPoolActivities; + + private ElasticPoolDatabaseActivities elasticPoolDatabaseActivities; + + private ServerUsages serverUsages; + + private DatabaseAdvisors databaseAdvisors; + + private DatabaseAutomaticTunings databaseAutomaticTunings; + + private DatabaseColumns databaseColumns; + + private DatabaseRecommendedActions databaseRecommendedActions; + + private DatabaseSchemas databaseSchemas; + + private DatabaseSecurityAlertPolicies databaseSecurityAlertPolicies; + + private DatabaseTables databaseTables; + + private DatabaseVulnerabilityAssessmentRuleBaselines databaseVulnerabilityAssessmentRuleBaselines; + + private DatabaseVulnerabilityAssessments databaseVulnerabilityAssessments; + + private DatabaseVulnerabilityAssessmentScans databaseVulnerabilityAssessmentScans; + + private DataWarehouseUserActivitiesOperations dataWarehouseUserActivitiesOperations; + + private DeletedServers deletedServers; + + private ElasticPoolOperations elasticPoolOperations; + + private EncryptionProtectors encryptionProtectors; + + private FailoverGroups failoverGroups; + + private FirewallRules firewallRules; + + private InstanceFailoverGroups instanceFailoverGroups; + + private InstancePools instancePools; + + 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 Capabilities capabilities; + + private LongTermRetentionPolicies longTermRetentionPolicies; + + private MaintenanceWindowOptionsOperations maintenanceWindowOptionsOperations; + + private MaintenanceWindowsOperations maintenanceWindowsOperations; + + private ManagedBackupShortTermRetentionPolicies managedBackupShortTermRetentionPolicies; + + private ManagedDatabaseColumns managedDatabaseColumns; + + private ManagedDatabaseQueries managedDatabaseQueries; + + private ManagedDatabaseRestoreDetails managedDatabaseRestoreDetails; + + private ManagedDatabases managedDatabases; + + private ManagedDatabaseSchemas managedDatabaseSchemas; + + private ManagedDatabaseSecurityAlertPolicies managedDatabaseSecurityAlertPolicies; + + private ManagedDatabaseSecurityEvents managedDatabaseSecurityEvents; + + private ManagedDatabaseTables managedDatabaseTables; + + private ManagedDatabaseTransparentDataEncryptions managedDatabaseTransparentDataEncryptions; + + private ManagedDatabaseVulnerabilityAssessmentRuleBaselines managedDatabaseVulnerabilityAssessmentRuleBaselines; + + private ManagedDatabaseVulnerabilityAssessments managedDatabaseVulnerabilityAssessments; + + private ManagedDatabaseVulnerabilityAssessmentScans managedDatabaseVulnerabilityAssessmentScans; + + private ManagedInstanceAdministrators managedInstanceAdministrators; + + private ManagedInstanceAzureADOnlyAuthentications managedInstanceAzureADOnlyAuthentications; + + private ManagedInstanceEncryptionProtectors managedInstanceEncryptionProtectors; + + private ManagedInstanceKeys managedInstanceKeys; + + private ManagedInstanceLongTermRetentionPolicies managedInstanceLongTermRetentionPolicies; + + private ManagedInstanceOperations managedInstanceOperations; + + private ManagedInstancePrivateEndpointConnections managedInstancePrivateEndpointConnections; + + private ManagedInstancePrivateLinkResources managedInstancePrivateLinkResources; + + private ManagedInstanceTdeCertificates managedInstanceTdeCertificates; + + private ManagedInstanceVulnerabilityAssessments managedInstanceVulnerabilityAssessments; + + private ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies + managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; + + private ManagedServerSecurityAlertPolicies managedServerSecurityAlertPolicies; + + private Operations operations; + + private PrivateEndpointConnections privateEndpointConnections; + + private PrivateLinkResources privateLinkResources; + + private RecoverableManagedDatabases recoverableManagedDatabases; + + private RestorePoints restorePoints; + + private ServerAdvisors serverAdvisors; + + private ServerAutomaticTunings serverAutomaticTunings; + + private ServerAzureADAdministrators serverAzureADAdministrators; + + private ServerAzureADOnlyAuthentications serverAzureADOnlyAuthentications; + + private ServerDevOpsAuditSettings serverDevOpsAuditSettings; + + private ServerDnsAliases serverDnsAliases; + + private ServerKeys serverKeys; + + private ServerOperations serverOperations; + + private ServerSecurityAlertPolicies serverSecurityAlertPolicies; + + private ServerTrustGroups serverTrustGroups; + + private ServerVulnerabilityAssessments serverVulnerabilityAssessments; + + private SqlAgents sqlAgents; + + private SubscriptionUsages subscriptionUsages; + + private SyncAgents syncAgents; + + private SyncGroups syncGroups; + + private SyncMembers syncMembers; + + private TdeCertificates tdeCertificates; + + private TimeZones timeZones; + + private VirtualClusters virtualClusters; + + private VirtualNetworkRules virtualNetworkRules; + + private WorkloadClassifiers workloadClassifiers; + + private WorkloadGroups workloadGroups; + + private TransparentDataEncryptions transparentDataEncryptions; + + private BackupShortTermRetentionPolicies backupShortTermRetentionPolicies; + + private DatabaseExtensionsOperations databaseExtensionsOperations; + + private DatabaseOperations databaseOperations; + + private DatabaseUsages databaseUsages; + + private LedgerDigestUploadsOperations ledgerDigestUploadsOperations; + + private OutboundFirewallRules outboundFirewallRules; + + private Servers servers; + + private Usages usages; + + private LongTermRetentionBackups longTermRetentionBackups; + + private LongTermRetentionManagedInstanceBackups longTermRetentionManagedInstanceBackups; + + private ManagedInstances managedInstances; + + private RestorableDroppedDatabases restorableDroppedDatabases; + + private RestorableDroppedManagedDatabases restorableDroppedManagedDatabases; + + private ServerConnectionPolicies serverConnectionPolicies; + + private DistributedAvailabilityGroups distributedAvailabilityGroups; + + private ServerTrustCertificates serverTrustCertificates; + + private IPv6FirewallRules iPv6FirewallRules; + + private EndpointCertificates endpointCertificates; + + private ManagedDatabaseSensitivityLabels managedDatabaseSensitivityLabels; + + private ManagedDatabaseRecommendedSensitivityLabels managedDatabaseRecommendedSensitivityLabels; + + private SensitivityLabels sensitivityLabels; + + private RecommendedSensitivityLabels recommendedSensitivityLabels; + + private ServerBlobAuditingPolicies serverBlobAuditingPolicies; + + private DatabaseBlobAuditingPolicies databaseBlobAuditingPolicies; + + private ExtendedDatabaseBlobAuditingPolicies extendedDatabaseBlobAuditingPolicies; + + private ExtendedServerBlobAuditingPolicies extendedServerBlobAuditingPolicies; + + 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); + } + + /** + * Creates an instance of Sql service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Sql service API instance. + */ + public static SqlManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new SqlManager(httpPipeline, profile, null); + } + + /** + * 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 static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' 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, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' 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 (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new 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 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 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 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 ServerUsages. */ + public ServerUsages serverUsages() { + if (this.serverUsages == null) { + this.serverUsages = new ServerUsagesImpl(clientObject.getServerUsages(), this); + } + return serverUsages; + } + + /** @return Resource collection API of DatabaseAdvisors. */ + public DatabaseAdvisors databaseAdvisors() { + if (this.databaseAdvisors == null) { + this.databaseAdvisors = new DatabaseAdvisorsImpl(clientObject.getDatabaseAdvisors(), this); + } + return databaseAdvisors; + } + + /** @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 DatabaseColumns. */ + public DatabaseColumns databaseColumns() { + if (this.databaseColumns == null) { + this.databaseColumns = new DatabaseColumnsImpl(clientObject.getDatabaseColumns(), this); + } + return databaseColumns; + } + + /** @return Resource collection API of DatabaseRecommendedActions. */ + public DatabaseRecommendedActions databaseRecommendedActions() { + if (this.databaseRecommendedActions == null) { + this.databaseRecommendedActions = + new DatabaseRecommendedActionsImpl(clientObject.getDatabaseRecommendedActions(), this); + } + return databaseRecommendedActions; + } + + /** @return Resource collection API of DatabaseSchemas. */ + public DatabaseSchemas databaseSchemas() { + if (this.databaseSchemas == null) { + this.databaseSchemas = new DatabaseSchemasImpl(clientObject.getDatabaseSchemas(), this); + } + return databaseSchemas; + } + + /** @return Resource collection API of DatabaseSecurityAlertPolicies. */ + public DatabaseSecurityAlertPolicies databaseSecurityAlertPolicies() { + if (this.databaseSecurityAlertPolicies == null) { + this.databaseSecurityAlertPolicies = + new DatabaseSecurityAlertPoliciesImpl(clientObject.getDatabaseSecurityAlertPolicies(), this); + } + return databaseSecurityAlertPolicies; + } + + /** @return Resource collection API of DatabaseTables. */ + public DatabaseTables databaseTables() { + if (this.databaseTables == null) { + this.databaseTables = new DatabaseTablesImpl(clientObject.getDatabaseTables(), this); + } + return databaseTables; + } + + /** @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 DatabaseVulnerabilityAssessmentScans. */ + public DatabaseVulnerabilityAssessmentScans databaseVulnerabilityAssessmentScans() { + if (this.databaseVulnerabilityAssessmentScans == null) { + this.databaseVulnerabilityAssessmentScans = + new DatabaseVulnerabilityAssessmentScansImpl( + clientObject.getDatabaseVulnerabilityAssessmentScans(), this); + } + return databaseVulnerabilityAssessmentScans; + } + + /** @return Resource collection API of DataWarehouseUserActivitiesOperations. */ + public DataWarehouseUserActivitiesOperations dataWarehouseUserActivitiesOperations() { + if (this.dataWarehouseUserActivitiesOperations == null) { + this.dataWarehouseUserActivitiesOperations = + new DataWarehouseUserActivitiesOperationsImpl( + clientObject.getDataWarehouseUserActivitiesOperations(), this); + } + return dataWarehouseUserActivitiesOperations; + } + + /** @return Resource collection API of DeletedServers. */ + public DeletedServers deletedServers() { + if (this.deletedServers == null) { + this.deletedServers = new DeletedServersImpl(clientObject.getDeletedServers(), this); + } + return deletedServers; + } + + /** @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 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 FirewallRules. */ + public FirewallRules firewallRules() { + if (this.firewallRules == null) { + this.firewallRules = new FirewallRulesImpl(clientObject.getFirewallRules(), this); + } + return firewallRules; + } + + /** @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 InstancePools. */ + public InstancePools instancePools() { + if (this.instancePools == null) { + this.instancePools = new InstancePoolsImpl(clientObject.getInstancePools(), this); + } + return instancePools; + } + + /** @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 Capabilities. */ + public Capabilities capabilities() { + if (this.capabilities == null) { + this.capabilities = new CapabilitiesImpl(clientObject.getCapabilities(), this); + } + return capabilities; + } + + /** @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 MaintenanceWindowOptionsOperations. */ + public MaintenanceWindowOptionsOperations maintenanceWindowOptionsOperations() { + if (this.maintenanceWindowOptionsOperations == null) { + this.maintenanceWindowOptionsOperations = + new MaintenanceWindowOptionsOperationsImpl(clientObject.getMaintenanceWindowOptionsOperations(), this); + } + return maintenanceWindowOptionsOperations; + } + + /** @return Resource collection API of MaintenanceWindowsOperations. */ + public MaintenanceWindowsOperations maintenanceWindowsOperations() { + if (this.maintenanceWindowsOperations == null) { + this.maintenanceWindowsOperations = + new MaintenanceWindowsOperationsImpl(clientObject.getMaintenanceWindowsOperations(), this); + } + return maintenanceWindowsOperations; + } + + /** @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 ManagedDatabaseColumns. */ + public ManagedDatabaseColumns managedDatabaseColumns() { + if (this.managedDatabaseColumns == null) { + this.managedDatabaseColumns = + new ManagedDatabaseColumnsImpl(clientObject.getManagedDatabaseColumns(), this); + } + return managedDatabaseColumns; + } + + /** @return Resource collection API of ManagedDatabaseQueries. */ + public ManagedDatabaseQueries managedDatabaseQueries() { + if (this.managedDatabaseQueries == null) { + this.managedDatabaseQueries = + new ManagedDatabaseQueriesImpl(clientObject.getManagedDatabaseQueries(), this); + } + return managedDatabaseQueries; + } + + /** @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 ManagedDatabases. */ + public ManagedDatabases managedDatabases() { + if (this.managedDatabases == null) { + this.managedDatabases = new ManagedDatabasesImpl(clientObject.getManagedDatabases(), this); + } + return managedDatabases; + } + + /** @return Resource collection API of ManagedDatabaseSchemas. */ + public ManagedDatabaseSchemas managedDatabaseSchemas() { + if (this.managedDatabaseSchemas == null) { + this.managedDatabaseSchemas = + new ManagedDatabaseSchemasImpl(clientObject.getManagedDatabaseSchemas(), this); + } + return managedDatabaseSchemas; + } + + /** @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 ManagedDatabaseSecurityEvents. */ + public ManagedDatabaseSecurityEvents managedDatabaseSecurityEvents() { + if (this.managedDatabaseSecurityEvents == null) { + this.managedDatabaseSecurityEvents = + new ManagedDatabaseSecurityEventsImpl(clientObject.getManagedDatabaseSecurityEvents(), this); + } + return managedDatabaseSecurityEvents; + } + + /** @return Resource collection API of ManagedDatabaseTables. */ + public ManagedDatabaseTables managedDatabaseTables() { + if (this.managedDatabaseTables == null) { + this.managedDatabaseTables = new ManagedDatabaseTablesImpl(clientObject.getManagedDatabaseTables(), this); + } + return managedDatabaseTables; + } + + /** @return Resource collection API of ManagedDatabaseTransparentDataEncryptions. */ + public ManagedDatabaseTransparentDataEncryptions managedDatabaseTransparentDataEncryptions() { + if (this.managedDatabaseTransparentDataEncryptions == null) { + this.managedDatabaseTransparentDataEncryptions = + new ManagedDatabaseTransparentDataEncryptionsImpl( + clientObject.getManagedDatabaseTransparentDataEncryptions(), this); + } + return managedDatabaseTransparentDataEncryptions; + } + + /** @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 ManagedDatabaseVulnerabilityAssessments. */ + public ManagedDatabaseVulnerabilityAssessments managedDatabaseVulnerabilityAssessments() { + if (this.managedDatabaseVulnerabilityAssessments == null) { + this.managedDatabaseVulnerabilityAssessments = + new ManagedDatabaseVulnerabilityAssessmentsImpl( + clientObject.getManagedDatabaseVulnerabilityAssessments(), this); + } + return managedDatabaseVulnerabilityAssessments; + } + + /** @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 ManagedInstanceAdministrators. */ + public ManagedInstanceAdministrators managedInstanceAdministrators() { + if (this.managedInstanceAdministrators == null) { + this.managedInstanceAdministrators = + new ManagedInstanceAdministratorsImpl(clientObject.getManagedInstanceAdministrators(), this); + } + return managedInstanceAdministrators; + } + + /** @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 ManagedInstanceEncryptionProtectors. */ + public ManagedInstanceEncryptionProtectors managedInstanceEncryptionProtectors() { + if (this.managedInstanceEncryptionProtectors == null) { + this.managedInstanceEncryptionProtectors = + new ManagedInstanceEncryptionProtectorsImpl( + clientObject.getManagedInstanceEncryptionProtectors(), this); + } + return managedInstanceEncryptionProtectors; + } + + /** @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 ManagedInstanceLongTermRetentionPolicies. */ + public ManagedInstanceLongTermRetentionPolicies managedInstanceLongTermRetentionPolicies() { + if (this.managedInstanceLongTermRetentionPolicies == null) { + this.managedInstanceLongTermRetentionPolicies = + new ManagedInstanceLongTermRetentionPoliciesImpl( + clientObject.getManagedInstanceLongTermRetentionPolicies(), this); + } + return managedInstanceLongTermRetentionPolicies; + } + + /** @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 ManagedInstancePrivateEndpointConnections. */ + public ManagedInstancePrivateEndpointConnections managedInstancePrivateEndpointConnections() { + if (this.managedInstancePrivateEndpointConnections == null) { + this.managedInstancePrivateEndpointConnections = + new ManagedInstancePrivateEndpointConnectionsImpl( + clientObject.getManagedInstancePrivateEndpointConnections(), this); + } + return managedInstancePrivateEndpointConnections; + } + + /** @return Resource collection API of ManagedInstancePrivateLinkResources. */ + public ManagedInstancePrivateLinkResources managedInstancePrivateLinkResources() { + if (this.managedInstancePrivateLinkResources == null) { + this.managedInstancePrivateLinkResources = + new ManagedInstancePrivateLinkResourcesImpl( + clientObject.getManagedInstancePrivateLinkResources(), this); + } + return managedInstancePrivateLinkResources; + } + + /** @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 ManagedInstanceVulnerabilityAssessments. */ + public ManagedInstanceVulnerabilityAssessments managedInstanceVulnerabilityAssessments() { + if (this.managedInstanceVulnerabilityAssessments == null) { + this.managedInstanceVulnerabilityAssessments = + new ManagedInstanceVulnerabilityAssessmentsImpl( + clientObject.getManagedInstanceVulnerabilityAssessments(), this); + } + return managedInstanceVulnerabilityAssessments; + } + + /** @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 ManagedServerSecurityAlertPolicies. */ + public ManagedServerSecurityAlertPolicies managedServerSecurityAlertPolicies() { + if (this.managedServerSecurityAlertPolicies == null) { + this.managedServerSecurityAlertPolicies = + new ManagedServerSecurityAlertPoliciesImpl(clientObject.getManagedServerSecurityAlertPolicies(), this); + } + return managedServerSecurityAlertPolicies; + } + + /** @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 PrivateEndpointConnections. */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** @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 RecoverableManagedDatabases. */ + public RecoverableManagedDatabases recoverableManagedDatabases() { + if (this.recoverableManagedDatabases == null) { + this.recoverableManagedDatabases = + new RecoverableManagedDatabasesImpl(clientObject.getRecoverableManagedDatabases(), this); + } + return recoverableManagedDatabases; + } + + /** @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 ServerAdvisors. */ + public ServerAdvisors serverAdvisors() { + if (this.serverAdvisors == null) { + this.serverAdvisors = new ServerAdvisorsImpl(clientObject.getServerAdvisors(), this); + } + return serverAdvisors; + } + + /** @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 ServerAzureADAdministrators. */ + public ServerAzureADAdministrators serverAzureADAdministrators() { + if (this.serverAzureADAdministrators == null) { + this.serverAzureADAdministrators = + new ServerAzureADAdministratorsImpl(clientObject.getServerAzureADAdministrators(), this); + } + return serverAzureADAdministrators; + } + + /** @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 ServerDevOpsAuditSettings. */ + public ServerDevOpsAuditSettings serverDevOpsAuditSettings() { + if (this.serverDevOpsAuditSettings == null) { + this.serverDevOpsAuditSettings = + new ServerDevOpsAuditSettingsImpl(clientObject.getServerDevOpsAuditSettings(), this); + } + return serverDevOpsAuditSettings; + } + + /** @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 ServerKeys. */ + public ServerKeys serverKeys() { + if (this.serverKeys == null) { + this.serverKeys = new ServerKeysImpl(clientObject.getServerKeys(), this); + } + return serverKeys; + } + + /** @return Resource collection API of ServerOperations. */ + public ServerOperations serverOperations() { + if (this.serverOperations == null) { + this.serverOperations = new ServerOperationsImpl(clientObject.getServerOperations(), this); + } + return serverOperations; + } + + /** @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 ServerTrustGroups. */ + public ServerTrustGroups serverTrustGroups() { + if (this.serverTrustGroups == null) { + this.serverTrustGroups = new ServerTrustGroupsImpl(clientObject.getServerTrustGroups(), this); + } + return serverTrustGroups; + } + + /** @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 SqlAgents. */ + public SqlAgents sqlAgents() { + if (this.sqlAgents == null) { + this.sqlAgents = new SqlAgentsImpl(clientObject.getSqlAgents(), this); + } + return sqlAgents; + } + + /** @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 SyncAgents. */ + public SyncAgents syncAgents() { + if (this.syncAgents == null) { + this.syncAgents = new SyncAgentsImpl(clientObject.getSyncAgents(), this); + } + return syncAgents; + } + + /** @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 TdeCertificates. */ + public TdeCertificates tdeCertificates() { + if (this.tdeCertificates == null) { + this.tdeCertificates = new TdeCertificatesImpl(clientObject.getTdeCertificates(), this); + } + return tdeCertificates; + } + + /** @return Resource collection API of TimeZones. */ + public TimeZones timeZones() { + if (this.timeZones == null) { + this.timeZones = new TimeZonesImpl(clientObject.getTimeZones(), this); + } + return timeZones; + } + + /** @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 WorkloadClassifiers. */ + public WorkloadClassifiers workloadClassifiers() { + if (this.workloadClassifiers == null) { + this.workloadClassifiers = new WorkloadClassifiersImpl(clientObject.getWorkloadClassifiers(), this); + } + return workloadClassifiers; + } + + /** @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 TransparentDataEncryptions. */ + public TransparentDataEncryptions transparentDataEncryptions() { + if (this.transparentDataEncryptions == null) { + this.transparentDataEncryptions = + new TransparentDataEncryptionsImpl(clientObject.getTransparentDataEncryptions(), this); + } + return transparentDataEncryptions; + } + + /** @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 DatabaseExtensionsOperations. */ + public DatabaseExtensionsOperations databaseExtensionsOperations() { + if (this.databaseExtensionsOperations == null) { + this.databaseExtensionsOperations = + new DatabaseExtensionsOperationsImpl(clientObject.getDatabaseExtensionsOperations(), this); + } + return databaseExtensionsOperations; + } + + /** @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 DatabaseUsages. */ + public DatabaseUsages databaseUsages() { + if (this.databaseUsages == null) { + this.databaseUsages = new DatabaseUsagesImpl(clientObject.getDatabaseUsages(), this); + } + return databaseUsages; + } + + /** @return Resource collection API of LedgerDigestUploadsOperations. */ + public LedgerDigestUploadsOperations ledgerDigestUploadsOperations() { + if (this.ledgerDigestUploadsOperations == null) { + this.ledgerDigestUploadsOperations = + new LedgerDigestUploadsOperationsImpl(clientObject.getLedgerDigestUploadsOperations(), this); + } + return ledgerDigestUploadsOperations; + } + + /** @return Resource collection API of OutboundFirewallRules. */ + public OutboundFirewallRules outboundFirewallRules() { + if (this.outboundFirewallRules == null) { + this.outboundFirewallRules = new OutboundFirewallRulesImpl(clientObject.getOutboundFirewallRules(), this); + } + return outboundFirewallRules; + } + + /** @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 Usages. */ + public Usages usages() { + if (this.usages == null) { + this.usages = new UsagesImpl(clientObject.getUsages(), this); + } + return usages; + } + + /** @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 LongTermRetentionManagedInstanceBackups. */ + public LongTermRetentionManagedInstanceBackups longTermRetentionManagedInstanceBackups() { + if (this.longTermRetentionManagedInstanceBackups == null) { + this.longTermRetentionManagedInstanceBackups = + new LongTermRetentionManagedInstanceBackupsImpl( + clientObject.getLongTermRetentionManagedInstanceBackups(), this); + } + return longTermRetentionManagedInstanceBackups; + } + + /** @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 RestorableDroppedDatabases. */ + public RestorableDroppedDatabases restorableDroppedDatabases() { + if (this.restorableDroppedDatabases == null) { + this.restorableDroppedDatabases = + new RestorableDroppedDatabasesImpl(clientObject.getRestorableDroppedDatabases(), this); + } + return restorableDroppedDatabases; + } + + /** @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 ServerConnectionPolicies. */ + public ServerConnectionPolicies serverConnectionPolicies() { + if (this.serverConnectionPolicies == null) { + this.serverConnectionPolicies = + new ServerConnectionPoliciesImpl(clientObject.getServerConnectionPolicies(), this); + } + return serverConnectionPolicies; + } + + /** @return Resource collection API of DistributedAvailabilityGroups. */ + public DistributedAvailabilityGroups distributedAvailabilityGroups() { + if (this.distributedAvailabilityGroups == null) { + this.distributedAvailabilityGroups = + new DistributedAvailabilityGroupsImpl(clientObject.getDistributedAvailabilityGroups(), this); + } + return distributedAvailabilityGroups; + } + + /** @return Resource collection API of ServerTrustCertificates. */ + public ServerTrustCertificates serverTrustCertificates() { + if (this.serverTrustCertificates == null) { + this.serverTrustCertificates = + new ServerTrustCertificatesImpl(clientObject.getServerTrustCertificates(), this); + } + return serverTrustCertificates; + } + + /** @return Resource collection API of IPv6FirewallRules. */ + public IPv6FirewallRules iPv6FirewallRules() { + if (this.iPv6FirewallRules == null) { + this.iPv6FirewallRules = new IPv6FirewallRulesImpl(clientObject.getIPv6FirewallRules(), this); + } + return iPv6FirewallRules; + } + + /** @return Resource collection API of EndpointCertificates. */ + public EndpointCertificates endpointCertificates() { + if (this.endpointCertificates == null) { + this.endpointCertificates = new EndpointCertificatesImpl(clientObject.getEndpointCertificates(), this); + } + return endpointCertificates; + } + + /** @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 ManagedDatabaseRecommendedSensitivityLabels. */ + public ManagedDatabaseRecommendedSensitivityLabels managedDatabaseRecommendedSensitivityLabels() { + if (this.managedDatabaseRecommendedSensitivityLabels == null) { + this.managedDatabaseRecommendedSensitivityLabels = + new ManagedDatabaseRecommendedSensitivityLabelsImpl( + clientObject.getManagedDatabaseRecommendedSensitivityLabels(), this); + } + return managedDatabaseRecommendedSensitivityLabels; + } + + /** @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 RecommendedSensitivityLabels. */ + public RecommendedSensitivityLabels recommendedSensitivityLabels() { + if (this.recommendedSensitivityLabels == null) { + this.recommendedSensitivityLabels = + new RecommendedSensitivityLabelsImpl(clientObject.getRecommendedSensitivityLabels(), this); + } + return recommendedSensitivityLabels; + } + + /** @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 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 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..9d299f927676c --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..28ad540422ab2 --- /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 along with {@link Response}. + */ + @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..432f4b2d3ca96 --- /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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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..50c8cd019d2eb --- /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 along with {@link Response}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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/DataWarehouseUserActivitiesOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataWarehouseUserActivitiesOperationsClient.java new file mode 100644 index 0000000000000..832527b30455c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataWarehouseUserActivitiesOperationsClient.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.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.DataWarehouseUserActivitiesInner; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivityName; + +/** + * An instance of this class provides access to all the operations defined in + * DataWarehouseUserActivitiesOperationsClient. + */ +public interface DataWarehouseUserActivitiesOperationsClient { + /** + * Gets the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataWarehouseUserActivityName The activity name of the data warehouse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataWarehouseUserActivitiesInner get( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName); + + /** + * Gets the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataWarehouseUserActivityName The activity name of the data warehouse. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName, + Context context); + + /** + * List the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 user activities of a data warehouse as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * List the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 user activities of a data warehouse as paginated response with {@link PagedIterable}. + */ + @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/DatabaseAdvisorsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAdvisorsClient.java new file mode 100644 index 0000000000000..c646eba3c7497 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAdvisorsClient.java @@ -0,0 +1,124 @@ +// Copyright (c) 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.AdvisorInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in DatabaseAdvisorsClient. */ +public interface DatabaseAdvisorsClient { + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 advisors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listByDatabaseWithResponse( + String resourceGroupName, String serverName, String databaseName, String expand, Context context); + + /** + * Gets a database 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 the database. + * @param advisorName The name of the Database 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 database advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdvisorInner get(String resourceGroupName, String serverName, String databaseName, String advisorName); + + /** + * Gets a database 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 the database. + * @param advisorName The name of the Database 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 database advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context); + + /** + * Updates a database 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 the database. + * @param advisorName The name of the Database Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdvisorInner update( + String resourceGroupName, String serverName, String databaseName, String advisorName, AdvisorInner parameters); + + /** + * Updates a database 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 the database. + * @param advisorName The name of the Database Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + AdvisorInner parameters, + 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..565d37365e2ed --- /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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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..23c1703048b8c --- /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 { + /** + * 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, 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 com.azure.core.management.exception.ManagementException thrown 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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseBlobAuditingPolicyInner parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseColumnsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseColumnsClient.java new file mode 100644 index 0000000000000..da045a64886b8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseColumnsClient.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; + +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.DatabaseColumnInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in DatabaseColumnsClient. */ +public interface DatabaseColumnsClient { + /** + * List database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * List database 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 schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point 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 database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context); + + /** + * List database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTable( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName); + + /** + * List database 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 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 database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTable( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context); + + /** + * Get database 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. + * @return database column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseColumnInner get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Get database 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 database column along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + 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/DatabaseExtensionsOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseExtensionsOperationsClient.java new file mode 100644 index 0000000000000..1bcb10674adbc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseExtensionsOperationsClient.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.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.ImportExportExtensionsOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseExtensions; + +/** An instance of this class provides access to all the operations defined in DatabaseExtensionsOperationsClient. */ +public interface DatabaseExtensionsOperationsClient { + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName 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 get(String resourceGroupName, String serverName, String databaseName, String extensionName); + + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName 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 database extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String extensionName, Context context); + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @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 the {@link SyncPoller} for polling of an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImportExportExtensionsOperationResultInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters); + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @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 the {@link SyncPoller} for polling of an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImportExportExtensionsOperationResultInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters, + Context context); + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @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 Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportExtensionsOperationResultInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters); + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @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 Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportExtensionsOperationResultInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters, + Context context); + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 import export operation extensions list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 import export operation extensions list as paginated response with {@link PagedIterable}. + */ + @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..0c68418c27acd --- /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 {@link 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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/DatabaseRecommendedActionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseRecommendedActionsClient.java new file mode 100644 index 0000000000000..e47ceee58953d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseRecommendedActionsClient.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.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in DatabaseRecommendedActionsClient. */ +public interface DatabaseRecommendedActionsClient { + /** + * Gets list of Database Recommended Actions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database 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 list of Database Recommended Actions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listByDatabaseAdvisor( + String resourceGroupName, String serverName, String databaseName, String advisorName); + + /** + * Gets list of Database Recommended Actions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database 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 list of Database Recommended Actions along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listByDatabaseAdvisorWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context); + + /** + * Gets a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecommendedActionInner get( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName); + + /** + * Gets a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + Context context); + + /** + * Updates a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param parameters The requested recommended action 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, Server or Elastic Pool Recommended Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecommendedActionInner update( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters); + + /** + * Updates a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param parameters The requested recommended action 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, Server or Elastic Pool Recommended Action along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSchemasClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSchemasClient.java new file mode 100644 index 0000000000000..4dd2543156e06 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSchemasClient.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.DatabaseSchemaInner; + +/** An instance of this class provides access to all the operations defined in DatabaseSchemasClient. */ +public interface DatabaseSchemasClient { + /** + * List 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * List 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. + * @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 database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, String filter, Context context); + + /** + * Get 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. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 schema. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSchemaInner get(String resourceGroupName, String serverName, String databaseName, String schemaName); + + /** + * Get 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. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 schema along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String schemaName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSecurityAlertPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSecurityAlertPoliciesClient.java new file mode 100644 index 0000000000000..02f423758fea8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSecurityAlertPoliciesClient.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.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.DatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** An instance of this class provides access to all the operations defined in DatabaseSecurityAlertPoliciesClient. */ +public interface DatabaseSecurityAlertPoliciesClient { + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the 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 database's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSecurityAlertPolicyInner get( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the 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 database's security alert policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + 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 serverName The name of the server. + * @param databaseName The name of the 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 database security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner 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 serverName The name of the server. + * @param databaseName The name of the 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 database security alert policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters, + Context context); + + /** + * Gets a list of 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 serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy 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 database's security alert policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of 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 serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy 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 database's security alert policies as paginated response with {@link PagedIterable}. + */ + @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/DatabaseTablesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseTablesClient.java new file mode 100644 index 0000000000000..cdb976a50c5dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseTablesClient.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; + +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.DatabaseTableInner; + +/** An instance of this class provides access to all the operations defined in DatabaseTablesClient. */ +public interface DatabaseTablesClient { + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySchema( + String resourceGroupName, String serverName, String databaseName, String schemaName); + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 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 database tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySchema( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String filter, + Context context); + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseTableInner get( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName); + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 table along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + 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..04273f936c575 --- /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 { + /** + * Gets 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 database usages as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets 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 database usages as paginated response with {@link PagedIterable}. + */ + @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..51152cfbec1a8 --- /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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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 {@link 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..cf8b78adbfc15 --- /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 { + /** + * 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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); + + /** + * 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + 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 along with {@link Response}. + */ + @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..7ed1f63933362 --- /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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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 {@link 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..698ba1be4fd07 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabasesClient.java @@ -0,0 +1,883 @@ +// Copyright (c) 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.ImportExistingDatabaseDefinition; +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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName, 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 as paginated response with {@link PagedIterable}. + */ + @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 skipToken The skipToken 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 databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, String skipToken, 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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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); + + /** + * 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 the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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); + + /** + * 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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); + + /** + * 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 the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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); + + /** + * 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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response renameWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ResourceMoveDefinition parameters, + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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); + + /** + * 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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); + + /** + * 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DeletedServersClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DeletedServersClient.java new file mode 100644 index 0000000000000..835348bcb89f2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DeletedServersClient.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.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.DeletedServerInner; + +/** An instance of this class provides access to all the operations defined in DeletedServersClient. */ +public interface DeletedServersClient { + /** + * Gets a list of all deleted servers in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all deleted servers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeletedServerInner get(String locationName, String deletedServerName); + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String locationName, String deletedServerName, Context context); + + /** + * Gets a list of deleted servers for a 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 a list of deleted servers for a location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName); + + /** + * Gets a list of deleted servers for a 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 a list of deleted servers for a location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName, Context context); + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 {@link SyncPoller} for polling of a deleted server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeletedServerInner> beginRecover( + String locationName, String deletedServerName); + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 {@link SyncPoller} for polling of a deleted server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeletedServerInner> beginRecover( + String locationName, String deletedServerName, Context context); + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeletedServerInner recover(String locationName, String deletedServerName); + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeletedServerInner recover(String locationName, String deletedServerName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DistributedAvailabilityGroupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DistributedAvailabilityGroupsClient.java new file mode 100644 index 0000000000000..ac7e927f4ea20 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DistributedAvailabilityGroupsClient.java @@ -0,0 +1,316 @@ +// Copyright (c) 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.DistributedAvailabilityGroupInner; + +/** An instance of this class provides access to all the operations defined in DistributedAvailabilityGroupsClient. */ +public interface DistributedAvailabilityGroupsClient { + /** + * Gets a list of a distributed availability groups in 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 a distributed availability groups in instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of a distributed availability groups in 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 a distributed availability groups in instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group 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 distributed availability group info. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DistributedAvailabilityGroupInner get( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName); + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group 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 distributed availability group info along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName, Context context); + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DistributedAvailabilityGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters); + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DistributedAvailabilityGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context); + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DistributedAvailabilityGroupInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters); + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DistributedAvailabilityGroupInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName, Context context); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName, Context context); + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DistributedAvailabilityGroupInner> beginUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters); + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DistributedAvailabilityGroupInner> beginUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context); + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DistributedAvailabilityGroupInner update( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters); + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DistributedAvailabilityGroupInner update( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner 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..1025f3cec9c95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolActivitiesClient.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.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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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..f3af192a3eb97 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolDatabaseActivitiesClient.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.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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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..80fd6e064647e --- /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 {@link 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..dbfe938a44eee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolsClient.java @@ -0,0 +1,432 @@ +// Copyright (c) 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Long 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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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..d1cb2236ff66a --- /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 { + /** + * 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 {@link SyncPoller} for polling of the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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); + + /** + * 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/EndpointCertificatesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/EndpointCertificatesClient.java new file mode 100644 index 0000000000000..f978cd733f72a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/EndpointCertificatesClient.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.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.EndpointCertificateInner; + +/** An instance of this class provides access to all the operations defined in EndpointCertificatesClient. */ +public interface EndpointCertificatesClient { + /** + * List certificates used on endpoints on the target 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 endpoint certificates on the target instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * List certificates used on endpoints on the target 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 endpoint certificates on the target instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking 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 a certificate used on the endpoint with the given id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EndpointCertificateInner get(String resourceGroupName, String managedInstanceName, String endpointType); + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking 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 a certificate used on the endpoint with the given id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String endpointType, 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..5fb806aabcb03 --- /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 { + /** + * 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, 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 com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner parameters, + 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..2f0fd99ee1842 --- /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 { + /** + * 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, 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 com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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); +} 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..7ec9baaf05541 --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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..68c54eccc8acc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FirewallRulesClient.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; + +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; +import com.azure.resourcemanager.sql.generated.models.FirewallRuleList; + +/** An instance of this class provides access to all the operations defined in FirewallRulesClient. */ +public interface FirewallRulesClient { + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, 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 com.azure.core.management.exception.ManagementException 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 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 a server firewall rule along with {@link Response}. + */ + @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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * Gets 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 a list of firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets 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 a list of firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Replaces all firewall rules on the server. + * + * @param resourceGroupName The name of the resource group that contains 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 A list of server firewall rules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner replace(String resourceGroupName, String serverName, FirewallRuleList parameters); + + /** + * Replaces all firewall rules on the server. + * + * @param resourceGroupName The name of the resource group that contains 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 A list of server firewall rules. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response replaceWithResponse( + String resourceGroupName, String serverName, FirewallRuleList parameters, 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..2fcbb5d2984ce --- /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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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/IPv6FirewallRulesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/IPv6FirewallRulesClient.java new file mode 100644 index 0000000000000..b08315e991f02 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/IPv6FirewallRulesClient.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.IPv6FirewallRuleInner; + +/** An instance of this class provides access to all the operations defined in IPv6FirewallRulesClient. */ +public interface IPv6FirewallRulesClient { + /** + * Gets a list of IPv6 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 a list of IPv6 firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of IPv6 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 a list of IPv6 firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets an IPv6 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 an IPv6 firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IPv6FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Gets an IPv6 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 an IPv6 firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * Creates or updates an IPv6 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 an IPv6 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 an IPv6 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IPv6FirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, IPv6FirewallRuleInner parameters); + + /** + * Creates or updates an IPv6 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 an IPv6 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 an IPv6 server firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String firewallRuleName, + IPv6FirewallRuleInner parameters, + Context context); + + /** + * Deletes an IPv6 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 an IPv6 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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, 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..247cdd08be0c8 --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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..fa3d800dc2218 --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..8f340f6e479b8 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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..7710b1c944d55 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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 {@link 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..aff8d52a5c291 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 {@link 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 the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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..edec1e4983aa6 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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..3c365dd2d0295 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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 {@link 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..0538ef3f5b617 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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..3fd0490062d41 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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 {@link 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..e318566d7ac2e --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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..dbb0eea45c778 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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 {@link 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/LedgerDigestUploadsOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LedgerDigestUploadsOperationsClient.java new file mode 100644 index 0000000000000..3ce74d942b8d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LedgerDigestUploadsOperationsClient.java @@ -0,0 +1,260 @@ +// Copyright (c) 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.LedgerDigestUploadsInner; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; + +/** An instance of this class provides access to all the operations defined in LedgerDigestUploadsOperationsClient. */ +public interface LedgerDigestUploadsOperationsClient { + /** + * Gets the current ledger digest upload configuration 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 current ledger digest upload configuration for a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LedgerDigestUploadsInner get( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads); + + /** + * Gets the current ledger digest upload configuration 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 current ledger digest upload configuration for a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context); + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload 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 the {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LedgerDigestUploadsInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters); + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload 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 the {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LedgerDigestUploadsInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters, + Context context); + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload 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 azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LedgerDigestUploadsInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters); + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload 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 azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LedgerDigestUploadsInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters, + Context context); + + /** + * Gets all ledger digest upload settings on 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 all ledger digest upload settings on a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets all ledger digest upload settings on 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 all ledger digest upload settings on a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LedgerDigestUploadsInner> beginDisable( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LedgerDigestUploadsInner> beginDisable( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LedgerDigestUploadsInner disable( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LedgerDigestUploadsInner disable( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + 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..c49d2d9f84ad5 --- /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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 along with {@link Response}. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 along with {@link Response}. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..96949a3f438bf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionManagedInstanceBackupsClient.java @@ -0,0 +1,486 @@ +// Copyright (c) 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 along with {@link Response}. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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..b8d1ecf3a4a30 --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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/MaintenanceWindowOptionsOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/MaintenanceWindowOptionsOperationsClient.java new file mode 100644 index 0000000000000..9b56bce910dcf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/MaintenanceWindowOptionsOperationsClient.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; + +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.MaintenanceWindowOptionsInner; + +/** + * An instance of this class provides access to all the operations defined in MaintenanceWindowOptionsOperationsClient. + */ +public interface MaintenanceWindowOptionsOperationsClient { + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options 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 available maintenance windows. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MaintenanceWindowOptionsInner get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowOptionsName); + + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options 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 available maintenance windows along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowOptionsName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/MaintenanceWindowsOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/MaintenanceWindowsOperationsClient.java new file mode 100644 index 0000000000000..e856b2b443384 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/MaintenanceWindowsOperationsClient.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; + +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.MaintenanceWindowsInner; + +/** An instance of this class provides access to all the operations defined in MaintenanceWindowsOperationsClient. */ +public interface MaintenanceWindowsOperationsClient { + /** + * Gets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to get maintenance windows for. + * @param maintenanceWindowName Maintenance window 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 maintenance windows settings for a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MaintenanceWindowsInner get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowName); + + /** + * Gets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to get maintenance windows for. + * @param maintenanceWindowName Maintenance window 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 maintenance windows settings for a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + Context context); + + /** + * Sets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters); + + /** + * Sets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters, + 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..bccc7b058f402 --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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/ManagedDatabaseColumnsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseColumnsClient.java new file mode 100644 index 0000000000000..84a2ccbf6979d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseColumnsClient.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.DatabaseColumnInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseColumnsClient. */ +public interface ManagedDatabaseColumnsClient { + /** + * List managed database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * List managed database 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 schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point 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 database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context); + + /** + * List managed database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTable( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName); + + /** + * List managed database 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 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 database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTable( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context); + + /** + * Get managed database 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. + * @return managed database column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseColumnInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Get managed database 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 managed database column along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + 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/ManagedDatabaseQueriesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseQueriesClient.java new file mode 100644 index 0000000000000..985cf24d17a25 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseQueriesClient.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.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.ManagedInstanceQueryInner; +import com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsInner; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseQueriesClient. */ +public interface ManagedDatabaseQueriesClient { + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId 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 query by query id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceQueryInner get( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId); + + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId 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 query by query id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId, Context context); + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId 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 query execution statistics by query id as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByQuery( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId); + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByQuery( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseRecommendedSensitivityLabelsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseRecommendedSensitivityLabelsClient.java new file mode 100644 index 0000000000000..d36da7deaeb3e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseRecommendedSensitivityLabelsClient.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; + +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.models.RecommendedSensitivityLabelUpdateList; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseRecommendedSensitivityLabelsClient. + */ +public interface ManagedDatabaseRecommendedSensitivityLabelsClient { + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters); + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + 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..6be17dcda5746 --- /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 along with {@link Response}. + */ + @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/ManagedDatabaseSchemasClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSchemasClient.java new file mode 100644 index 0000000000000..d0ed43f97e674 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSchemasClient.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; + +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.DatabaseSchemaInner; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseSchemasClient. */ +public interface ManagedDatabaseSchemasClient { + /** + * List managed 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 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 list of database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * List managed 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 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 a list of database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context); + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 schema. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSchemaInner get( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName); + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 schema along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, 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..a89ea784e2d25 --- /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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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/ManagedDatabaseSecurityEventsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSecurityEventsClient.java new file mode 100644 index 0000000000000..27b80a7285833 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSecurityEventsClient.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; + +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.SecurityEventInner; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseSecurityEventsClient. */ +public interface ManagedDatabaseSecurityEventsClient { + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events 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 a list of security events as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @param filter An OData filter expression that filters elements in the collection. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point 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 security events as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken, + 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..c2f297c614a19 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSensitivityLabelsClient.java @@ -0,0 +1,399 @@ +// Copyright (c) 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; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; + +/** + * 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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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 {@link 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 {@link 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 {@link 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 as paginated response with {@link PagedIterable}. + */ + @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 skipToken The skipToken parameter. + * @param count The count 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCurrentByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters, + 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 as paginated response with {@link PagedIterable}. + */ + @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 skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseTablesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseTablesClient.java new file mode 100644 index 0000000000000..35cf771726295 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseTablesClient.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; + +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.DatabaseTableInner; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseTablesClient. */ +public interface ManagedDatabaseTablesClient { + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySchema( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName); + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 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 database tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySchema( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String filter, + Context context); + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseTableInner get( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName); + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 table along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseTransparentDataEncryptionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseTransparentDataEncryptionsClient.java new file mode 100644 index 0000000000000..9b6584054d407 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseTransparentDataEncryptionsClient.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.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.ManagedTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseTransparentDataEncryptionsClient. + */ +public interface ManagedDatabaseTransparentDataEncryptionsClient { + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName 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 managed database's transparent data encryption. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedTransparentDataEncryptionInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName); + + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName 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 managed database's transparent data encryption along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context); + + /** + * 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database 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 a managed database transparent data encryption state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedTransparentDataEncryptionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + ManagedTransparentDataEncryptionInner parameters); + + /** + * 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database 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 a managed database transparent data encryption state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + ManagedTransparentDataEncryptionInner parameters, + Context context); + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption 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 managed database's transparent data encryptions as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption 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 managed database's transparent data encryptions as paginated response with {@link + * PagedIterable}. + */ + @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/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..1a41f7d9e2583 --- /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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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 {@link 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..a0d8d9c7a2f42 --- /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 { + /** + * 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response exportWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + 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 com.azure.core.management.exception.ManagementException thrown if 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + 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..f984ccd45a212 --- /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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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 {@link 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..ae86e6425e7f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabasesClient.java @@ -0,0 +1,414 @@ +// Copyright (c) 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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..d23f47976517c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAdministratorsClient.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.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; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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. + * @param administratorName The administratorName 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 managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAdministratorInner get( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName); + + /** + * 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 administratorName The administratorName 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 managed instance administrator along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, 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 administratorName The administratorName parameter. + * @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 the {@link SyncPoller} for polling of an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceAdministratorInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + 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 administratorName The administratorName parameter. + * @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 the {@link SyncPoller} for polling of an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceAdministratorInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + 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 administratorName The administratorName parameter. + * @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, + AdministratorName administratorName, + 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 administratorName The administratorName parameter. + * @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, + AdministratorName administratorName, + 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. + * @param administratorName The administratorName 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName); + + /** + * 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 administratorName The administratorName 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, 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. + * @param administratorName The administratorName 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 managedInstanceName, AdministratorName administratorName); + + /** + * 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 administratorName The administratorName 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 managedInstanceName, AdministratorName administratorName, 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..e33ea0d32e178 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAzureADOnlyAuthenticationsClient.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; + +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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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..b0f2fec012966 --- /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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 {@link SyncPoller} for polling of the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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..73c89d6924806 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of a managed instance key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a managed instance key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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..6a71b1d5fbd1d --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..ec303a7067775 --- /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 { + /** + * 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, 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 com.azure.core.management.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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelWithResponse( + 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/ManagedInstancePrivateEndpointConnectionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancePrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..2a2d5d330992e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancePrivateEndpointConnectionsClient.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.ManagedInstancePrivateEndpointConnectionInner; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstancePrivateEndpointConnectionsClient. + */ +public interface ManagedInstancePrivateEndpointConnectionsClient { + /** + * 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 managedInstanceName The name of the managed instance. + * @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) + ManagedInstancePrivateEndpointConnectionInner get( + String resourceGroupName, String managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstancePrivateEndpointConnectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner 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 managedInstanceName The name of the managed instance. + * @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 the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstancePrivateEndpointConnectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner 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 managedInstanceName The name of the managed instance. + * @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) + ManagedInstancePrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner 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 managedInstanceName The name of the managed instance. + * @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) + ManagedInstancePrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner 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 managedInstanceName The name of the managed instance. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 managedInstanceName, 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 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 all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName); + + /** + * 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 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 all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancePrivateLinkResourcesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancePrivateLinkResourcesClient.java new file mode 100644 index 0000000000000..dc56c972cd150 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancePrivateLinkResourcesClient.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.ManagedInstancePrivateLinkInner; + +/** + * An instance of this class provides access to all the operations defined in ManagedInstancePrivateLinkResourcesClient. + */ +public interface ManagedInstancePrivateLinkResourcesClient { + /** + * 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 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 private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName); + + /** + * 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 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 private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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) + ManagedInstancePrivateLinkInner get(String resourceGroupName, String managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String groupName, 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..bff91f2c10f47 --- /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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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..c4afed5046d42 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceVulnerabilityAssessmentsClient.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.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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Creates or updates the managed instance's vulnerability assessment. Learn more about setting SQL vulnerability + * assessment with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that contains 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. Learn more about setting SQL vulnerability + * assessment with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that contains 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 along with {@link Response}. + */ + @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 {@link 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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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..4cf50fcb91c25 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancesClient.java @@ -0,0 +1,446 @@ +// Copyright (c) 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 as paginated response with {@link PagedIterable}. + */ + @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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, String expand, 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all managed instances in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String expand, 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 as paginated response with {@link PagedIterable}. + */ + @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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String expand, 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String managedInstanceName, String expand, 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 the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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); +} 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..0b18c113b76c5 --- /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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + Context context); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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 restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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 restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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 restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..3f4b6b4a9f90f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedServerSecurityAlertPoliciesClient.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.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.SecurityAlertPolicyName; + +/** + * 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, SecurityAlertPolicyName 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName 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 the {@link SyncPoller} for polling of a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName 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 the {@link SyncPoller} for polling of a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName 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, + SecurityAlertPolicyName 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, + SecurityAlertPolicyName 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..498a7c825a66d --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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/OutboundFirewallRulesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/OutboundFirewallRulesClient.java new file mode 100644 index 0000000000000..3f4f0e3a12f75 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/OutboundFirewallRulesClient.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.OutboundFirewallRuleInner; + +/** An instance of this class provides access to all the operations defined in OutboundFirewallRulesClient. */ +public interface OutboundFirewallRulesClient { + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn 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 an outbound firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OutboundFirewallRuleInner get(String resourceGroupName, String serverName, String outboundRuleFqdn); + + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn 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 an outbound firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context); + + /** + * Create a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound 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 the {@link SyncPoller} for polling of an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OutboundFirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String outboundRuleFqdn, OutboundFirewallRuleInner parameters); + + /** + * Create a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound 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 {@link SyncPoller} for polling of an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OutboundFirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String outboundRuleFqdn, + OutboundFirewallRuleInner parameters, + Context context); + + /** + * Create a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound 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 an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OutboundFirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String outboundRuleFqdn, OutboundFirewallRuleInner parameters); + + /** + * Create a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound 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 an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OutboundFirewallRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String outboundRuleFqdn, + OutboundFirewallRuleInner parameters, + Context context); + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String outboundRuleFqdn); + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context); + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 outboundRuleFqdn); + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 outboundRuleFqdn, Context context); + + /** + * Gets all outbound firewall rules 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 outbound firewall rules on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all outbound firewall rules 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 outbound firewall rules on a server as paginated response with {@link PagedIterable}. + */ + @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/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..b314b9ba4acc9 --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..6fff55a99f0ed --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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/RecommendedSensitivityLabelsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecommendedSensitivityLabelsClient.java new file mode 100644 index 0000000000000..d3c4a2e1270fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecommendedSensitivityLabelsClient.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; + +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.models.RecommendedSensitivityLabelUpdateList; + +/** An instance of this class provides access to all the operations defined in RecommendedSensitivityLabelsClient. */ +public interface RecommendedSensitivityLabelsClient { + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 update( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters); + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + 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..639e70701c0f6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableDatabasesClient.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.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 along with {@link + * Response}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..3dfc068fb6df1 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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..5cc594aacb311 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ReplicationLinksClient.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.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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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); + + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 replication links on database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 replication links on database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a 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. + * @param linkId The name of the 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 a replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReplicationLinkInner get(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Gets a 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. + * @param linkId The name of the 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 a replication link along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Gets a list of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedIterable}. + */ + @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/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..b8583343d8050 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedDatabasesClient.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.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 list of restorable dropped 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 restorable dropped databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of restorable dropped 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 restorable dropped databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @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 database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorableDroppedDatabaseInner get(String resourceGroupName, String serverName, String restorableDroppedDatabaseId); + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @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 database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId, 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..92d6d1a5c9b7a --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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..bf3b2827be1ba --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 the {@link SyncPoller} for polling of database restore points. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of database restore points. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 along with {@link Response}. + */ + @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 {@link 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..14faccb4884df --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SensitivityLabelsClient.java @@ -0,0 +1,394 @@ +// Copyright (c) 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; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; + +/** 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 as paginated response with {@link PagedIterable}. + */ + @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 skipToken The skipToken parameter. + * @param count The count 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCurrentByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 update( + String resourceGroupName, String serverName, String databaseName, SensitivityLabelUpdateList parameters); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SensitivityLabelUpdateList parameters, + 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 as paginated response with {@link PagedIterable}. + */ + @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 skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + 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 {@link 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 {@link 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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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 {@link 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/ServerAdvisorsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAdvisorsClient.java new file mode 100644 index 0000000000000..7321e0bffd3de --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAdvisorsClient.java @@ -0,0 +1,112 @@ +// Copyright (c) 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.AdvisorInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in ServerAdvisorsClient. */ +public interface ServerAdvisorsClient { + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The name of the resource group that 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 advisors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listByServerWithResponse( + String resourceGroupName, String serverName, String expand, Context context); + + /** + * Gets a server 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 advisorName The name of the Server 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 server advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdvisorInner get(String resourceGroupName, String serverName, String advisorName); + + /** + * Gets a server 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 advisorName The name of the Server 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 server advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, Context context); + + /** + * Updates a server 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 advisorName The name of the Server Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdvisorInner update(String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters); + + /** + * Updates a server 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 advisorName The name of the Server Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters, 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..184bec564f687 --- /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 along with {@link Response}. + */ + @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 along with {@link Response}. + */ + @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..8839c473a16bb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADAdministratorsClient.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.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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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..59f42ea386187 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADOnlyAuthenticationsClient.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; + +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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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..f3ee212f89dd2 --- /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 { + /** + * 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, 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 com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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); +} 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..38d669aaa3660 --- /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 {@link 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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of server communication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of server communication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..be0fc4805a1c1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerConnectionPoliciesClient.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.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.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 { + /** + * Gets a server 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 a server connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerConnectionPolicyInner get( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName); + + /** + * Gets a server 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 a server connection policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName, Context context); + + /** + * Updates a server 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 server 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 {@link SyncPoller} for polling of a server connection policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerConnectionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters); + + /** + * Updates a server 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 server 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 {@link SyncPoller} for polling of a server connection policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerConnectionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context); + + /** + * Updates a server 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 server 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 connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerConnectionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters); + + /** + * Updates a server 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 server 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 connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerConnectionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context); + + /** + * Lists 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 connection policy objects as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 connection policy objects as paginated response with {@link PagedIterable}. + */ + @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/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..7cf7e4426ed07 --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..74f24dbe99988 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDnsAliasesClient.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.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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerDnsAliasInner> 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 {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerDnsAliasInner> 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. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDnsAliasInner 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. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDnsAliasInner 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..09544e24abdd9 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @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 the {@link SyncPoller} for polling of a server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @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 the {@link SyncPoller} for polling of a server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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/ServerOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerOperationsClient.java new file mode 100644 index 0000000000000..2f4e755e64886 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerOperationsClient.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.ServerOperationInner; + +/** An instance of this class provides access to all the operations defined in ServerOperationsClient. */ +public interface ServerOperationsClient { + /** + * Gets a list of operations performed on the server. + * + * @param resourceGroupName The name of the resource group that 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 operations performed on the server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of operations performed on the server. + * + * @param resourceGroupName The name of the resource group that contains 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 operations performed on the server as paginated response with {@link PagedIterable}. + */ + @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/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..21b165585ea8a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerSecurityAlertPoliciesClient.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.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.SecurityAlertPolicyName; + +/** 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, SecurityAlertPolicyName 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName 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 the {@link SyncPoller} for polling of a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName 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 the {@link SyncPoller} for polling of a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName 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, + SecurityAlertPolicyName 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, + SecurityAlertPolicyName 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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/ServerTrustCertificatesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerTrustCertificatesClient.java new file mode 100644 index 0000000000000..a439211a9c4f6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerTrustCertificatesClient.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.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.ServerTrustCertificateInner; + +/** An instance of this class provides access to all the operations defined in ServerTrustCertificatesClient. */ +public interface ServerTrustCertificatesClient { + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 server trust certificate that was uploaded from box to Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerTrustCertificateInner get(String resourceGroupName, String managedInstanceName, String certificateName); + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 server trust certificate that was uploaded from box to Sql Managed Instance along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String certificateName, Context context); + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate 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 the {@link SyncPoller} for polling of server trust certificate imported from box to enable connection + * between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerTrustCertificateInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters); + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate 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 the {@link SyncPoller} for polling of server trust certificate imported from box to enable connection + * between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerTrustCertificateInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters, + Context context); + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate 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 server trust certificate imported from box to enable connection between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerTrustCertificateInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters); + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate 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 server trust certificate imported from box to enable connection between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerTrustCertificateInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters, + Context context); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String certificateName); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String certificateName, Context context); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 managedInstanceName, String certificateName); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 managedInstanceName, String certificateName, 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..479512ed55d2a --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of a server trust group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a server trust group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..dfaa3e6ea957b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerUsagesClient.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.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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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..db9371335372e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerVulnerabilityAssessmentsClient.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.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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment + * with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that 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. Learn more about setting SQL vulnerability assessment + * with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that 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 along with {@link Response}. + */ + @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 {@link 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..d61a1ad1b6e08 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServersClient.java @@ -0,0 +1,380 @@ +// Copyright (c) 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 as paginated response with {@link PagedIterable}. + */ + @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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String expand, 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String serverName, String expand, 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 the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all servers in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String expand, 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 the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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); + + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest 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..1628a8895b533 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServiceObjectivesClient.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.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 along with {@link Response}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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/SqlAgentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlAgentsClient.java new file mode 100644 index 0000000000000..2ff761e1db0a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlAgentsClient.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.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner; + +/** An instance of this class provides access to all the operations defined in SqlAgentsClient. */ +public interface SqlAgentsClient { + /** + * Gets current instance sql agent 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 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 current instance sql agent configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlAgentConfigurationInner get(String resourceGroupName, String managedInstanceName); + + /** + * Gets current instance sql agent 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 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 current instance sql agent configuration along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Puts new sql agent configuration to 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 A recoverable managed database 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 recoverable managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlAgentConfigurationInner createOrUpdate( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters); + + /** + * Puts new sql agent configuration to 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 A recoverable managed database 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 recoverable managed database resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters, 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..4b301a165422d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlManagementClient.java @@ -0,0 +1,894 @@ +// Copyright (c) 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 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 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 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 ServerUsagesClient object to access its operations. + * + * @return the ServerUsagesClient object. + */ + ServerUsagesClient getServerUsages(); + + /** + * Gets the DatabaseAdvisorsClient object to access its operations. + * + * @return the DatabaseAdvisorsClient object. + */ + DatabaseAdvisorsClient getDatabaseAdvisors(); + + /** + * Gets the DatabaseAutomaticTuningsClient object to access its operations. + * + * @return the DatabaseAutomaticTuningsClient object. + */ + DatabaseAutomaticTuningsClient getDatabaseAutomaticTunings(); + + /** + * Gets the DatabaseColumnsClient object to access its operations. + * + * @return the DatabaseColumnsClient object. + */ + DatabaseColumnsClient getDatabaseColumns(); + + /** + * Gets the DatabaseRecommendedActionsClient object to access its operations. + * + * @return the DatabaseRecommendedActionsClient object. + */ + DatabaseRecommendedActionsClient getDatabaseRecommendedActions(); + + /** + * Gets the DatabaseSchemasClient object to access its operations. + * + * @return the DatabaseSchemasClient object. + */ + DatabaseSchemasClient getDatabaseSchemas(); + + /** + * Gets the DatabaseSecurityAlertPoliciesClient object to access its operations. + * + * @return the DatabaseSecurityAlertPoliciesClient object. + */ + DatabaseSecurityAlertPoliciesClient getDatabaseSecurityAlertPolicies(); + + /** + * Gets the DatabaseTablesClient object to access its operations. + * + * @return the DatabaseTablesClient object. + */ + DatabaseTablesClient getDatabaseTables(); + + /** + * 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 DatabaseVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the DatabaseVulnerabilityAssessmentScansClient object. + */ + DatabaseVulnerabilityAssessmentScansClient getDatabaseVulnerabilityAssessmentScans(); + + /** + * Gets the DataWarehouseUserActivitiesOperationsClient object to access its operations. + * + * @return the DataWarehouseUserActivitiesOperationsClient object. + */ + DataWarehouseUserActivitiesOperationsClient getDataWarehouseUserActivitiesOperations(); + + /** + * Gets the DeletedServersClient object to access its operations. + * + * @return the DeletedServersClient object. + */ + DeletedServersClient getDeletedServers(); + + /** + * Gets the ElasticPoolOperationsClient object to access its operations. + * + * @return the ElasticPoolOperationsClient object. + */ + ElasticPoolOperationsClient getElasticPoolOperations(); + + /** + * 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 FirewallRulesClient object to access its operations. + * + * @return the FirewallRulesClient object. + */ + FirewallRulesClient getFirewallRules(); + + /** + * Gets the InstanceFailoverGroupsClient object to access its operations. + * + * @return the InstanceFailoverGroupsClient object. + */ + InstanceFailoverGroupsClient getInstanceFailoverGroups(); + + /** + * Gets the InstancePoolsClient object to access its operations. + * + * @return the InstancePoolsClient object. + */ + InstancePoolsClient getInstancePools(); + + /** + * 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 CapabilitiesClient object to access its operations. + * + * @return the CapabilitiesClient object. + */ + CapabilitiesClient getCapabilities(); + + /** + * Gets the LongTermRetentionPoliciesClient object to access its operations. + * + * @return the LongTermRetentionPoliciesClient object. + */ + LongTermRetentionPoliciesClient getLongTermRetentionPolicies(); + + /** + * Gets the MaintenanceWindowOptionsOperationsClient object to access its operations. + * + * @return the MaintenanceWindowOptionsOperationsClient object. + */ + MaintenanceWindowOptionsOperationsClient getMaintenanceWindowOptionsOperations(); + + /** + * Gets the MaintenanceWindowsOperationsClient object to access its operations. + * + * @return the MaintenanceWindowsOperationsClient object. + */ + MaintenanceWindowsOperationsClient getMaintenanceWindowsOperations(); + + /** + * Gets the ManagedBackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedBackupShortTermRetentionPoliciesClient object. + */ + ManagedBackupShortTermRetentionPoliciesClient getManagedBackupShortTermRetentionPolicies(); + + /** + * Gets the ManagedDatabaseColumnsClient object to access its operations. + * + * @return the ManagedDatabaseColumnsClient object. + */ + ManagedDatabaseColumnsClient getManagedDatabaseColumns(); + + /** + * Gets the ManagedDatabaseQueriesClient object to access its operations. + * + * @return the ManagedDatabaseQueriesClient object. + */ + ManagedDatabaseQueriesClient getManagedDatabaseQueries(); + + /** + * Gets the ManagedDatabaseRestoreDetailsClient object to access its operations. + * + * @return the ManagedDatabaseRestoreDetailsClient object. + */ + ManagedDatabaseRestoreDetailsClient getManagedDatabaseRestoreDetails(); + + /** + * Gets the ManagedDatabasesClient object to access its operations. + * + * @return the ManagedDatabasesClient object. + */ + ManagedDatabasesClient getManagedDatabases(); + + /** + * Gets the ManagedDatabaseSchemasClient object to access its operations. + * + * @return the ManagedDatabaseSchemasClient object. + */ + ManagedDatabaseSchemasClient getManagedDatabaseSchemas(); + + /** + * Gets the ManagedDatabaseSecurityAlertPoliciesClient object to access its operations. + * + * @return the ManagedDatabaseSecurityAlertPoliciesClient object. + */ + ManagedDatabaseSecurityAlertPoliciesClient getManagedDatabaseSecurityAlertPolicies(); + + /** + * Gets the ManagedDatabaseSecurityEventsClient object to access its operations. + * + * @return the ManagedDatabaseSecurityEventsClient object. + */ + ManagedDatabaseSecurityEventsClient getManagedDatabaseSecurityEvents(); + + /** + * Gets the ManagedDatabaseTablesClient object to access its operations. + * + * @return the ManagedDatabaseTablesClient object. + */ + ManagedDatabaseTablesClient getManagedDatabaseTables(); + + /** + * Gets the ManagedDatabaseTransparentDataEncryptionsClient object to access its operations. + * + * @return the ManagedDatabaseTransparentDataEncryptionsClient object. + */ + ManagedDatabaseTransparentDataEncryptionsClient getManagedDatabaseTransparentDataEncryptions(); + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient object. + */ + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient getManagedDatabaseVulnerabilityAssessmentRuleBaselines(); + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentsClient object. + */ + ManagedDatabaseVulnerabilityAssessmentsClient getManagedDatabaseVulnerabilityAssessments(); + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentScansClient object. + */ + ManagedDatabaseVulnerabilityAssessmentScansClient getManagedDatabaseVulnerabilityAssessmentScans(); + + /** + * Gets the ManagedInstanceAdministratorsClient object to access its operations. + * + * @return the ManagedInstanceAdministratorsClient object. + */ + ManagedInstanceAdministratorsClient getManagedInstanceAdministrators(); + + /** + * Gets the ManagedInstanceAzureADOnlyAuthenticationsClient object to access its operations. + * + * @return the ManagedInstanceAzureADOnlyAuthenticationsClient object. + */ + ManagedInstanceAzureADOnlyAuthenticationsClient getManagedInstanceAzureADOnlyAuthentications(); + + /** + * Gets the ManagedInstanceEncryptionProtectorsClient object to access its operations. + * + * @return the ManagedInstanceEncryptionProtectorsClient object. + */ + ManagedInstanceEncryptionProtectorsClient getManagedInstanceEncryptionProtectors(); + + /** + * Gets the ManagedInstanceKeysClient object to access its operations. + * + * @return the ManagedInstanceKeysClient object. + */ + ManagedInstanceKeysClient getManagedInstanceKeys(); + + /** + * Gets the ManagedInstanceLongTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedInstanceLongTermRetentionPoliciesClient object. + */ + ManagedInstanceLongTermRetentionPoliciesClient getManagedInstanceLongTermRetentionPolicies(); + + /** + * Gets the ManagedInstanceOperationsClient object to access its operations. + * + * @return the ManagedInstanceOperationsClient object. + */ + ManagedInstanceOperationsClient getManagedInstanceOperations(); + + /** + * Gets the ManagedInstancePrivateEndpointConnectionsClient object to access its operations. + * + * @return the ManagedInstancePrivateEndpointConnectionsClient object. + */ + ManagedInstancePrivateEndpointConnectionsClient getManagedInstancePrivateEndpointConnections(); + + /** + * Gets the ManagedInstancePrivateLinkResourcesClient object to access its operations. + * + * @return the ManagedInstancePrivateLinkResourcesClient object. + */ + ManagedInstancePrivateLinkResourcesClient getManagedInstancePrivateLinkResources(); + + /** + * Gets the ManagedInstanceTdeCertificatesClient object to access its operations. + * + * @return the ManagedInstanceTdeCertificatesClient object. + */ + ManagedInstanceTdeCertificatesClient getManagedInstanceTdeCertificates(); + + /** + * Gets the ManagedInstanceVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ManagedInstanceVulnerabilityAssessmentsClient object. + */ + ManagedInstanceVulnerabilityAssessmentsClient getManagedInstanceVulnerabilityAssessments(); + + /** + * Gets the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient object. + */ + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient + getManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies(); + + /** + * Gets the ManagedServerSecurityAlertPoliciesClient object to access its operations. + * + * @return the ManagedServerSecurityAlertPoliciesClient object. + */ + ManagedServerSecurityAlertPoliciesClient getManagedServerSecurityAlertPolicies(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); + + /** + * Gets the RecoverableManagedDatabasesClient object to access its operations. + * + * @return the RecoverableManagedDatabasesClient object. + */ + RecoverableManagedDatabasesClient getRecoverableManagedDatabases(); + + /** + * Gets the RestorePointsClient object to access its operations. + * + * @return the RestorePointsClient object. + */ + RestorePointsClient getRestorePoints(); + + /** + * Gets the ServerAdvisorsClient object to access its operations. + * + * @return the ServerAdvisorsClient object. + */ + ServerAdvisorsClient getServerAdvisors(); + + /** + * Gets the ServerAutomaticTuningsClient object to access its operations. + * + * @return the ServerAutomaticTuningsClient object. + */ + ServerAutomaticTuningsClient getServerAutomaticTunings(); + + /** + * Gets the ServerAzureADAdministratorsClient object to access its operations. + * + * @return the ServerAzureADAdministratorsClient object. + */ + ServerAzureADAdministratorsClient getServerAzureADAdministrators(); + + /** + * Gets the ServerAzureADOnlyAuthenticationsClient object to access its operations. + * + * @return the ServerAzureADOnlyAuthenticationsClient object. + */ + ServerAzureADOnlyAuthenticationsClient getServerAzureADOnlyAuthentications(); + + /** + * Gets the ServerDevOpsAuditSettingsClient object to access its operations. + * + * @return the ServerDevOpsAuditSettingsClient object. + */ + ServerDevOpsAuditSettingsClient getServerDevOpsAuditSettings(); + + /** + * Gets the ServerDnsAliasesClient object to access its operations. + * + * @return the ServerDnsAliasesClient object. + */ + ServerDnsAliasesClient getServerDnsAliases(); + + /** + * Gets the ServerKeysClient object to access its operations. + * + * @return the ServerKeysClient object. + */ + ServerKeysClient getServerKeys(); + + /** + * Gets the ServerOperationsClient object to access its operations. + * + * @return the ServerOperationsClient object. + */ + ServerOperationsClient getServerOperations(); + + /** + * Gets the ServerSecurityAlertPoliciesClient object to access its operations. + * + * @return the ServerSecurityAlertPoliciesClient object. + */ + ServerSecurityAlertPoliciesClient getServerSecurityAlertPolicies(); + + /** + * Gets the ServerTrustGroupsClient object to access its operations. + * + * @return the ServerTrustGroupsClient object. + */ + ServerTrustGroupsClient getServerTrustGroups(); + + /** + * Gets the ServerVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ServerVulnerabilityAssessmentsClient object. + */ + ServerVulnerabilityAssessmentsClient getServerVulnerabilityAssessments(); + + /** + * Gets the SqlAgentsClient object to access its operations. + * + * @return the SqlAgentsClient object. + */ + SqlAgentsClient getSqlAgents(); + + /** + * Gets the SubscriptionUsagesClient object to access its operations. + * + * @return the SubscriptionUsagesClient object. + */ + SubscriptionUsagesClient getSubscriptionUsages(); + + /** + * Gets the SyncAgentsClient object to access its operations. + * + * @return the SyncAgentsClient object. + */ + SyncAgentsClient getSyncAgents(); + + /** + * 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 TdeCertificatesClient object to access its operations. + * + * @return the TdeCertificatesClient object. + */ + TdeCertificatesClient getTdeCertificates(); + + /** + * Gets the TimeZonesClient object to access its operations. + * + * @return the TimeZonesClient object. + */ + TimeZonesClient getTimeZones(); + + /** + * 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 WorkloadClassifiersClient object to access its operations. + * + * @return the WorkloadClassifiersClient object. + */ + WorkloadClassifiersClient getWorkloadClassifiers(); + + /** + * Gets the WorkloadGroupsClient object to access its operations. + * + * @return the WorkloadGroupsClient object. + */ + WorkloadGroupsClient getWorkloadGroups(); + + /** + * Gets the TransparentDataEncryptionsClient object to access its operations. + * + * @return the TransparentDataEncryptionsClient object. + */ + TransparentDataEncryptionsClient getTransparentDataEncryptions(); + + /** + * Gets the BackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the BackupShortTermRetentionPoliciesClient object. + */ + BackupShortTermRetentionPoliciesClient getBackupShortTermRetentionPolicies(); + + /** + * Gets the DatabaseExtensionsOperationsClient object to access its operations. + * + * @return the DatabaseExtensionsOperationsClient object. + */ + DatabaseExtensionsOperationsClient getDatabaseExtensionsOperations(); + + /** + * Gets the DatabaseOperationsClient object to access its operations. + * + * @return the DatabaseOperationsClient object. + */ + DatabaseOperationsClient getDatabaseOperations(); + + /** + * Gets the DatabaseUsagesClient object to access its operations. + * + * @return the DatabaseUsagesClient object. + */ + DatabaseUsagesClient getDatabaseUsages(); + + /** + * Gets the LedgerDigestUploadsOperationsClient object to access its operations. + * + * @return the LedgerDigestUploadsOperationsClient object. + */ + LedgerDigestUploadsOperationsClient getLedgerDigestUploadsOperations(); + + /** + * Gets the OutboundFirewallRulesClient object to access its operations. + * + * @return the OutboundFirewallRulesClient object. + */ + OutboundFirewallRulesClient getOutboundFirewallRules(); + + /** + * Gets the ServersClient object to access its operations. + * + * @return the ServersClient object. + */ + ServersClient getServers(); + + /** + * Gets the UsagesClient object to access its operations. + * + * @return the UsagesClient object. + */ + UsagesClient getUsages(); + + /** + * Gets the LongTermRetentionBackupsClient object to access its operations. + * + * @return the LongTermRetentionBackupsClient object. + */ + LongTermRetentionBackupsClient getLongTermRetentionBackups(); + + /** + * Gets the LongTermRetentionManagedInstanceBackupsClient object to access its operations. + * + * @return the LongTermRetentionManagedInstanceBackupsClient object. + */ + LongTermRetentionManagedInstanceBackupsClient getLongTermRetentionManagedInstanceBackups(); + + /** + * Gets the ManagedInstancesClient object to access its operations. + * + * @return the ManagedInstancesClient object. + */ + ManagedInstancesClient getManagedInstances(); + + /** + * Gets the RestorableDroppedDatabasesClient object to access its operations. + * + * @return the RestorableDroppedDatabasesClient object. + */ + RestorableDroppedDatabasesClient getRestorableDroppedDatabases(); + + /** + * Gets the RestorableDroppedManagedDatabasesClient object to access its operations. + * + * @return the RestorableDroppedManagedDatabasesClient object. + */ + RestorableDroppedManagedDatabasesClient getRestorableDroppedManagedDatabases(); + + /** + * Gets the ServerConnectionPoliciesClient object to access its operations. + * + * @return the ServerConnectionPoliciesClient object. + */ + ServerConnectionPoliciesClient getServerConnectionPolicies(); + + /** + * Gets the DistributedAvailabilityGroupsClient object to access its operations. + * + * @return the DistributedAvailabilityGroupsClient object. + */ + DistributedAvailabilityGroupsClient getDistributedAvailabilityGroups(); + + /** + * Gets the ServerTrustCertificatesClient object to access its operations. + * + * @return the ServerTrustCertificatesClient object. + */ + ServerTrustCertificatesClient getServerTrustCertificates(); + + /** + * Gets the IPv6FirewallRulesClient object to access its operations. + * + * @return the IPv6FirewallRulesClient object. + */ + IPv6FirewallRulesClient getIPv6FirewallRules(); + + /** + * Gets the EndpointCertificatesClient object to access its operations. + * + * @return the EndpointCertificatesClient object. + */ + EndpointCertificatesClient getEndpointCertificates(); + + /** + * Gets the ManagedDatabaseSensitivityLabelsClient object to access its operations. + * + * @return the ManagedDatabaseSensitivityLabelsClient object. + */ + ManagedDatabaseSensitivityLabelsClient getManagedDatabaseSensitivityLabels(); + + /** + * Gets the ManagedDatabaseRecommendedSensitivityLabelsClient object to access its operations. + * + * @return the ManagedDatabaseRecommendedSensitivityLabelsClient object. + */ + ManagedDatabaseRecommendedSensitivityLabelsClient getManagedDatabaseRecommendedSensitivityLabels(); + + /** + * Gets the SensitivityLabelsClient object to access its operations. + * + * @return the SensitivityLabelsClient object. + */ + SensitivityLabelsClient getSensitivityLabels(); + + /** + * Gets the RecommendedSensitivityLabelsClient object to access its operations. + * + * @return the RecommendedSensitivityLabelsClient object. + */ + RecommendedSensitivityLabelsClient getRecommendedSensitivityLabels(); + + /** + * 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 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(); +} 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..a6d3cb176a4cf --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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..fafaa64617660 --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..07a5eb0c300ab --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 {@link 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 {@link 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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..858c0ac9f058c --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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..e2886410c33e7 --- /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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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/TimeZonesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TimeZonesClient.java new file mode 100644 index 0000000000000..9149c573a4250 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TimeZonesClient.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.TimeZoneInner; + +/** An instance of this class provides access to all the operations defined in TimeZonesClient. */ +public interface TimeZonesClient { + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName 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 managed instance time zones by location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName); + + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName 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 managed instance time zones by location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName, Context context); + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId 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 managed instance time zone. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TimeZoneInner get(String locationName, String timeZoneId); + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId 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 managed instance time zone along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String locationName, String timeZoneId, 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..3465ab68c8922 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TransparentDataEncryptionsClient.java @@ -0,0 +1,136 @@ +// Copyright (c) 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.LogicalDatabaseTransparentDataEncryptionInner; +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 { + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName 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 logical database's transparent data encryption. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogicalDatabaseTransparentDataEncryptionInner get( + String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionName tdeName); + + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName 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 logical database's transparent data encryption along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context); + + /** + * Updates a logical 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 logical database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database 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 a logical database transparent data encryption state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogicalDatabaseTransparentDataEncryptionInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + LogicalDatabaseTransparentDataEncryptionInner parameters); + + /** + * Updates a logical 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 logical database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database 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 a logical database transparent data encryption state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + LogicalDatabaseTransparentDataEncryptionInner parameters, + Context context); + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption 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 logical database's transparent data encryption as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption 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 logical database's transparent data encryption as paginated response with {@link + * PagedIterable}. + */ + @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/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..a2a3fa5bb5572 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..42219819ad25c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualClustersClient.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.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.UpdateManagedInstanceDnsServersOperationInner; +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 { + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 recoverable managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UpdateManagedInstanceDnsServersOperationInner updateDnsServers(String resourceGroupName, String virtualClusterName); + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 recoverable managed database resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateDnsServersWithResponse( + String resourceGroupName, String virtualClusterName, Context context); + + /** + * 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 virtual cluster 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 {@link SyncPoller} for polling of an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 virtual cluster 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 {@link SyncPoller} for polling of an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 virtual cluster 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 virtual cluster 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..22d5e364f397c --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..a67f4b9904d1d --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..baf35c1369b1a --- /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 along with {@link Response}. + */ + @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 the {@link SyncPoller} for polling of workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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/AdministratorProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdministratorProperties.java new file mode 100644 index 0000000000000..5918ac86c2069 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdministratorProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.AdministratorType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Properties of a active directory administrator. */ +@Fluent +public final class AdministratorProperties { + /* + * Type of the sever administrator. + */ + @JsonProperty(value = "administratorType", required = true) + private AdministratorType administratorType; + + /* + * Login name of the server administrator. + */ + @JsonProperty(value = "login", required = true) + private String login; + + /* + * SID (object ID) of the server administrator. + */ + @JsonProperty(value = "sid", required = true) + private UUID sid; + + /* + * Tenant ID of the administrator. + */ + @JsonProperty(value = "tenantId") + private UUID tenantId; + + /* + * Azure Active Directory only Authentication enabled. + */ + @JsonProperty(value = "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 AdministratorProperties object itself. + */ + public AdministratorProperties 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 AdministratorProperties object itself. + */ + public AdministratorProperties 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 AdministratorProperties object itself. + */ + public AdministratorProperties 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 AdministratorProperties object itself. + */ + public AdministratorProperties 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() { + if (administratorType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorType in model AdministratorProperties")); + } + if (login() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property login in model AdministratorProperties")); + } + if (sid() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property sid in model AdministratorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AdministratorProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvisorInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvisorInner.java new file mode 100644 index 0000000000000..1f9150b741578 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvisorInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.AdvisorStatus; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatus; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatusInheritedFrom; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Database, Server or Elastic Pool Advisor. */ +@Fluent +public final class AdvisorInner extends ProxyResource { + /* + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private AdvisorProperties innerProperties; + + /** + * Get the kind property: Resource kind. + * + * @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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private AdvisorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the advisorStatus property: Gets the status of availability of this advisor to customers. Possible values are + * 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. + * + * @return the advisorStatus value. + */ + public AdvisorStatus advisorStatus() { + return this.innerProperties() == null ? null : this.innerProperties().advisorStatus(); + } + + /** + * Get the autoExecuteStatus property: Gets the auto-execute status (whether to let the system execute the + * recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. + * + * @return the autoExecuteStatus value. + */ + public AutoExecuteStatus autoExecuteStatus() { + return this.innerProperties() == null ? null : this.innerProperties().autoExecuteStatus(); + } + + /** + * Set the autoExecuteStatus property: Gets the auto-execute status (whether to let the system execute the + * recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. + * + * @param autoExecuteStatus the autoExecuteStatus value to set. + * @return the AdvisorInner object itself. + */ + public AdvisorInner withAutoExecuteStatus(AutoExecuteStatus autoExecuteStatus) { + if (this.innerProperties() == null) { + this.innerProperties = new AdvisorProperties(); + } + this.innerProperties().withAutoExecuteStatus(autoExecuteStatus); + return this; + } + + /** + * Get the autoExecuteStatusInheritedFrom property: Gets the resource from which current value of auto-execute + * status is inherited. Auto-execute status can be set on (and inherited from) different levels in the resource + * hierarchy. Possible values are 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when status is + * not explicitly set on any level). + * + * @return the autoExecuteStatusInheritedFrom value. + */ + public AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom() { + return this.innerProperties() == null ? null : this.innerProperties().autoExecuteStatusInheritedFrom(); + } + + /** + * Get the recommendationsStatus property: Gets that status of recommendations for this advisor and reason for not + * having any recommendations. Possible values include, but are not limited to, 'Ok' (Recommendations + * available),LowActivity (not enough workload to analyze), 'DbSeemsTuned' (Database is doing well), etc. + * + * @return the recommendationsStatus value. + */ + public String recommendationsStatus() { + return this.innerProperties() == null ? null : this.innerProperties().recommendationsStatus(); + } + + /** + * Get the lastChecked property: Gets the time when the current resource was analyzed for recommendations by this + * advisor. + * + * @return the lastChecked value. + */ + public OffsetDateTime lastChecked() { + return this.innerProperties() == null ? null : this.innerProperties().lastChecked(); + } + + /** + * Get the recommendedActions property: Gets the recommended actions for this advisor. + * + * @return the recommendedActions value. + */ + public List recommendedActions() { + return this.innerProperties() == null ? null : this.innerProperties().recommendedActions(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvisorProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvisorProperties.java new file mode 100644 index 0000000000000..27e412266cdff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvisorProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.AdvisorStatus; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatus; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatusInheritedFrom; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties for a Database, Server or Elastic Pool Advisor. */ +@Fluent +public final class AdvisorProperties { + /* + * Gets the status of availability of this advisor to customers. Possible + * values are 'GA', 'PublicPreview', 'LimitedPublicPreview' and + * 'PrivatePreview'. + */ + @JsonProperty(value = "advisorStatus", access = JsonProperty.Access.WRITE_ONLY) + private AdvisorStatus advisorStatus; + + /* + * Gets the auto-execute status (whether to let the system execute the + * recommendations) of this advisor. Possible values are 'Enabled' and + * 'Disabled' + */ + @JsonProperty(value = "autoExecuteStatus", required = true) + private AutoExecuteStatus autoExecuteStatus; + + /* + * Gets the resource from which current value of auto-execute status is + * inherited. Auto-execute status can be set on (and inherited from) + * different levels in the resource hierarchy. Possible values are + * 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when + * status is not explicitly set on any level). + */ + @JsonProperty(value = "autoExecuteStatusInheritedFrom", access = JsonProperty.Access.WRITE_ONLY) + private AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom; + + /* + * Gets that status of recommendations for this advisor and reason for not + * having any recommendations. Possible values include, but are not limited + * to, 'Ok' (Recommendations available),LowActivity (not enough workload to + * analyze), 'DbSeemsTuned' (Database is doing well), etc. + */ + @JsonProperty(value = "recommendationsStatus", access = JsonProperty.Access.WRITE_ONLY) + private String recommendationsStatus; + + /* + * Gets the time when the current resource was analyzed for recommendations + * by this advisor. + */ + @JsonProperty(value = "lastChecked", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastChecked; + + /* + * Gets the recommended actions for this advisor. + */ + @JsonProperty(value = "recommendedActions", access = JsonProperty.Access.WRITE_ONLY) + private List recommendedActions; + + /** + * Get the advisorStatus property: Gets the status of availability of this advisor to customers. Possible values are + * 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. + * + * @return the advisorStatus value. + */ + public AdvisorStatus advisorStatus() { + return this.advisorStatus; + } + + /** + * Get the autoExecuteStatus property: Gets the auto-execute status (whether to let the system execute the + * recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. + * + * @return the autoExecuteStatus value. + */ + public AutoExecuteStatus autoExecuteStatus() { + return this.autoExecuteStatus; + } + + /** + * Set the autoExecuteStatus property: Gets the auto-execute status (whether to let the system execute the + * recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. + * + * @param autoExecuteStatus the autoExecuteStatus value to set. + * @return the AdvisorProperties object itself. + */ + public AdvisorProperties withAutoExecuteStatus(AutoExecuteStatus autoExecuteStatus) { + this.autoExecuteStatus = autoExecuteStatus; + return this; + } + + /** + * Get the autoExecuteStatusInheritedFrom property: Gets the resource from which current value of auto-execute + * status is inherited. Auto-execute status can be set on (and inherited from) different levels in the resource + * hierarchy. Possible values are 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when status is + * not explicitly set on any level). + * + * @return the autoExecuteStatusInheritedFrom value. + */ + public AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom() { + return this.autoExecuteStatusInheritedFrom; + } + + /** + * Get the recommendationsStatus property: Gets that status of recommendations for this advisor and reason for not + * having any recommendations. Possible values include, but are not limited to, 'Ok' (Recommendations + * available),LowActivity (not enough workload to analyze), 'DbSeemsTuned' (Database is doing well), etc. + * + * @return the recommendationsStatus value. + */ + public String recommendationsStatus() { + return this.recommendationsStatus; + } + + /** + * Get the lastChecked property: Gets the time when the current resource was analyzed for recommendations by this + * advisor. + * + * @return the lastChecked value. + */ + public OffsetDateTime lastChecked() { + return this.lastChecked; + } + + /** + * Get the recommendedActions property: Gets the recommended actions for this advisor. + * + * @return the recommendedActions value. + */ + public List recommendedActions() { + return this.recommendedActions; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoExecuteStatus() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property autoExecuteStatus in model AdvisorProperties")); + } + if (recommendedActions() != null) { + recommendedActions().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AdvisorProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AutomaticTuningServerProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AutomaticTuningServerProperties.java new file mode 100644 index 0000000000000..5e61d07800b2c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AutomaticTuningServerProperties.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.resourcemanager.sql.generated.models.AutomaticTuningServerMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerOptions; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Server-level Automatic Tuning properties. */ +@Fluent +public final class AutomaticTuningServerProperties { + /* + * Automatic tuning desired state. + */ + @JsonProperty(value = "desiredState") + private AutomaticTuningServerMode desiredState; + + /* + * Automatic tuning actual state. + */ + @JsonProperty(value = "actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningServerMode actualState; + + /* + * Automatic tuning options definition. + */ + @JsonProperty(value = "options") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + 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 AutomaticTuningServerProperties object itself. + */ + public AutomaticTuningServerProperties 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 AutomaticTuningServerProperties object itself. + */ + public AutomaticTuningServerProperties 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/AzureADOnlyAuthProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AzureADOnlyAuthProperties.java new file mode 100644 index 0000000000000..1352388a14545 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AzureADOnlyAuthProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a active directory only authentication. */ +@Fluent +public final class AzureADOnlyAuthProperties { + /* + * Azure Active Directory only Authentication enabled. + */ + @JsonProperty(value = "azureADOnlyAuthentication", required = true) + 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 AzureADOnlyAuthProperties object itself. + */ + public AzureADOnlyAuthProperties 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/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..2db543a5a3044 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.DiffBackupIntervalInHours; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A short term retention policy. */ +@Fluent +public final class BackupShortTermRetentionPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private BackupShortTermRetentionPolicyProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private BackupShortTermRetentionPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new BackupShortTermRetentionPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Get the diffBackupIntervalInHours property: The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only applicable to live databases but not + * dropped databases. + * + * @return the diffBackupIntervalInHours value. + */ + public DiffBackupIntervalInHours diffBackupIntervalInHours() { + return this.innerProperties() == null ? null : this.innerProperties().diffBackupIntervalInHours(); + } + + /** + * Set the diffBackupIntervalInHours property: The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only applicable to live databases but not + * dropped databases. + * + * @param diffBackupIntervalInHours the diffBackupIntervalInHours value to set. + * @return the BackupShortTermRetentionPolicyInner object itself. + */ + public BackupShortTermRetentionPolicyInner withDiffBackupIntervalInHours( + DiffBackupIntervalInHours diffBackupIntervalInHours) { + if (this.innerProperties() == null) { + this.innerProperties = new BackupShortTermRetentionPolicyProperties(); + } + this.innerProperties().withDiffBackupIntervalInHours(diffBackupIntervalInHours); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyProperties.java new file mode 100644 index 0000000000000..14c678b173830 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.DiffBackupIntervalInHours; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a short term retention policy. */ +@Fluent +public final class BackupShortTermRetentionPolicyProperties { + /* + * The backup retention period in days. This is how many days Point-in-Time + * Restore will be supported. + */ + @JsonProperty(value = "retentionDays") + private Integer retentionDays; + + /* + * The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only + * applicable to live databases but not dropped databases. + */ + @JsonProperty(value = "diffBackupIntervalInHours") + private DiffBackupIntervalInHours diffBackupIntervalInHours; + + /** + * 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 BackupShortTermRetentionPolicyProperties object itself. + */ + public BackupShortTermRetentionPolicyProperties withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the diffBackupIntervalInHours property: The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only applicable to live databases but not + * dropped databases. + * + * @return the diffBackupIntervalInHours value. + */ + public DiffBackupIntervalInHours diffBackupIntervalInHours() { + return this.diffBackupIntervalInHours; + } + + /** + * Set the diffBackupIntervalInHours property: The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only applicable to live databases but not + * dropped databases. + * + * @param diffBackupIntervalInHours the diffBackupIntervalInHours value to set. + * @return the BackupShortTermRetentionPolicyProperties object itself. + */ + public BackupShortTermRetentionPolicyProperties withDiffBackupIntervalInHours( + DiffBackupIntervalInHours diffBackupIntervalInHours) { + this.diffBackupIntervalInHours = diffBackupIntervalInHours; + 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/BaseLongTermRetentionPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BaseLongTermRetentionPolicyProperties.java new file mode 100644 index 0000000000000..c9c9cb92471a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BaseLongTermRetentionPolicyProperties.java @@ -0,0 +1,124 @@ +// Copyright (c) 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.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a long term retention policy. */ +@Fluent +public final class BaseLongTermRetentionPolicyProperties { + /* + * The weekly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "weeklyRetention") + private String weeklyRetention; + + /* + * The monthly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "monthlyRetention") + private String monthlyRetention; + + /* + * The yearly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "yearlyRetention") + private String yearlyRetention; + + /* + * The week of year to take the yearly backup in an ISO 8601 format. + */ + @JsonProperty(value = "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 BaseLongTermRetentionPolicyProperties object itself. + */ + public BaseLongTermRetentionPolicyProperties 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 BaseLongTermRetentionPolicyProperties object itself. + */ + public BaseLongTermRetentionPolicyProperties 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 BaseLongTermRetentionPolicyProperties object itself. + */ + public BaseLongTermRetentionPolicyProperties 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 BaseLongTermRetentionPolicyProperties object itself. + */ + public BaseLongTermRetentionPolicyProperties 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/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..5f7c44b4c0e1c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/CheckNameAvailabilityResponseInner.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The result of a name availability check. */ +@Immutable +public final class CheckNameAvailabilityResponseInner { + /* + * 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/CopyLongTermRetentionBackupParametersProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/CopyLongTermRetentionBackupParametersProperties.java new file mode 100644 index 0000000000000..8dbdd840965dd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/CopyLongTermRetentionBackupParametersProperties.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.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the properties to perform long term retention backup copy operation. */ +@Fluent +public final class CopyLongTermRetentionBackupParametersProperties { + /* + * The subscription that owns the target server + */ + @JsonProperty(value = "targetSubscriptionId") + private String targetSubscriptionId; + + /* + * The resource group that owns the target server + */ + @JsonProperty(value = "targetResourceGroup") + private String targetResourceGroup; + + /* + * The resource Id of the target server that owns the database + */ + @JsonProperty(value = "targetServerResourceId") + private String targetServerResourceId; + + /* + * The fully qualified domain name of the target server + */ + @JsonProperty(value = "targetServerFullyQualifiedDomainName") + private String targetServerFullyQualifiedDomainName; + + /* + * The name of the database owns the copied backup. + */ + @JsonProperty(value = "targetDatabaseName") + private String targetDatabaseName; + + /* + * The storage redundancy type of the copied backup + */ + @JsonProperty(value = "targetBackupStorageRedundancy") + private BackupStorageRedundancy 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 CopyLongTermRetentionBackupParametersProperties object itself. + */ + public CopyLongTermRetentionBackupParametersProperties 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 CopyLongTermRetentionBackupParametersProperties object itself. + */ + public CopyLongTermRetentionBackupParametersProperties 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 CopyLongTermRetentionBackupParametersProperties object itself. + */ + public CopyLongTermRetentionBackupParametersProperties 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 CopyLongTermRetentionBackupParametersProperties object itself. + */ + public CopyLongTermRetentionBackupParametersProperties 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 CopyLongTermRetentionBackupParametersProperties object itself. + */ + public CopyLongTermRetentionBackupParametersProperties 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 BackupStorageRedundancy 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 CopyLongTermRetentionBackupParametersProperties object itself. + */ + public CopyLongTermRetentionBackupParametersProperties withTargetBackupStorageRedundancy( + BackupStorageRedundancy 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/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..5ee9ed8f5aad9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyInner.java @@ -0,0 +1,139 @@ +// Copyright (c) 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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.DataMaskingState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a database data masking policy. */ +@Fluent +public final class DataMaskingPolicyInner extends ProxyResource { + /* + * The properties of the data masking policy. + */ + @JsonProperty(value = "properties") + private DataMaskingPolicyProperties innerProperties; + + /* + * 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; + + /** + * Get the innerProperties property: The properties of the data masking policy. + * + * @return the innerProperties value. + */ + private DataMaskingPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingPolicyProperties(); + } + this.innerProperties().withDataMaskingState(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingPolicyProperties(); + } + this.innerProperties().withExemptPrincipals(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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().maskingLevel(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyProperties.java new file mode 100644 index 0000000000000..ddcb30babecf1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyProperties.java @@ -0,0 +1,121 @@ +// Copyright (c) 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.DataMaskingState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a database data masking policy. */ +@Fluent +public final class DataMaskingPolicyProperties { + /* + * The state of the data masking policy. + */ + @JsonProperty(value = "dataMaskingState", required = true) + 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 = "exemptPrincipals") + private String exemptPrincipals; + + /* + * The list of the application principals. This is a legacy parameter and + * is no longer used. + */ + @JsonProperty(value = "applicationPrincipals", access = JsonProperty.Access.WRITE_ONLY) + private String applicationPrincipals; + + /* + * The masking level. This is a legacy parameter and is no longer used. + */ + @JsonProperty(value = "maskingLevel", access = JsonProperty.Access.WRITE_ONLY) + private String maskingLevel; + + /** + * 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 DataMaskingPolicyProperties object itself. + */ + public DataMaskingPolicyProperties 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 DataMaskingPolicyProperties object itself. + */ + public DataMaskingPolicyProperties 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() { + if (dataMaskingState() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property dataMaskingState in model DataMaskingPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DataMaskingPolicyProperties.class); +} 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..f647c08d170bd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.DataMaskingFunction; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRuleState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a database data masking rule. */ +@Fluent +public final class DataMaskingRuleInner extends ProxyResource { + /* + * The properties of the resource. + */ + @JsonProperty(value = "properties") + private DataMaskingRuleProperties innerProperties; + + /* + * 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; + + /** + * Get the innerProperties property: The properties of the resource. + * + * @return the innerProperties value. + */ + private DataMaskingRuleProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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 id property: The rule Id. + * + * @return the id value. + */ + public String idPropertiesId() { + return this.innerProperties() == null ? null : this.innerProperties().id(); + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withAliasName(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withRuleState(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withSchemaName(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withTableName(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withColumnName(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withMaskingFunction(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withNumberFrom(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withNumberTo(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withPrefixSize(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withSuffixSize(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withReplacementString(replacementString); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleProperties.java new file mode 100644 index 0000000000000..b37014a5804ba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +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.JsonProperty; + +/** The properties of a database data masking rule. */ +@Fluent +public final class DataMaskingRuleProperties { + /* + * The rule Id. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The alias name. This is a legacy parameter and is no longer used. + */ + @JsonProperty(value = "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 = "ruleState") + private DataMaskingRuleState ruleState; + + /* + * The schema name on which the data masking rule is applied. + */ + @JsonProperty(value = "schemaName", required = true) + private String schemaName; + + /* + * The table name on which the data masking rule is applied. + */ + @JsonProperty(value = "tableName", required = true) + private String tableName; + + /* + * The column name on which the data masking rule is applied. + */ + @JsonProperty(value = "columnName", required = true) + private String columnName; + + /* + * The masking function that is used for the data masking rule. + */ + @JsonProperty(value = "maskingFunction", required = true) + 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 = "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 = "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 = "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 = "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 = "replacementString") + private String replacementString; + + /** + * Get the id property: The rule Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties withReplacementString(String replacementString) { + this.replacementString = replacementString; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (schemaName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property schemaName in model DataMaskingRuleProperties")); + } + if (tableName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property tableName in model DataMaskingRuleProperties")); + } + if (columnName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property columnName in model DataMaskingRuleProperties")); + } + if (maskingFunction() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property maskingFunction in model DataMaskingRuleProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DataMaskingRuleProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataWarehouseUserActivitiesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataWarehouseUserActivitiesInner.java new file mode 100644 index 0000000000000..cca31b70b0dc4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataWarehouseUserActivitiesInner.java @@ -0,0 +1,48 @@ +// Copyright (c) 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.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** User activities of a data warehouse. */ +@Fluent +public final class DataWarehouseUserActivitiesInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DataWarehouseUserActivitiesProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DataWarehouseUserActivitiesProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the activeQueriesCount property: Count of running and suspended queries. + * + * @return the activeQueriesCount value. + */ + public Integer activeQueriesCount() { + return this.innerProperties() == null ? null : this.innerProperties().activeQueriesCount(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataWarehouseUserActivitiesProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataWarehouseUserActivitiesProperties.java new file mode 100644 index 0000000000000..0c93984c263a1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataWarehouseUserActivitiesProperties.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * User activities of a data warehouse. This currently includes the count of running or suspended queries. For more + * information, please view the sys.dm_pdw_exec_requests dynamic management view (DMV). + */ +@Immutable +public final class DataWarehouseUserActivitiesProperties { + /* + * Count of running and suspended queries. + */ + @JsonProperty(value = "activeQueriesCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer activeQueriesCount; + + /** + * Get the activeQueriesCount property: Count of running and suspended queries. + * + * @return the activeQueriesCount value. + */ + public Integer activeQueriesCount() { + return this.activeQueriesCount; + } + + /** + * 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..d02f6804d7f86 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptions; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Database-level Automatic Tuning. */ +@Fluent +public final class DatabaseAutomaticTuningInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseAutomaticTuningProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseAutomaticTuningProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the desiredState property: Automatic tuning desired state. + * + * @return the desiredState value. + */ + public AutomaticTuningMode desiredState() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAutomaticTuningProperties(); + } + this.innerProperties().withDesiredState(desiredState); + return this; + } + + /** + * Get the actualState property: Automatic tuning actual state. + * + * @return the actualState value. + */ + public AutomaticTuningMode actualState() { + return this.innerProperties() == null ? null : this.innerProperties().actualState(); + } + + /** + * Get the options property: Automatic tuning options definition. + * + * @return the options value. + */ + public Map options() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAutomaticTuningProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningProperties.java new file mode 100644 index 0000000000000..ebd3ef833d9cf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningProperties.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.resourcemanager.sql.generated.models.AutomaticTuningMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptions; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Database-level Automatic Tuning properties. */ +@Fluent +public final class DatabaseAutomaticTuningProperties { + /* + * Automatic tuning desired state. + */ + @JsonProperty(value = "desiredState") + private AutomaticTuningMode desiredState; + + /* + * Automatic tuning actual state. + */ + @JsonProperty(value = "actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningMode actualState; + + /* + * Automatic tuning options definition. + */ + @JsonProperty(value = "options") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + 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 DatabaseAutomaticTuningProperties object itself. + */ + public DatabaseAutomaticTuningProperties 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 DatabaseAutomaticTuningProperties object itself. + */ + public DatabaseAutomaticTuningProperties 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..a82fabe05fe9c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyInner.java @@ -0,0 +1,413 @@ +// Copyright (c) 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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** A database blob auditing policy. */ +@Fluent +public final class DatabaseBlobAuditingPolicyInner extends ProxyResource { + /* + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseBlobAuditingPolicyProperties innerProperties; + + /** + * Get the kind property: Resource kind. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseBlobAuditingPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withRetentionDays(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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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.innerProperties() == null ? null : this.innerProperties().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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withAuditActionsAndGroups(auditActionsAndGroups); + 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsStorageSecondaryKeyInUse(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsAzureMonitorTargetEnabled(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withQueueDelayMs(queueDelayMs); + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.innerProperties() == null ? null : this.innerProperties().isManagedIdentityInUse(); + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsManagedIdentityInUse(isManagedIdentityInUse); + 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.innerProperties() == null ? null : this.innerProperties().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 DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withState(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyProperties.java new file mode 100644 index 0000000000000..540622a6bec64 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyProperties.java @@ -0,0 +1,528 @@ +// Copyright (c) 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.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** Properties of a database blob auditing policy. */ +@Fluent +public final class DatabaseBlobAuditingPolicyProperties { + /* + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "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 + * DBCC_GROUP + * DATABASE_OWNERSHIP_CHANGE_GROUP + * DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 = "auditActionsAndGroups") + private List auditActionsAndGroups; + + /* + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "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 = "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 = "queueDelayMs") + private Integer queueDelayMs; + + /* + * Specifies whether Managed Identity is used to access blob storage + */ + @JsonProperty(value = "isManagedIdentityInUse") + private Boolean isManagedIdentityInUse; + + /* + * Specifies the state of the audit. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. + */ + @JsonProperty(value = "state", required = true) + 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 = "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 = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * 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 DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + 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 DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties 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 DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties 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 DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties withQueueDelayMs(Integer queueDelayMs) { + this.queueDelayMs = queueDelayMs; + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.isManagedIdentityInUse; + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.isManagedIdentityInUse = isManagedIdentityInUse; + 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 DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties 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 DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties 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 DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties 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 DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * 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 DatabaseBlobAuditingPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DatabaseBlobAuditingPolicyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseColumnInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseColumnInner.java new file mode 100644 index 0000000000000..ad5c8e227f976 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseColumnInner.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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ColumnDataType; +import com.azure.resourcemanager.sql.generated.models.TableTemporalType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A database column resource. */ +@Fluent +public final class DatabaseColumnInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseColumnProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseColumnProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the columnType property: The column data type. + * + * @return the columnType value. + */ + public ColumnDataType columnType() { + return this.innerProperties() == null ? null : this.innerProperties().columnType(); + } + + /** + * Set the columnType property: The column data type. + * + * @param columnType the columnType value to set. + * @return the DatabaseColumnInner object itself. + */ + public DatabaseColumnInner withColumnType(ColumnDataType columnType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseColumnProperties(); + } + this.innerProperties().withColumnType(columnType); + return this; + } + + /** + * Get the temporalType property: The table temporal type. + * + * @return the temporalType value. + */ + public TableTemporalType temporalType() { + return this.innerProperties() == null ? null : this.innerProperties().temporalType(); + } + + /** + * Set the temporalType property: The table temporal type. + * + * @param temporalType the temporalType value to set. + * @return the DatabaseColumnInner object itself. + */ + public DatabaseColumnInner withTemporalType(TableTemporalType temporalType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseColumnProperties(); + } + this.innerProperties().withTemporalType(temporalType); + return this; + } + + /** + * Get the memoryOptimized property: Whether or not the column belongs to a memory optimized table. + * + * @return the memoryOptimized value. + */ + public Boolean memoryOptimized() { + return this.innerProperties() == null ? null : this.innerProperties().memoryOptimized(); + } + + /** + * Set the memoryOptimized property: Whether or not the column belongs to a memory optimized table. + * + * @param memoryOptimized the memoryOptimized value to set. + * @return the DatabaseColumnInner object itself. + */ + public DatabaseColumnInner withMemoryOptimized(Boolean memoryOptimized) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseColumnProperties(); + } + this.innerProperties().withMemoryOptimized(memoryOptimized); + return this; + } + + /** + * Get the isComputed property: Whether or not the column is computed. + * + * @return the isComputed value. + */ + public Boolean isComputed() { + return this.innerProperties() == null ? null : this.innerProperties().isComputed(); + } + + /** + * Set the isComputed property: Whether or not the column is computed. + * + * @param isComputed the isComputed value to set. + * @return the DatabaseColumnInner object itself. + */ + public DatabaseColumnInner withIsComputed(Boolean isComputed) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseColumnProperties(); + } + this.innerProperties().withIsComputed(isComputed); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseColumnProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseColumnProperties.java new file mode 100644 index 0000000000000..df0d684a749d3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseColumnProperties.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.resourcemanager.sql.generated.models.ColumnDataType; +import com.azure.resourcemanager.sql.generated.models.TableTemporalType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Database column properties. */ +@Fluent +public final class DatabaseColumnProperties { + /* + * The column data type. + */ + @JsonProperty(value = "columnType") + private ColumnDataType columnType; + + /* + * The table temporal type. + */ + @JsonProperty(value = "temporalType") + private TableTemporalType temporalType; + + /* + * Whether or not the column belongs to a memory optimized table. + */ + @JsonProperty(value = "memoryOptimized") + private Boolean memoryOptimized; + + /* + * Whether or not the column is computed. + */ + @JsonProperty(value = "isComputed") + private Boolean isComputed; + + /** + * Get the columnType property: The column data type. + * + * @return the columnType value. + */ + public ColumnDataType columnType() { + return this.columnType; + } + + /** + * Set the columnType property: The column data type. + * + * @param columnType the columnType value to set. + * @return the DatabaseColumnProperties object itself. + */ + public DatabaseColumnProperties withColumnType(ColumnDataType columnType) { + this.columnType = columnType; + return this; + } + + /** + * Get the temporalType property: The table temporal type. + * + * @return the temporalType value. + */ + public TableTemporalType temporalType() { + return this.temporalType; + } + + /** + * Set the temporalType property: The table temporal type. + * + * @param temporalType the temporalType value to set. + * @return the DatabaseColumnProperties object itself. + */ + public DatabaseColumnProperties withTemporalType(TableTemporalType temporalType) { + this.temporalType = temporalType; + return this; + } + + /** + * Get the memoryOptimized property: Whether or not the column belongs to a memory optimized table. + * + * @return the memoryOptimized value. + */ + public Boolean memoryOptimized() { + return this.memoryOptimized; + } + + /** + * Set the memoryOptimized property: Whether or not the column belongs to a memory optimized table. + * + * @param memoryOptimized the memoryOptimized value to set. + * @return the DatabaseColumnProperties object itself. + */ + public DatabaseColumnProperties withMemoryOptimized(Boolean memoryOptimized) { + this.memoryOptimized = memoryOptimized; + return this; + } + + /** + * Get the isComputed property: Whether or not the column is computed. + * + * @return the isComputed value. + */ + public Boolean isComputed() { + return this.isComputed; + } + + /** + * Set the isComputed property: Whether or not the column is computed. + * + * @param isComputed the isComputed value to set. + * @return the DatabaseColumnProperties object itself. + */ + public DatabaseColumnProperties withIsComputed(Boolean isComputed) { + this.isComputed = isComputed; + 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/DatabaseExtensionsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseExtensionsProperties.java new file mode 100644 index 0000000000000..c91235fc06a00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseExtensionsProperties.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.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.OperationMode; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the database information after successful export. */ +@Fluent +public final class DatabaseExtensionsProperties { + /* + * Operation Mode. + */ + @JsonProperty(value = "operationMode", required = true) + private OperationMode operationMode; + + /* + * 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; + + /** + * Get the operationMode property: Operation Mode. + * + * @return the operationMode value. + */ + public OperationMode operationMode() { + return this.operationMode; + } + + /** + * Set the operationMode property: Operation Mode. + * + * @param operationMode the operationMode value to set. + * @return the DatabaseExtensionsProperties object itself. + */ + public DatabaseExtensionsProperties withOperationMode(OperationMode operationMode) { + this.operationMode = operationMode; + 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 DatabaseExtensionsProperties object itself. + */ + public DatabaseExtensionsProperties 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 DatabaseExtensionsProperties object itself. + */ + public DatabaseExtensionsProperties 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 DatabaseExtensionsProperties object itself. + */ + public DatabaseExtensionsProperties withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operationMode() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property operationMode in model DatabaseExtensionsProperties")); + } + if (storageKeyType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKeyType in model DatabaseExtensionsProperties")); + } + if (storageKey() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKey in model DatabaseExtensionsProperties")); + } + if (storageUri() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageUri in model DatabaseExtensionsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DatabaseExtensionsProperties.class); +} 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..a62a3d223ade1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseInner.java @@ -0,0 +1,1014 @@ +// Copyright (c) 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.management.Resource; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.CreateMode; +import com.azure.resourcemanager.sql.generated.models.DatabaseIdentity; +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.SampleName; +import com.azure.resourcemanager.sql.generated.models.SecondaryType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; +import java.util.UUID; + +/** A database resource. */ +@Fluent +public final class DatabaseInner extends Resource { + /* + * 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; + + /* + * The Azure Active Directory identity of the database. + */ + @JsonProperty(value = "identity") + private DatabaseIdentity identity; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseProperties innerProperties; + + /** + * 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 identity property: The Azure Active Directory identity of the database. + * + * @return the identity value. + */ + public DatabaseIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The Azure Active Directory identity of the database. + * + * @param identity the identity value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withIdentity(DatabaseIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public DatabaseInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabaseInner withTags(Map tags) { + super.withTags(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withCreateMode(createMode); + return this; + } + + /** + * Get the collation property: The collation of the database. + * + * @return the collation value. + */ + public String collation() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withCollation(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withMaxSizeBytes(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withSampleName(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withElasticPoolId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withSourceDatabaseId(sourceDatabaseId); + return this; + } + + /** + * Get the status property: The status of the database. + * + * @return the status value. + */ + public DatabaseStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the databaseId property: The ID of the database. + * + * @return the databaseId value. + */ + public UUID databaseId() { + return this.innerProperties() == null ? null : this.innerProperties().databaseId(); + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the currentServiceObjectiveName property: The current service level objective name of the database. + * + * @return the currentServiceObjectiveName value. + */ + public String currentServiceObjectiveName() { + return this.innerProperties() == null ? null : this.innerProperties().currentServiceObjectiveName(); + } + + /** + * Get the requestedServiceObjectiveName property: The requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value. + */ + public String requestedServiceObjectiveName() { + return this.innerProperties() == null ? null : this.innerProperties().requestedServiceObjectiveName(); + } + + /** + * Get the defaultSecondaryLocation property: The default secondary region for this database. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.innerProperties() == null ? null : this.innerProperties().defaultSecondaryLocation(); + } + + /** + * Get the failoverGroupId property: Failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value. + */ + public String failoverGroupId() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withRestorePointInTime(restorePointInTime); + return this; + } + + /** + * Get the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value. + */ + public OffsetDateTime sourceDatabaseDeletionDate() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withSourceDatabaseDeletionDate(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withRecoveryServicesRecoveryPointId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withLongTermRetentionBackupResourceId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withRecoverableDatabaseId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + return this; + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withCatalogCollation(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withZoneRedundant(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the maxLogSizeBytes property: The max log size for this database. + * + * @return the maxLogSizeBytes value. + */ + public Long maxLogSizeBytes() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @return the readScale value. + */ + public DatabaseReadScale readScale() { + return this.innerProperties() == null ? null : this.innerProperties().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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @param readScale the readScale value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withReadScale(DatabaseReadScale readScale) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withReadScale(readScale); + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.innerProperties() == null ? null : this.innerProperties().highAvailabilityReplicaCount(); + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withHighAvailabilityReplicaCount(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withSecondaryType(secondaryType); + return this; + } + + /** + * Get the currentSku property: The name and tier of the SKU. + * + * @return the currentSku value. + */ + public Sku currentSku() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withAutoPauseDelay(autoPauseDelay); + return this; + } + + /** + * Get the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * database. + * + * @return the currentBackupStorageRedundancy value. + */ + public BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().currentBackupStorageRedundancy(); + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().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( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withRequestedBackupStorageRedundancy(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withMinCapacity(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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + + /** + * Get the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @return the isLedgerOn value. + */ + public Boolean isLedgerOn() { + return this.innerProperties() == null ? null : this.innerProperties().isLedgerOn(); + } + + /** + * Set the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @param isLedgerOn the isLedgerOn value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withIsLedgerOn(Boolean isLedgerOn) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withIsLedgerOn(isLedgerOn); + return this; + } + + /** + * Get the isInfraEncryptionEnabled property: Infra encryption is enabled for this database. + * + * @return the isInfraEncryptionEnabled value. + */ + public Boolean isInfraEncryptionEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isInfraEncryptionEnabled(); + } + + /** + * Get the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @return the federatedClientId value. + */ + public UUID federatedClientId() { + return this.innerProperties() == null ? null : this.innerProperties().federatedClientId(); + } + + /** + * Set the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withFederatedClientId(UUID federatedClientId) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withFederatedClientId(federatedClientId); + return this; + } + + /** + * Get the sourceResourceId property: The resource identifier of the source associated with the create operation of + * this database. + * + *

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and + * sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + * + *

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of an existing database or + * existing sql pool, and restorePointInTime must be specified. + * + *

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or + * restorable dropped sql pool. + * + *

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable + * sql pool. + * + *

This property allows to restore across subscriptions which is only supported for DataWarehouse edition. + * + *

When source subscription belongs to a different tenant than target subscription, + * “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details + * about “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceResourceId(); + } + + /** + * Set the sourceResourceId property: The resource identifier of the source associated with the create operation of + * this database. + * + *

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and + * sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + * + *

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of an existing database or + * existing sql pool, and restorePointInTime must be specified. + * + *

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or + * restorable dropped sql pool. + * + *

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable + * sql pool. + * + *

This property allows to restore across subscriptions which is only supported for DataWarehouse edition. + * + *

When source subscription belongs to a different tenant than target subscription, + * “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details + * about “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. + * + * @param sourceResourceId the sourceResourceId value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSourceResourceId(String sourceResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withSourceResourceId(sourceResourceId); + 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 (innerProperties() != null) { + innerProperties().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..d39c336cb7679 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A database operation. */ +@Fluent +public final class DatabaseOperationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseOperationProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseOperationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the databaseName property: The name of the database the operation is being performed on. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.innerProperties() == null ? null : this.innerProperties().operation(); + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.innerProperties() == null ? null : this.innerProperties().operationFriendlyName(); + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Get the serverName property: The name of the server. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public ManagementOperationState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.innerProperties() == null ? null : this.innerProperties().errorDescription(); + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.innerProperties() == null ? null : this.innerProperties().errorSeverity(); + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.innerProperties() == null ? null : this.innerProperties().isUserError(); + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().estimatedCompletionTime(); + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.innerProperties() == null ? null : this.innerProperties().isCancellable(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationProperties.java new file mode 100644 index 0000000000000..d8138f6411b28 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationProperties.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a database operation. */ +@Immutable +public final class DatabaseOperationProperties { + /* + * The name of the database the operation is being performed on. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The name of operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The friendly name of operation. + */ + @JsonProperty(value = "operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /* + * The percentage of the operation completed. + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The name of the server. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The operation start time. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The operation state. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private ManagementOperationState state; + + /* + * The operation error code. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The operation error description. + */ + @JsonProperty(value = "errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /* + * The operation error severity. + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * Whether or not the error is a user error. + */ + @JsonProperty(value = "isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /* + * The estimated completion time of the operation. + */ + @JsonProperty(value = "estimatedCompletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime estimatedCompletionTime; + + /* + * The operation description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Whether the operation can be cancelled. + */ + @JsonProperty(value = "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/DatabaseProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseProperties.java new file mode 100644 index 0000000000000..5bfcb333fa6f1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseProperties.java @@ -0,0 +1,1105 @@ +// Copyright (c) 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.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.CreateMode; +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.SampleName; +import com.azure.resourcemanager.sql.generated.models.SecondaryType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** The database's properties. */ +@Fluent +public final class DatabaseProperties { + /* + * 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 = "createMode") + private CreateMode createMode; + + /* + * The collation of the database. + */ + @JsonProperty(value = "collation") + private String collation; + + /* + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "maxSizeBytes") + private Long maxSizeBytes; + + /* + * The name of the sample schema to apply when creating this database. + */ + @JsonProperty(value = "sampleName") + private SampleName sampleName; + + /* + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "elasticPoolId") + private String elasticPoolId; + + /* + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "sourceDatabaseId") + private String sourceDatabaseId; + + /* + * The status of the database. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /* + * The ID of the database. + */ + @JsonProperty(value = "databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /* + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The current service level objective name of the database. + */ + @JsonProperty(value = "currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /* + * The requested service level objective name of the database. + */ + @JsonProperty(value = "requestedServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjectiveName; + + /* + * The default secondary region for this database. + */ + @JsonProperty(value = "defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /* + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "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 = "restorePointInTime") + private OffsetDateTime restorePointInTime; + + /* + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "sourceDatabaseDeletionDate") + private OffsetDateTime sourceDatabaseDeletionDate; + + /* + * The resource identifier of the recovery point associated with create + * operation of this database. + */ + @JsonProperty(value = "recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /* + * The resource identifier of the long term retention backup associated + * with create operation of this database. + */ + @JsonProperty(value = "longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /* + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "recoverableDatabaseId") + private String recoverableDatabaseId; + + /* + * The resource identifier of the restorable dropped database associated + * with create operation of this database. + */ + @JsonProperty(value = "restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /* + * Collation of the metadata catalog. + */ + @JsonProperty(value = "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 = "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 = "licenseType") + private DatabaseLicenseType licenseType; + + /* + * The max log size for this database. + */ + @JsonProperty(value = "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 = "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. Not + * applicable to a Hyperscale database within an elastic pool. + */ + @JsonProperty(value = "readScale") + private DatabaseReadScale readScale; + + /* + * The number of secondary replicas associated with the database that are + * used to provide high availability. Not applicable to a Hyperscale + * database within an elastic pool. + */ + @JsonProperty(value = "highAvailabilityReplicaCount") + private Integer highAvailabilityReplicaCount; + + /* + * The secondary type of the database if it is a secondary. Valid values + * are Geo and Named. + */ + @JsonProperty(value = "secondaryType") + private SecondaryType secondaryType; + + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "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 = "autoPauseDelay") + private Integer autoPauseDelay; + + /* + * The storage account type used to store backups for this database. + */ + @JsonProperty(value = "currentBackupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy currentBackupStorageRedundancy; + + /* + * The storage account type to be used to store backups for this database. + */ + @JsonProperty(value = "requestedBackupStorageRedundancy") + private BackupStorageRedundancy requestedBackupStorageRedundancy; + + /* + * Minimal capacity that database will always have allocated, if not paused + */ + @JsonProperty(value = "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 = "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 = "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 = "maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /* + * Whether or not this database is a ledger database, which means all + * tables in the database are ledger tables. Note: the value of this + * property cannot be changed after the database has been created. + */ + @JsonProperty(value = "isLedgerOn") + private Boolean isLedgerOn; + + /* + * Infra encryption is enabled for this database. + */ + @JsonProperty(value = "isInfraEncryptionEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isInfraEncryptionEnabled; + + /* + * The Client id used for cross tenant per database CMK scenario + */ + @JsonProperty(value = "federatedClientId") + private UUID federatedClientId; + + /* + * The resource identifier of the source associated with the create + * operation of this database. + * + * When sourceResourceId is specified, sourceDatabaseId, + * recoverableDatabaseId, restorableDroppedDatabaseId and + * sourceDatabaseDeletionDate must not be specified and CreateMode must be + * PointInTimeRestore, Restore or Recover. + * + * When createMode is PointInTimeRestore, sourceResourceId must be the + * resource ID of an existing database or existing sql pool, and + * restorePointInTime must be specified. + * + * When createMode is Restore, sourceResourceId must be the resource ID of + * restorable dropped database or restorable dropped sql pool. + * + * When createMode is Recover, sourceResourceId must be the resource ID of + * recoverable database or recoverable sql pool. + * + * This property allows to restore across subscriptions which is only + * supported for DataWarehouse edition. + * + * When source subscription belongs to a different tenant than target + * subscription, “x-ms-authorization-auxiliary” header must contain + * authentication token for the source tenant. For more details about + * “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant + */ + @JsonProperty(value = "sourceResourceId") + private String sourceResourceId; + + /** + * 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @param readScale the readScale value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties 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. Not applicable to a Hyperscale database within an elastic pool. + * + * @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. Not applicable to a Hyperscale database within an elastic pool. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 BackupStorageRedundancy 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 BackupStorageRedundancy 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 DatabaseProperties object itself. + */ + public DatabaseProperties withRequestedBackupStorageRedundancy( + BackupStorageRedundancy 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 DatabaseProperties object itself. + */ + public DatabaseProperties 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 DatabaseProperties object itself. + */ + public DatabaseProperties withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Get the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @return the isLedgerOn value. + */ + public Boolean isLedgerOn() { + return this.isLedgerOn; + } + + /** + * Set the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @param isLedgerOn the isLedgerOn value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withIsLedgerOn(Boolean isLedgerOn) { + this.isLedgerOn = isLedgerOn; + return this; + } + + /** + * Get the isInfraEncryptionEnabled property: Infra encryption is enabled for this database. + * + * @return the isInfraEncryptionEnabled value. + */ + public Boolean isInfraEncryptionEnabled() { + return this.isInfraEncryptionEnabled; + } + + /** + * Get the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @return the federatedClientId value. + */ + public UUID federatedClientId() { + return this.federatedClientId; + } + + /** + * Set the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withFederatedClientId(UUID federatedClientId) { + this.federatedClientId = federatedClientId; + return this; + } + + /** + * Get the sourceResourceId property: The resource identifier of the source associated with the create operation of + * this database. + * + *

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and + * sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + * + *

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of an existing database or + * existing sql pool, and restorePointInTime must be specified. + * + *

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or + * restorable dropped sql pool. + * + *

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable + * sql pool. + * + *

This property allows to restore across subscriptions which is only supported for DataWarehouse edition. + * + *

When source subscription belongs to a different tenant than target subscription, + * “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details + * about “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.sourceResourceId; + } + + /** + * Set the sourceResourceId property: The resource identifier of the source associated with the create operation of + * this database. + * + *

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and + * sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + * + *

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of an existing database or + * existing sql pool, and restorePointInTime must be specified. + * + *

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or + * restorable dropped sql pool. + * + *

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable + * sql pool. + * + *

This property allows to restore across subscriptions which is only supported for DataWarehouse edition. + * + *

When source subscription belongs to a different tenant than target subscription, + * “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details + * about “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. + * + * @param sourceResourceId the sourceResourceId value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withSourceResourceId(String sourceResourceId) { + this.sourceResourceId = sourceResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void 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/DatabaseSchemaInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSchemaInner.java new file mode 100644 index 0000000000000..b2a4d18803f8b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSchemaInner.java @@ -0,0 +1,20 @@ +// Copyright (c) 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; + +/** A database schema resource. */ +@Immutable +public final class DatabaseSchemaInner extends ProxyResource { + /** + * 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..5c843e3a81dab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSecurityAlertPolicyInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A database security alert policy. */ +@Fluent +public final class DatabaseSecurityAlertPolicyInner extends ProxyResource { + /* + * SystemData of SecurityAlertPolicyResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SecurityAlertsPolicyProperties innerProperties; + + /** + * Get the systemData property: SystemData of SecurityAlertPolicyResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SecurityAlertsPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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 SecurityAlertsPolicyState state() { + return this.innerProperties() == null ? null : this.innerProperties().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 DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withState(SecurityAlertsPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withState(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, Brute_Force. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.innerProperties() == null ? null : this.innerProperties().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, Brute_Force. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withDisabledAlerts(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.innerProperties() == null ? null : this.innerProperties().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 DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withEmailAddresses(List emailAddresses) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withEmailAddresses(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.innerProperties() == null ? null : this.innerProperties().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(Boolean emailAccountAdmins) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withEmailAccountAdmins(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.innerProperties() == null ? null : this.innerProperties().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 DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(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.innerProperties() == null ? null : this.innerProperties().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 DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.innerProperties() == null ? null : this.innerProperties().creationTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseTableInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseTableInner.java new file mode 100644 index 0000000000000..e3bbb08afe488 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseTableInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.TableTemporalType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A database table resource. */ +@Fluent +public final class DatabaseTableInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseTableProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseTableProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the temporalType property: The table temporal type. + * + * @return the temporalType value. + */ + public TableTemporalType temporalType() { + return this.innerProperties() == null ? null : this.innerProperties().temporalType(); + } + + /** + * Set the temporalType property: The table temporal type. + * + * @param temporalType the temporalType value to set. + * @return the DatabaseTableInner object itself. + */ + public DatabaseTableInner withTemporalType(TableTemporalType temporalType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseTableProperties(); + } + this.innerProperties().withTemporalType(temporalType); + return this; + } + + /** + * Get the memoryOptimized property: Whether or not the table is memory optimized. + * + * @return the memoryOptimized value. + */ + public Boolean memoryOptimized() { + return this.innerProperties() == null ? null : this.innerProperties().memoryOptimized(); + } + + /** + * Set the memoryOptimized property: Whether or not the table is memory optimized. + * + * @param memoryOptimized the memoryOptimized value to set. + * @return the DatabaseTableInner object itself. + */ + public DatabaseTableInner withMemoryOptimized(Boolean memoryOptimized) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseTableProperties(); + } + this.innerProperties().withMemoryOptimized(memoryOptimized); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseTableProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseTableProperties.java new file mode 100644 index 0000000000000..70e7610376eb2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseTableProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.TableTemporalType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Database table properties. */ +@Fluent +public final class DatabaseTableProperties { + /* + * The table temporal type. + */ + @JsonProperty(value = "temporalType") + private TableTemporalType temporalType; + + /* + * Whether or not the table is memory optimized. + */ + @JsonProperty(value = "memoryOptimized") + private Boolean memoryOptimized; + + /** + * Get the temporalType property: The table temporal type. + * + * @return the temporalType value. + */ + public TableTemporalType temporalType() { + return this.temporalType; + } + + /** + * Set the temporalType property: The table temporal type. + * + * @param temporalType the temporalType value to set. + * @return the DatabaseTableProperties object itself. + */ + public DatabaseTableProperties withTemporalType(TableTemporalType temporalType) { + this.temporalType = temporalType; + return this; + } + + /** + * Get the memoryOptimized property: Whether or not the table is memory optimized. + * + * @return the memoryOptimized value. + */ + public Boolean memoryOptimized() { + return this.memoryOptimized; + } + + /** + * Set the memoryOptimized property: Whether or not the table is memory optimized. + * + * @param memoryOptimized the memoryOptimized value to set. + * @return the DatabaseTableProperties object itself. + */ + public DatabaseTableProperties withMemoryOptimized(Boolean memoryOptimized) { + this.memoryOptimized = memoryOptimized; + 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/DatabaseUpdateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUpdateProperties.java new file mode 100644 index 0000000000000..4b234872acb8f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUpdateProperties.java @@ -0,0 +1,1014 @@ +// Copyright (c) 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.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.CreateMode; +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.SampleName; +import com.azure.resourcemanager.sql.generated.models.SecondaryType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** A database update properties. */ +@Fluent +public final class DatabaseUpdateProperties { + /* + * 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 = "createMode") + private CreateMode createMode; + + /* + * The collation of the database. + */ + @JsonProperty(value = "collation") + private String collation; + + /* + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "maxSizeBytes") + private Long maxSizeBytes; + + /* + * The name of the sample schema to apply when creating this database. + */ + @JsonProperty(value = "sampleName") + private SampleName sampleName; + + /* + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "elasticPoolId") + private String elasticPoolId; + + /* + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "sourceDatabaseId") + private String sourceDatabaseId; + + /* + * The status of the database. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /* + * The ID of the database. + */ + @JsonProperty(value = "databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /* + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The current service level objective name of the database. + */ + @JsonProperty(value = "currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /* + * The requested service level objective name of the database. + */ + @JsonProperty(value = "requestedServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjectiveName; + + /* + * The default secondary region for this database. + */ + @JsonProperty(value = "defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /* + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "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 = "restorePointInTime") + private OffsetDateTime restorePointInTime; + + /* + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "sourceDatabaseDeletionDate") + private OffsetDateTime sourceDatabaseDeletionDate; + + /* + * The resource identifier of the recovery point associated with create + * operation of this database. + */ + @JsonProperty(value = "recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /* + * The resource identifier of the long term retention backup associated + * with create operation of this database. + */ + @JsonProperty(value = "longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /* + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "recoverableDatabaseId") + private String recoverableDatabaseId; + + /* + * The resource identifier of the restorable dropped database associated + * with create operation of this database. + */ + @JsonProperty(value = "restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /* + * Collation of the metadata catalog. + */ + @JsonProperty(value = "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 = "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 = "licenseType") + private DatabaseLicenseType licenseType; + + /* + * The max log size for this database. + */ + @JsonProperty(value = "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 = "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. Not + * applicable to a Hyperscale database within an elastic pool. + */ + @JsonProperty(value = "readScale") + private DatabaseReadScale readScale; + + /* + * The number of secondary replicas associated with the database that are + * used to provide high availability. Not applicable to a Hyperscale + * database within an elastic pool. + */ + @JsonProperty(value = "highAvailabilityReplicaCount") + private Integer highAvailabilityReplicaCount; + + /* + * The secondary type of the database if it is a secondary. Valid values + * are Geo and Named. + */ + @JsonProperty(value = "secondaryType") + private SecondaryType secondaryType; + + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "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 = "autoPauseDelay") + private Integer autoPauseDelay; + + /* + * The storage account type used to store backups for this database. + */ + @JsonProperty(value = "currentBackupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy currentBackupStorageRedundancy; + + /* + * The storage account type to be used to store backups for this database. + */ + @JsonProperty(value = "requestedBackupStorageRedundancy") + private BackupStorageRedundancy requestedBackupStorageRedundancy; + + /* + * Minimal capacity that database will always have allocated, if not paused + */ + @JsonProperty(value = "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 = "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 = "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 = "maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /* + * Whether or not this database is a ledger database, which means all + * tables in the database are ledger tables. Note: the value of this + * property cannot be changed after the database has been created. + */ + @JsonProperty(value = "isLedgerOn") + private Boolean isLedgerOn; + + /* + * Infra encryption is enabled for this database. + */ + @JsonProperty(value = "isInfraEncryptionEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isInfraEncryptionEnabled; + + /* + * The Client id used for cross tenant per database CMK scenario + */ + @JsonProperty(value = "federatedClientId") + private UUID federatedClientId; + + /** + * 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @param readScale the readScale value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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. Not applicable to a Hyperscale database within an elastic pool. + * + * @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. Not applicable to a Hyperscale database within an elastic pool. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 BackupStorageRedundancy 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 BackupStorageRedundancy 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withRequestedBackupStorageRedundancy( + BackupStorageRedundancy 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Get the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @return the isLedgerOn value. + */ + public Boolean isLedgerOn() { + return this.isLedgerOn; + } + + /** + * Set the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @param isLedgerOn the isLedgerOn value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withIsLedgerOn(Boolean isLedgerOn) { + this.isLedgerOn = isLedgerOn; + return this; + } + + /** + * Get the isInfraEncryptionEnabled property: Infra encryption is enabled for this database. + * + * @return the isInfraEncryptionEnabled value. + */ + public Boolean isInfraEncryptionEnabled() { + return this.isInfraEncryptionEnabled; + } + + /** + * Get the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @return the federatedClientId value. + */ + public UUID federatedClientId() { + return this.federatedClientId; + } + + /** + * Set the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withFederatedClientId(UUID federatedClientId) { + this.federatedClientId = federatedClientId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void 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/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..7eedea2165fa7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Usage metric of a database. */ +@Fluent +public final class DatabaseUsageInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseUsageProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseUsageProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the displayName property: User-readable name of the metric. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Get the currentValue property: Current value of the metric. + * + * @return the currentValue value. + */ + public Double currentValue() { + return this.innerProperties() == null ? null : this.innerProperties().currentValue(); + } + + /** + * Get the limit property: Boundary value of the metric. + * + * @return the limit value. + */ + public Double limit() { + return this.innerProperties() == null ? null : this.innerProperties().limit(); + } + + /** + * Get the unit property: Unit of the metric. + * + * @return the unit value. + */ + public String unit() { + return this.innerProperties() == null ? null : this.innerProperties().unit(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageProperties.java new file mode 100644 index 0000000000000..f1d6c2e8d47ec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageProperties.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.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a database usage. */ +@Immutable +public final class DatabaseUsageProperties { + /* + * User-readable name of the metric. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * Current value of the metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /* + * Boundary value of the metric. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /* + * Unit of the metric. + */ + @JsonProperty(value = "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/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..b8f281d63b30c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A database vulnerability assessment. */ +@Fluent +public final class DatabaseVulnerabilityAssessmentInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseVulnerabilityAssessmentProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseVulnerabilityAssessmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageContainerPath(storageContainerPath); + return this; + } + + /** + * Get the storageContainerSasKey property: A shared access signature (SAS Key) that has 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.innerProperties() == null ? null : this.innerProperties().storageContainerSasKey(); + } + + /** + * Set the storageContainerSasKey property: A shared access signature (SAS Key) that has 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageContainerSasKey(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseVulnerabilityAssessmentProperties(); + } + this.innerProperties().withRecurringScans(recurringScans); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentProperties.java new file mode 100644 index 0000000000000..279ea385654e0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentProperties.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.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a database Vulnerability Assessment. */ +@Fluent +public final class DatabaseVulnerabilityAssessmentProperties { + /* + * 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 = "storageContainerPath") + private String storageContainerPath; + + /* + * A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If + * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is + * required. + */ + @JsonProperty(value = "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 = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * The recurring scans settings + */ + @JsonProperty(value = "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 DatabaseVulnerabilityAssessmentProperties object itself. + */ + public DatabaseVulnerabilityAssessmentProperties withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * Get the storageContainerSasKey property: A shared access signature (SAS Key) that has 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 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 DatabaseVulnerabilityAssessmentProperties object itself. + */ + public DatabaseVulnerabilityAssessmentProperties 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 DatabaseVulnerabilityAssessmentProperties object itself. + */ + public DatabaseVulnerabilityAssessmentProperties 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 DatabaseVulnerabilityAssessmentProperties object itself. + */ + public DatabaseVulnerabilityAssessmentProperties 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..019b0cd27b6e4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A database vulnerability assessment rule baseline. */ +@Fluent +public final class DatabaseVulnerabilityAssessmentRuleBaselineInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseVulnerabilityAssessmentRuleBaselineProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseVulnerabilityAssessmentRuleBaselineProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the baselineResults property: The rule baseline result. + * + * @return the baselineResults value. + */ + public List baselineResults() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseVulnerabilityAssessmentRuleBaselineProperties(); + } + this.innerProperties().withBaselineResults(baselineResults); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineProperties.java new file mode 100644 index 0000000000000..8fd67afb5293c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a database Vulnerability Assessment rule baseline. */ +@Fluent +public final class DatabaseVulnerabilityAssessmentRuleBaselineProperties { + /* + * The rule baseline result + */ + @JsonProperty(value = "baselineResults", required = true) + 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 DatabaseVulnerabilityAssessmentRuleBaselineProperties object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineProperties 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property baselineResults in model" + + " DatabaseVulnerabilityAssessmentRuleBaselineProperties")); + } else { + baselineResults().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = + new ClientLogger(DatabaseVulnerabilityAssessmentRuleBaselineProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScanExportProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScanExportProperties.java new file mode 100644 index 0000000000000..8b43f3385eb7c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScanExportProperties.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the export operation's result. */ +@Immutable +public final class DatabaseVulnerabilityAssessmentScanExportProperties { + /* + * Location of the exported report (e.g. + * https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + */ + @JsonProperty(value = "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/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..dbeda4886f96a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScansExportInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A database Vulnerability Assessment scan export resource. */ +@Fluent +public final class DatabaseVulnerabilityAssessmentScansExportInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseVulnerabilityAssessmentScanExportProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseVulnerabilityAssessmentScanExportProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().exportedReportLocation(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DeletedServerInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DeletedServerInner.java new file mode 100644 index 0000000000000..75abaa6bbcfaf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DeletedServerInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A deleted server. */ +@Fluent +public final class DeletedServerInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DeletedServerProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DeletedServerProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the version property: The version of the deleted server. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Get the deletionTime property: The deletion time of the deleted server. + * + * @return the deletionTime value. + */ + public OffsetDateTime deletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().deletionTime(); + } + + /** + * Get the originalId property: The original ID of the server before deletion. + * + * @return the originalId value. + */ + public String originalId() { + return this.innerProperties() == null ? null : this.innerProperties().originalId(); + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().fullyQualifiedDomainName(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DeletedServerProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DeletedServerProperties.java new file mode 100644 index 0000000000000..16e303965e16c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DeletedServerProperties.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.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a deleted server. */ +@Immutable +public final class DeletedServerProperties { + /* + * The version of the deleted server. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /* + * The deletion time of the deleted server. + */ + @JsonProperty(value = "deletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime deletionTime; + + /* + * The original ID of the server before deletion. + */ + @JsonProperty(value = "originalId", access = JsonProperty.Access.WRITE_ONLY) + private String originalId; + + /* + * The fully qualified domain name of the server. + */ + @JsonProperty(value = "fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** + * Get the version property: The version of the deleted server. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the deletionTime property: The deletion time of the deleted server. + * + * @return the deletionTime value. + */ + public OffsetDateTime deletionTime() { + return this.deletionTime; + } + + /** + * Get the originalId property: The original ID of the server before deletion. + * + * @return the originalId value. + */ + public String originalId() { + return this.originalId; + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * 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/DistributedAvailabilityGroupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DistributedAvailabilityGroupInner.java new file mode 100644 index 0000000000000..115df84ef4d81 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DistributedAvailabilityGroupInner.java @@ -0,0 +1,203 @@ +// Copyright (c) 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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ReplicationMode; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Distributed availability group between box and Sql Managed Instance. */ +@Fluent +public final class DistributedAvailabilityGroupInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DistributedAvailabilityGroupProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DistributedAvailabilityGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the targetDatabase property: The name of the target database. + * + * @return the targetDatabase value. + */ + public String targetDatabase() { + return this.innerProperties() == null ? null : this.innerProperties().targetDatabase(); + } + + /** + * Set the targetDatabase property: The name of the target database. + * + * @param targetDatabase the targetDatabase value to set. + * @return the DistributedAvailabilityGroupInner object itself. + */ + public DistributedAvailabilityGroupInner withTargetDatabase(String targetDatabase) { + if (this.innerProperties() == null) { + this.innerProperties = new DistributedAvailabilityGroupProperties(); + } + this.innerProperties().withTargetDatabase(targetDatabase); + return this; + } + + /** + * Get the sourceEndpoint property: The source endpoint. + * + * @return the sourceEndpoint value. + */ + public String sourceEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().sourceEndpoint(); + } + + /** + * Set the sourceEndpoint property: The source endpoint. + * + * @param sourceEndpoint the sourceEndpoint value to set. + * @return the DistributedAvailabilityGroupInner object itself. + */ + public DistributedAvailabilityGroupInner withSourceEndpoint(String sourceEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new DistributedAvailabilityGroupProperties(); + } + this.innerProperties().withSourceEndpoint(sourceEndpoint); + return this; + } + + /** + * Get the primaryAvailabilityGroupName property: The primary availability group name. + * + * @return the primaryAvailabilityGroupName value. + */ + public String primaryAvailabilityGroupName() { + return this.innerProperties() == null ? null : this.innerProperties().primaryAvailabilityGroupName(); + } + + /** + * Set the primaryAvailabilityGroupName property: The primary availability group name. + * + * @param primaryAvailabilityGroupName the primaryAvailabilityGroupName value to set. + * @return the DistributedAvailabilityGroupInner object itself. + */ + public DistributedAvailabilityGroupInner withPrimaryAvailabilityGroupName(String primaryAvailabilityGroupName) { + if (this.innerProperties() == null) { + this.innerProperties = new DistributedAvailabilityGroupProperties(); + } + this.innerProperties().withPrimaryAvailabilityGroupName(primaryAvailabilityGroupName); + return this; + } + + /** + * Get the secondaryAvailabilityGroupName property: The secondary availability group name. + * + * @return the secondaryAvailabilityGroupName value. + */ + public String secondaryAvailabilityGroupName() { + return this.innerProperties() == null ? null : this.innerProperties().secondaryAvailabilityGroupName(); + } + + /** + * Set the secondaryAvailabilityGroupName property: The secondary availability group name. + * + * @param secondaryAvailabilityGroupName the secondaryAvailabilityGroupName value to set. + * @return the DistributedAvailabilityGroupInner object itself. + */ + public DistributedAvailabilityGroupInner withSecondaryAvailabilityGroupName(String secondaryAvailabilityGroupName) { + if (this.innerProperties() == null) { + this.innerProperties = new DistributedAvailabilityGroupProperties(); + } + this.innerProperties().withSecondaryAvailabilityGroupName(secondaryAvailabilityGroupName); + return this; + } + + /** + * Get the replicationMode property: The replication mode of a distributed availability group. Parameter will be + * ignored during link creation. + * + * @return the replicationMode value. + */ + public ReplicationMode replicationMode() { + return this.innerProperties() == null ? null : this.innerProperties().replicationMode(); + } + + /** + * Set the replicationMode property: The replication mode of a distributed availability group. Parameter will be + * ignored during link creation. + * + * @param replicationMode the replicationMode value to set. + * @return the DistributedAvailabilityGroupInner object itself. + */ + public DistributedAvailabilityGroupInner withReplicationMode(ReplicationMode replicationMode) { + if (this.innerProperties() == null) { + this.innerProperties = new DistributedAvailabilityGroupProperties(); + } + this.innerProperties().withReplicationMode(replicationMode); + return this; + } + + /** + * Get the distributedAvailabilityGroupId property: The distributed availability group id. + * + * @return the distributedAvailabilityGroupId value. + */ + public UUID distributedAvailabilityGroupId() { + return this.innerProperties() == null ? null : this.innerProperties().distributedAvailabilityGroupId(); + } + + /** + * Get the sourceReplicaId property: The source replica id. + * + * @return the sourceReplicaId value. + */ + public UUID sourceReplicaId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceReplicaId(); + } + + /** + * Get the targetReplicaId property: The target replica id. + * + * @return the targetReplicaId value. + */ + public UUID targetReplicaId() { + return this.innerProperties() == null ? null : this.innerProperties().targetReplicaId(); + } + + /** + * Get the linkState property: The link state. + * + * @return the linkState value. + */ + public String linkState() { + return this.innerProperties() == null ? null : this.innerProperties().linkState(); + } + + /** + * Get the lastHardenedLsn property: The last hardened lsn. + * + * @return the lastHardenedLsn value. + */ + public String lastHardenedLsn() { + return this.innerProperties() == null ? null : this.innerProperties().lastHardenedLsn(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DistributedAvailabilityGroupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DistributedAvailabilityGroupProperties.java new file mode 100644 index 0000000000000..7a46751c8d869 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DistributedAvailabilityGroupProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.ReplicationMode; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** The properties of a distributed availability group. */ +@Fluent +public final class DistributedAvailabilityGroupProperties { + /* + * The name of the target database + */ + @JsonProperty(value = "targetDatabase") + private String targetDatabase; + + /* + * The source endpoint + */ + @JsonProperty(value = "sourceEndpoint") + private String sourceEndpoint; + + /* + * The primary availability group name + */ + @JsonProperty(value = "primaryAvailabilityGroupName") + private String primaryAvailabilityGroupName; + + /* + * The secondary availability group name + */ + @JsonProperty(value = "secondaryAvailabilityGroupName") + private String secondaryAvailabilityGroupName; + + /* + * The replication mode of a distributed availability group. Parameter will + * be ignored during link creation. + */ + @JsonProperty(value = "replicationMode") + private ReplicationMode replicationMode; + + /* + * The distributed availability group id + */ + @JsonProperty(value = "distributedAvailabilityGroupId", access = JsonProperty.Access.WRITE_ONLY) + private UUID distributedAvailabilityGroupId; + + /* + * The source replica id + */ + @JsonProperty(value = "sourceReplicaId", access = JsonProperty.Access.WRITE_ONLY) + private UUID sourceReplicaId; + + /* + * The target replica id + */ + @JsonProperty(value = "targetReplicaId", access = JsonProperty.Access.WRITE_ONLY) + private UUID targetReplicaId; + + /* + * The link state + */ + @JsonProperty(value = "linkState", access = JsonProperty.Access.WRITE_ONLY) + private String linkState; + + /* + * The last hardened lsn + */ + @JsonProperty(value = "lastHardenedLsn", access = JsonProperty.Access.WRITE_ONLY) + private String lastHardenedLsn; + + /** + * Get the targetDatabase property: The name of the target database. + * + * @return the targetDatabase value. + */ + public String targetDatabase() { + return this.targetDatabase; + } + + /** + * Set the targetDatabase property: The name of the target database. + * + * @param targetDatabase the targetDatabase value to set. + * @return the DistributedAvailabilityGroupProperties object itself. + */ + public DistributedAvailabilityGroupProperties withTargetDatabase(String targetDatabase) { + this.targetDatabase = targetDatabase; + return this; + } + + /** + * Get the sourceEndpoint property: The source endpoint. + * + * @return the sourceEndpoint value. + */ + public String sourceEndpoint() { + return this.sourceEndpoint; + } + + /** + * Set the sourceEndpoint property: The source endpoint. + * + * @param sourceEndpoint the sourceEndpoint value to set. + * @return the DistributedAvailabilityGroupProperties object itself. + */ + public DistributedAvailabilityGroupProperties withSourceEndpoint(String sourceEndpoint) { + this.sourceEndpoint = sourceEndpoint; + return this; + } + + /** + * Get the primaryAvailabilityGroupName property: The primary availability group name. + * + * @return the primaryAvailabilityGroupName value. + */ + public String primaryAvailabilityGroupName() { + return this.primaryAvailabilityGroupName; + } + + /** + * Set the primaryAvailabilityGroupName property: The primary availability group name. + * + * @param primaryAvailabilityGroupName the primaryAvailabilityGroupName value to set. + * @return the DistributedAvailabilityGroupProperties object itself. + */ + public DistributedAvailabilityGroupProperties withPrimaryAvailabilityGroupName( + String primaryAvailabilityGroupName) { + this.primaryAvailabilityGroupName = primaryAvailabilityGroupName; + return this; + } + + /** + * Get the secondaryAvailabilityGroupName property: The secondary availability group name. + * + * @return the secondaryAvailabilityGroupName value. + */ + public String secondaryAvailabilityGroupName() { + return this.secondaryAvailabilityGroupName; + } + + /** + * Set the secondaryAvailabilityGroupName property: The secondary availability group name. + * + * @param secondaryAvailabilityGroupName the secondaryAvailabilityGroupName value to set. + * @return the DistributedAvailabilityGroupProperties object itself. + */ + public DistributedAvailabilityGroupProperties withSecondaryAvailabilityGroupName( + String secondaryAvailabilityGroupName) { + this.secondaryAvailabilityGroupName = secondaryAvailabilityGroupName; + return this; + } + + /** + * Get the replicationMode property: The replication mode of a distributed availability group. Parameter will be + * ignored during link creation. + * + * @return the replicationMode value. + */ + public ReplicationMode replicationMode() { + return this.replicationMode; + } + + /** + * Set the replicationMode property: The replication mode of a distributed availability group. Parameter will be + * ignored during link creation. + * + * @param replicationMode the replicationMode value to set. + * @return the DistributedAvailabilityGroupProperties object itself. + */ + public DistributedAvailabilityGroupProperties withReplicationMode(ReplicationMode replicationMode) { + this.replicationMode = replicationMode; + return this; + } + + /** + * Get the distributedAvailabilityGroupId property: The distributed availability group id. + * + * @return the distributedAvailabilityGroupId value. + */ + public UUID distributedAvailabilityGroupId() { + return this.distributedAvailabilityGroupId; + } + + /** + * Get the sourceReplicaId property: The source replica id. + * + * @return the sourceReplicaId value. + */ + public UUID sourceReplicaId() { + return this.sourceReplicaId; + } + + /** + * Get the targetReplicaId property: The target replica id. + * + * @return the targetReplicaId value. + */ + public UUID targetReplicaId() { + return this.targetReplicaId; + } + + /** + * Get the linkState property: The link state. + * + * @return the linkState value. + */ + public String linkState() { + return this.linkState; + } + + /** + * Get the lastHardenedLsn property: The last hardened lsn. + * + * @return the lastHardenedLsn value. + */ + public String lastHardenedLsn() { + return this.lastHardenedLsn; + } + + /** + * 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/DnsRefreshConfigurationProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DnsRefreshConfigurationProperties.java new file mode 100644 index 0000000000000..bcdf7144d73f0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DnsRefreshConfigurationProperties.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.DnsRefreshConfigurationPropertiesStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** DNS refresh configuration properties. */ +@Immutable +public final class DnsRefreshConfigurationProperties { + /* + * The status of the DNS refresh operation. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private DnsRefreshConfigurationPropertiesStatus status; + + /** + * Get the status property: The status of the DNS refresh operation. + * + * @return the status value. + */ + public DnsRefreshConfigurationPropertiesStatus 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/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..fada7bd8d7096 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Represents the activity on an elastic pool. */ +@Fluent +public final class ElasticPoolActivityInner extends ProxyResource { + /* + * The geo-location where the resource lives + */ + @JsonProperty(value = "location") + private String location; + + /* + * The properties representing the resource. + */ + @JsonProperty(value = "properties") + private ElasticPoolActivityProperties innerProperties; + + /** + * 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 innerProperties property: The properties representing the resource. + * + * @return the innerProperties value. + */ + private ElasticPoolActivityProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the endTime property: The time the operation finished (ISO8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Get the errorCode property: The error code if available. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorMessage property: The error message if available. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.innerProperties() == null ? null : this.innerProperties().errorMessage(); + } + + /** + * Get the errorSeverity property: The error severity if available. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.innerProperties() == null ? null : this.innerProperties().errorSeverity(); + } + + /** + * Get the operation property: The operation name. + * + * @return the operation value. + */ + public String operation() { + return this.innerProperties() == null ? null : this.innerProperties().operation(); + } + + /** + * Get the operationId property: The unique operation ID. + * + * @return the operationId value. + */ + public UUID operationId() { + return this.innerProperties() == null ? null : this.innerProperties().operationId(); + } + + /** + * Get the percentComplete property: The percentage complete if available. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Get the requestedDatabaseDtuMax property: The requested max DTU per database if available. + * + * @return the requestedDatabaseDtuMax value. + */ + public Integer requestedDatabaseDtuMax() { + return this.innerProperties() == null ? null : this.innerProperties().requestedDatabaseDtuMax(); + } + + /** + * Get the requestedDatabaseDtuMin property: The requested min DTU per database if available. + * + * @return the requestedDatabaseDtuMin value. + */ + public Integer requestedDatabaseDtuMin() { + return this.innerProperties() == null ? null : this.innerProperties().requestedDatabaseDtuMin(); + } + + /** + * Get the requestedDtu property: The requested DTU for the pool if available. + * + * @return the requestedDtu value. + */ + public Integer requestedDtu() { + return this.innerProperties() == null ? null : this.innerProperties().requestedDtu(); + } + + /** + * Get the requestedElasticPoolName property: The requested name for the elastic pool if available. + * + * @return the requestedElasticPoolName value. + */ + public String requestedElasticPoolName() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().requestedStorageLimitInGB(); + } + + /** + * Get the elasticPoolName property: The name of the elastic pool. + * + * @return the elasticPoolName value. + */ + public String elasticPoolName() { + return this.innerProperties() == null ? null : this.innerProperties().elasticPoolName(); + } + + /** + * Get the serverName property: The name of the server the elastic pool is in. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the startTime property: The time the operation started (ISO8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the state property: The current state of the operation. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the requestedStorageLimitInMB property: The requested storage limit in MB. + * + * @return the requestedStorageLimitInMB value. + */ + public Integer requestedStorageLimitInMB() { + return this.innerProperties() == null ? null : this.innerProperties().requestedStorageLimitInMB(); + } + + /** + * Get the requestedDatabaseDtuGuarantee property: The requested per database DTU guarantee. + * + * @return the requestedDatabaseDtuGuarantee value. + */ + public Integer requestedDatabaseDtuGuarantee() { + return this.innerProperties() == null ? null : this.innerProperties().requestedDatabaseDtuGuarantee(); + } + + /** + * Get the requestedDatabaseDtuCap property: The requested per database DTU cap. + * + * @return the requestedDatabaseDtuCap value. + */ + public Integer requestedDatabaseDtuCap() { + return this.innerProperties() == null ? null : this.innerProperties().requestedDatabaseDtuCap(); + } + + /** + * Get the requestedDtuGuarantee property: The requested DTU guarantee. + * + * @return the requestedDtuGuarantee value. + */ + public Integer requestedDtuGuarantee() { + return this.innerProperties() == null ? null : this.innerProperties().requestedDtuGuarantee(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityProperties.java new file mode 100644 index 0000000000000..79bb6c378624c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityProperties.java @@ -0,0 +1,322 @@ +// Copyright (c) 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.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Represents the properties of an elastic pool. */ +@Immutable +public final class ElasticPoolActivityProperties { + /* + * The time the operation finished (ISO8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The error code if available. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The error message if available. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /* + * The error severity if available. + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * The operation name. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The unique operation ID. + */ + @JsonProperty(value = "operationId", access = JsonProperty.Access.WRITE_ONLY) + private UUID operationId; + + /* + * The percentage complete if available. + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The requested max DTU per database if available. + */ + @JsonProperty(value = "requestedDatabaseDtuMax", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuMax; + + /* + * The requested min DTU per database if available. + */ + @JsonProperty(value = "requestedDatabaseDtuMin", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuMin; + + /* + * The requested DTU for the pool if available. + */ + @JsonProperty(value = "requestedDtu", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDtu; + + /* + * The requested name for the elastic pool if available. + */ + @JsonProperty(value = "requestedElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedElasticPoolName; + + /* + * The requested storage limit for the pool in GB if available. + */ + @JsonProperty(value = "requestedStorageLimitInGB", access = JsonProperty.Access.WRITE_ONLY) + private Long requestedStorageLimitInGB; + + /* + * The name of the elastic pool. + */ + @JsonProperty(value = "elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /* + * The name of the server the elastic pool is in. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The time the operation started (ISO8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The current state of the operation. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The requested storage limit in MB. + */ + @JsonProperty(value = "requestedStorageLimitInMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedStorageLimitInMB; + + /* + * The requested per database DTU guarantee. + */ + @JsonProperty(value = "requestedDatabaseDtuGuarantee", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuGuarantee; + + /* + * The requested per database DTU cap. + */ + @JsonProperty(value = "requestedDatabaseDtuCap", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuCap; + + /* + * The requested DTU guarantee. + */ + @JsonProperty(value = "requestedDtuGuarantee", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDtuGuarantee; + + /** + * 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..fce7894a2b0c2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityInner.java @@ -0,0 +1,203 @@ +// Copyright (c) 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.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Represents the activity on an elastic pool. */ +@Fluent +public final class ElasticPoolDatabaseActivityInner extends ProxyResource { + /* + * The geo-location where the resource lives + */ + @JsonProperty(value = "location") + private String location; + + /* + * The properties representing the resource. + */ + @JsonProperty(value = "properties") + private ElasticPoolDatabaseActivityProperties innerProperties; + + /** + * 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 innerProperties property: The properties representing the resource. + * + * @return the innerProperties value. + */ + private ElasticPoolDatabaseActivityProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the databaseName property: The database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the endTime property: The time the operation finished (ISO8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Get the errorCode property: The error code if available. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorMessage property: The error message if available. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.innerProperties() == null ? null : this.innerProperties().errorMessage(); + } + + /** + * Get the errorSeverity property: The error severity if available. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.innerProperties() == null ? null : this.innerProperties().errorSeverity(); + } + + /** + * Get the operation property: The operation name. + * + * @return the operation value. + */ + public String operation() { + return this.innerProperties() == null ? null : this.innerProperties().operation(); + } + + /** + * Get the operationId property: The unique operation ID. + * + * @return the operationId value. + */ + public UUID operationId() { + return this.innerProperties() == null ? null : this.innerProperties().operationId(); + } + + /** + * Get the percentComplete property: The percentage complete if available. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().currentElasticPoolName(); + } + + /** + * Get the currentServiceObjective property: The name of the current service objective if available. + * + * @return the currentServiceObjective value. + */ + public String currentServiceObjective() { + return this.innerProperties() == null ? null : this.innerProperties().currentServiceObjective(); + } + + /** + * Get the requestedServiceObjective property: The name of the requested service objective if available. + * + * @return the requestedServiceObjective value. + */ + public String requestedServiceObjective() { + return this.innerProperties() == null ? null : this.innerProperties().requestedServiceObjective(); + } + + /** + * Get the serverName property: The name of the server the elastic pool is in. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the startTime property: The time the operation started (ISO8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the state property: The current state of the operation. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityProperties.java new file mode 100644 index 0000000000000..265a54ab445a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityProperties.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Represents the properties of an elastic pool database activity. */ +@Immutable +public final class ElasticPoolDatabaseActivityProperties { + /* + * The database name. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The time the operation finished (ISO8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The error code if available. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The error message if available. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /* + * The error severity if available. + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * The operation name. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The unique operation ID. + */ + @JsonProperty(value = "operationId", access = JsonProperty.Access.WRITE_ONLY) + private UUID operationId; + + /* + * The percentage complete if available. + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The name for the elastic pool the database is moving into if available. + */ + @JsonProperty(value = "requestedElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedElasticPoolName; + + /* + * The name of the current elastic pool the database is in if available. + */ + @JsonProperty(value = "currentElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String currentElasticPoolName; + + /* + * The name of the current service objective if available. + */ + @JsonProperty(value = "currentServiceObjective", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjective; + + /* + * The name of the requested service objective if available. + */ + @JsonProperty(value = "requestedServiceObjective", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjective; + + /* + * The name of the server the elastic pool is in. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The time the operation started (ISO8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The current state of the operation. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * 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..eadff32eaec0e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +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.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An elastic pool. */ +@Fluent +public final class ElasticPoolInner extends Resource { + /* + * 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; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ElasticPoolProperties innerProperties; + + /** + * 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ElasticPoolProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ElasticPoolInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ElasticPoolInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the state property: The state of the elastic pool. + * + * @return the state value. + */ + public ElasticPoolState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the creationDate property: The creation date of the elastic pool (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the maxSizeBytes property: The storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolProperties(); + } + this.innerProperties().withMaxSizeBytes(maxSizeBytes); + return this; + } + + /** + * Get the perDatabaseSettings property: The per database settings for the elastic pool. + * + * @return the perDatabaseSettings value. + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolProperties(); + } + this.innerProperties().withPerDatabaseSettings(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolProperties(); + } + this.innerProperties().withZoneRedundant(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolProperties(); + } + this.innerProperties().withLicenseType(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolProperties(); + } + this.innerProperties().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.innerProperties() == null ? null : this.innerProperties().highAvailabilityReplicaCount(); + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolProperties(); + } + this.innerProperties().withHighAvailabilityReplicaCount(highAvailabilityReplicaCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().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..008f956be1ebd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A elastic pool operation. */ +@Fluent +public final class ElasticPoolOperationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ElasticPoolOperationProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ElasticPoolOperationProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().elasticPoolName(); + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.innerProperties() == null ? null : this.innerProperties().operation(); + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.innerProperties() == null ? null : this.innerProperties().operationFriendlyName(); + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Get the serverName property: The name of the server. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.innerProperties() == null ? null : this.innerProperties().errorDescription(); + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.innerProperties() == null ? null : this.innerProperties().errorSeverity(); + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.innerProperties() == null ? null : this.innerProperties().isUserError(); + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().estimatedCompletionTime(); + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.innerProperties() == null ? null : this.innerProperties().isCancellable(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationProperties.java new file mode 100644 index 0000000000000..562b929cdef36 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationProperties.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a elastic pool operation. */ +@Immutable +public final class ElasticPoolOperationProperties { + /* + * The name of the elastic pool the operation is being performed on. + */ + @JsonProperty(value = "elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /* + * The name of operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The friendly name of operation. + */ + @JsonProperty(value = "operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /* + * The percentage of the operation completed. + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The name of the server. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The operation start time. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The operation state. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The operation error code. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The operation error description. + */ + @JsonProperty(value = "errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /* + * The operation error severity. + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * Whether or not the error is a user error. + */ + @JsonProperty(value = "isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /* + * The estimated completion time of the operation. + */ + @JsonProperty(value = "estimatedCompletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime estimatedCompletionTime; + + /* + * The operation description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Whether the operation can be cancelled. + */ + @JsonProperty(value = "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/ElasticPoolProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolProperties.java new file mode 100644 index 0000000000000..71806e49d1901 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +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.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of an elastic pool. */ +@Fluent +public final class ElasticPoolProperties { + /* + * The state of the elastic pool. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private ElasticPoolState state; + + /* + * The creation date of the elastic pool (ISO8601 format). + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The storage limit for the database elastic pool in bytes. + */ + @JsonProperty(value = "maxSizeBytes") + private Long maxSizeBytes; + + /* + * The per database settings for the elastic pool. + */ + @JsonProperty(value = "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 = "zoneRedundant") + private Boolean zoneRedundant; + + /* + * The license type to apply for this elastic pool. + */ + @JsonProperty(value = "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 = "maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /* + * The number of secondary replicas associated with the elastic pool that + * are used to provide high availability. + */ + @JsonProperty(value = "highAvailabilityReplicaCount") + private Integer highAvailabilityReplicaCount; + + /** + * 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 ElasticPoolProperties object itself. + */ + public ElasticPoolProperties 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 ElasticPoolProperties object itself. + */ + public ElasticPoolProperties 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 ElasticPoolProperties object itself. + */ + public ElasticPoolProperties 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 ElasticPoolProperties object itself. + */ + public ElasticPoolProperties 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 ElasticPoolProperties object itself. + */ + public ElasticPoolProperties withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * 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 elastic pool + * that are used to provide high availability. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the ElasticPoolProperties object itself. + */ + public ElasticPoolProperties withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + this.highAvailabilityReplicaCount = highAvailabilityReplicaCount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void 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/ElasticPoolUpdateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolUpdateProperties.java new file mode 100644 index 0000000000000..514244aa1c7e6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolPerDatabaseSettings; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an elastic pool. */ +@Fluent +public final class ElasticPoolUpdateProperties { + /* + * The storage limit for the database elastic pool in bytes. + */ + @JsonProperty(value = "maxSizeBytes") + private Long maxSizeBytes; + + /* + * The per database settings for the elastic pool. + */ + @JsonProperty(value = "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 = "zoneRedundant") + private Boolean zoneRedundant; + + /* + * The license type to apply for this elastic pool. + */ + @JsonProperty(value = "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 = "maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /* + * The number of secondary replicas associated with the elastic pool that + * are used to provide high availability. Applicable only to Hyperscale + * elastic pools. + */ + @JsonProperty(value = "highAvailabilityReplicaCount") + private Integer highAvailabilityReplicaCount; + + /** + * 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 ElasticPoolUpdateProperties object itself. + */ + public ElasticPoolUpdateProperties 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 ElasticPoolUpdateProperties object itself. + */ + public ElasticPoolUpdateProperties 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 ElasticPoolUpdateProperties object itself. + */ + public ElasticPoolUpdateProperties 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 ElasticPoolUpdateProperties object itself. + */ + public ElasticPoolUpdateProperties 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 ElasticPoolUpdateProperties object itself. + */ + public ElasticPoolUpdateProperties withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. Applicable only to Hyperscale elastic pools. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.highAvailabilityReplicaCount; + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. Applicable only to Hyperscale elastic pools. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the ElasticPoolUpdateProperties object itself. + */ + public ElasticPoolUpdateProperties withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + this.highAvailabilityReplicaCount = highAvailabilityReplicaCount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void 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/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..35ec3fb25ceb5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The server encryption protector. */ +@Fluent +public final class EncryptionProtectorInner extends ProxyResource { + /* + * 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; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private EncryptionProtectorProperties innerProperties; + + /** + * 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private EncryptionProtectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the subregion property: Subregion of the encryption protector. + * + * @return the subregion value. + */ + public String subregion() { + return this.innerProperties() == null ? null : this.innerProperties().subregion(); + } + + /** + * Get the serverKeyName property: The name of the server key. + * + * @return the serverKeyName value. + */ + public String serverKeyName() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new EncryptionProtectorProperties(); + } + this.innerProperties().withServerKeyName(serverKeyName); + return this; + } + + /** + * Get the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new EncryptionProtectorProperties(); + } + this.innerProperties().withServerKeyType(serverKeyType); + return this; + } + + /** + * Get the uri property: The URI of the server key. + * + * @return the uri value. + */ + public String uri() { + return this.innerProperties() == null ? null : this.innerProperties().uri(); + } + + /** + * Get the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.innerProperties() == null ? null : this.innerProperties().thumbprint(); + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().autoRotationEnabled(); + } + + /** + * Set the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @param autoRotationEnabled the autoRotationEnabled value to set. + * @return the EncryptionProtectorInner object itself. + */ + public EncryptionProtectorInner withAutoRotationEnabled(Boolean autoRotationEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new EncryptionProtectorProperties(); + } + this.innerProperties().withAutoRotationEnabled(autoRotationEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorProperties.java new file mode 100644 index 0000000000000..8dba51e8d00cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorProperties.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.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for an encryption protector execution. */ +@Fluent +public final class EncryptionProtectorProperties { + /* + * Subregion of the encryption protector. + */ + @JsonProperty(value = "subregion", access = JsonProperty.Access.WRITE_ONLY) + private String subregion; + + /* + * The name of the server key. + */ + @JsonProperty(value = "serverKeyName") + private String serverKeyName; + + /* + * The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /* + * The URI of the server key. + */ + @JsonProperty(value = "uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /* + * Thumbprint of the server key. + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * Key auto rotation opt-in flag. Either true or false. + */ + @JsonProperty(value = "autoRotationEnabled") + private Boolean autoRotationEnabled; + + /** + * 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 EncryptionProtectorProperties object itself. + */ + public EncryptionProtectorProperties 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 EncryptionProtectorProperties object itself. + */ + public EncryptionProtectorProperties 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; + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.autoRotationEnabled; + } + + /** + * Set the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @param autoRotationEnabled the autoRotationEnabled value to set. + * @return the EncryptionProtectorProperties object itself. + */ + public EncryptionProtectorProperties withAutoRotationEnabled(Boolean autoRotationEnabled) { + this.autoRotationEnabled = autoRotationEnabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverKeyType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property serverKeyType in model EncryptionProtectorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EncryptionProtectorProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EndpointCertificateInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EndpointCertificateInner.java new file mode 100644 index 0000000000000..5d280dcfb2712 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EndpointCertificateInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Certificate used on an endpoint on the Managed Instance. */ +@Fluent +public final class EndpointCertificateInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private EndpointCertificateProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private EndpointCertificateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the publicBlob property: The certificate public blob. + * + * @return the publicBlob value. + */ + public String publicBlob() { + return this.innerProperties() == null ? null : this.innerProperties().publicBlob(); + } + + /** + * Set the publicBlob property: The certificate public blob. + * + * @param publicBlob the publicBlob value to set. + * @return the EndpointCertificateInner object itself. + */ + public EndpointCertificateInner withPublicBlob(String publicBlob) { + if (this.innerProperties() == null) { + this.innerProperties = new EndpointCertificateProperties(); + } + this.innerProperties().withPublicBlob(publicBlob); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EndpointCertificateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EndpointCertificateProperties.java new file mode 100644 index 0000000000000..0e54ad0930da1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EndpointCertificateProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an endpoint certificate. */ +@Fluent +public final class EndpointCertificateProperties { + /* + * The certificate public blob + */ + @JsonProperty(value = "publicBlob") + private String publicBlob; + + /** + * Get the publicBlob property: The certificate public blob. + * + * @return the publicBlob value. + */ + public String publicBlob() { + return this.publicBlob; + } + + /** + * Set the publicBlob property: The certificate public blob. + * + * @param publicBlob the publicBlob value to set. + * @return the EndpointCertificateProperties object itself. + */ + public EndpointCertificateProperties withPublicBlob(String publicBlob) { + this.publicBlob = publicBlob; + 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/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..809e287406d14 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** An extended database blob auditing policy. */ +@Fluent +public final class ExtendedDatabaseBlobAuditingPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ExtendedDatabaseBlobAuditingPolicyProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ExtendedDatabaseBlobAuditingPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value. + */ + public String predicateExpression() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withPredicateExpression(predicateExpression); + 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withRetentionDays(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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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.innerProperties() == null ? null : this.innerProperties().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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withAuditActionsAndGroups(auditActionsAndGroups); + 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsStorageSecondaryKeyInUse(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsAzureMonitorTargetEnabled(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withQueueDelayMs(queueDelayMs); + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.innerProperties() == null ? null : this.innerProperties().isManagedIdentityInUse(); + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsManagedIdentityInUse(isManagedIdentityInUse); + 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.innerProperties() == null ? null : this.innerProperties().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 ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withState(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyProperties.java new file mode 100644 index 0000000000000..8175a8b05c1d1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyProperties.java @@ -0,0 +1,557 @@ +// Copyright (c) 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.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** Properties of an extended database blob auditing policy. */ +@Fluent +public final class ExtendedDatabaseBlobAuditingPolicyProperties { + /* + * Specifies condition of where clause when creating an audit. + */ + @JsonProperty(value = "predicateExpression") + private String predicateExpression; + + /* + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "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 + * DBCC_GROUP + * DATABASE_OWNERSHIP_CHANGE_GROUP + * DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 = "auditActionsAndGroups") + private List auditActionsAndGroups; + + /* + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "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 = "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 = "queueDelayMs") + private Integer queueDelayMs; + + /* + * Specifies whether Managed Identity is used to access blob storage + */ + @JsonProperty(value = "isManagedIdentityInUse") + private Boolean isManagedIdentityInUse; + + /* + * Specifies the state of the audit. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. + */ + @JsonProperty(value = "state", required = true) + 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 = "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 = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * 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 ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withPredicateExpression(String predicateExpression) { + this.predicateExpression = predicateExpression; + 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 ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + 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 ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties 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 ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties 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 ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withQueueDelayMs(Integer queueDelayMs) { + this.queueDelayMs = queueDelayMs; + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.isManagedIdentityInUse; + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.isManagedIdentityInUse = isManagedIdentityInUse; + 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 ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties 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 ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties 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 ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties 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 ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withStorageAccountSubscriptionId( + UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * 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 ExtendedDatabaseBlobAuditingPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExtendedDatabaseBlobAuditingPolicyProperties.class); +} 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..eb43161359933 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyInner.java @@ -0,0 +1,466 @@ +// Copyright (c) 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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** An extended server blob auditing policy. */ +@Fluent +public final class ExtendedServerBlobAuditingPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ExtendedServerBlobAuditingPolicyProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ExtendedServerBlobAuditingPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be 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 isDevopsAuditEnabled value. + */ + public Boolean isDevopsAuditEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isDevopsAuditEnabled(); + } + + /** + * Set the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be 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 isDevopsAuditEnabled the isDevopsAuditEnabled value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsDevopsAuditEnabled(isDevopsAuditEnabled); + return this; + } + + /** + * Get the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value. + */ + public String predicateExpression() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withPredicateExpression(predicateExpression); + 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withRetentionDays(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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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.innerProperties() == null ? null : this.innerProperties().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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withAuditActionsAndGroups(auditActionsAndGroups); + 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsStorageSecondaryKeyInUse(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsAzureMonitorTargetEnabled(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withQueueDelayMs(queueDelayMs); + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.innerProperties() == null ? null : this.innerProperties().isManagedIdentityInUse(); + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsManagedIdentityInUse(isManagedIdentityInUse); + 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.innerProperties() == null ? null : this.innerProperties().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 ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withState(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyProperties.java new file mode 100644 index 0000000000000..fea2899331101 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyProperties.java @@ -0,0 +1,623 @@ +// Copyright (c) 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.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** Properties of an extended server blob auditing policy. */ +@Fluent +public final class ExtendedServerBlobAuditingPolicyProperties { + /* + * Specifies the state of devops audit. If state is Enabled, devops logs + * will be sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as + * 'Enabled', 'IsAzureMonitorTargetEnabled' as true and + * 'IsDevopsAuditEnabled' as true + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'DevOpsOperationsAudit' diagnostic logs category on the master database + * should also be 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 = "isDevopsAuditEnabled") + private Boolean isDevopsAuditEnabled; + + /* + * Specifies condition of where clause when creating an audit. + */ + @JsonProperty(value = "predicateExpression") + private String predicateExpression; + + /* + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "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 + * DBCC_GROUP + * DATABASE_OWNERSHIP_CHANGE_GROUP + * DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 = "auditActionsAndGroups") + private List auditActionsAndGroups; + + /* + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "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 = "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 = "queueDelayMs") + private Integer queueDelayMs; + + /* + * Specifies whether Managed Identity is used to access blob storage + */ + @JsonProperty(value = "isManagedIdentityInUse") + private Boolean isManagedIdentityInUse; + + /* + * Specifies the state of the audit. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. + */ + @JsonProperty(value = "state", required = true) + 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 = "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 = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * Get the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be 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 isDevopsAuditEnabled value. + */ + public Boolean isDevopsAuditEnabled() { + return this.isDevopsAuditEnabled; + } + + /** + * Set the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be 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 isDevopsAuditEnabled the isDevopsAuditEnabled value to set. + * @return the ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled) { + this.isDevopsAuditEnabled = isDevopsAuditEnabled; + return this; + } + + /** + * 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 ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withPredicateExpression(String predicateExpression) { + this.predicateExpression = predicateExpression; + 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 ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + 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 ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties 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 ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties 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 ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withQueueDelayMs(Integer queueDelayMs) { + this.queueDelayMs = queueDelayMs; + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.isManagedIdentityInUse; + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.isManagedIdentityInUse = isManagedIdentityInUse; + 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 ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties 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 ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties 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 ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties 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 ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withStorageAccountSubscriptionId( + UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * 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 ExtendedServerBlobAuditingPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExtendedServerBlobAuditingPolicyProperties.class); +} 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..56273a19f5960 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +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.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** A failover group. */ +@Fluent +public final class FailoverGroupInner extends ProxyResource { + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private FailoverGroupProperties innerProperties; + + /** + * 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private FailoverGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new FailoverGroupProperties(); + } + this.innerProperties().withReadWriteEndpoint(readWriteEndpoint); + return this; + } + + /** + * Get the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new FailoverGroupProperties(); + } + this.innerProperties().withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } + + /** + * Get the replicationRole property: Local replication role of the failover group instance. + * + * @return the replicationRole value. + */ + public FailoverGroupReplicationRole replicationRole() { + return this.innerProperties() == null ? null : this.innerProperties().replicationRole(); + } + + /** + * Get the replicationState property: Replication state of the failover group instance. + * + * @return the replicationState value. + */ + public String replicationState() { + return this.innerProperties() == null ? null : this.innerProperties().replicationState(); + } + + /** + * Get the partnerServers property: List of partner server information for the failover group. + * + * @return the partnerServers value. + */ + public List partnerServers() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new FailoverGroupProperties(); + } + this.innerProperties().withPartnerServers(partnerServers); + return this; + } + + /** + * Get the databases property: List of databases in the failover group. + * + * @return the databases value. + */ + public List databases() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new FailoverGroupProperties(); + } + this.innerProperties().withDatabases(databases); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupProperties.java new file mode 100644 index 0000000000000..b2b6df8565ce0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupProperties.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.models; + +import com.azure.core.annotation.Fluent; +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.JsonProperty; +import java.util.List; + +/** Properties of a failover group. */ +@Fluent +public final class FailoverGroupProperties { + /* + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "readWriteEndpoint", required = true) + private FailoverGroupReadWriteEndpoint readWriteEndpoint; + + /* + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "readOnlyEndpoint") + private FailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /* + * Local replication role of the failover group instance. + */ + @JsonProperty(value = "replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private FailoverGroupReplicationRole replicationRole; + + /* + * Replication state of the failover group instance. + */ + @JsonProperty(value = "replicationState", access = JsonProperty.Access.WRITE_ONLY) + private String replicationState; + + /* + * List of partner server information for the failover group. + */ + @JsonProperty(value = "partnerServers", required = true) + private List partnerServers; + + /* + * List of databases in the failover group. + */ + @JsonProperty(value = "databases") + private List databases; + + /** + * 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 FailoverGroupProperties object itself. + */ + public FailoverGroupProperties 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 FailoverGroupProperties object itself. + */ + public FailoverGroupProperties 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 FailoverGroupProperties object itself. + */ + public FailoverGroupProperties 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 FailoverGroupProperties object itself. + */ + public FailoverGroupProperties 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property readWriteEndpoint in model FailoverGroupProperties")); + } else { + readWriteEndpoint().validate(); + } + if (readOnlyEndpoint() != null) { + readOnlyEndpoint().validate(); + } + if (partnerServers() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property partnerServers in model FailoverGroupProperties")); + } else { + partnerServers().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FailoverGroupProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupUpdateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupUpdateProperties.java new file mode 100644 index 0000000000000..098a851eaf025 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupUpdateProperties.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.resourcemanager.sql.generated.models.FailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a failover group update. */ +@Fluent +public final class FailoverGroupUpdateProperties { + /* + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "readWriteEndpoint") + private FailoverGroupReadWriteEndpoint readWriteEndpoint; + + /* + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "readOnlyEndpoint") + private FailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /* + * List of databases in the failover group. + */ + @JsonProperty(value = "databases") + private List databases; + + /** + * 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 FailoverGroupUpdateProperties object itself. + */ + public FailoverGroupUpdateProperties 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 FailoverGroupUpdateProperties object itself. + */ + public FailoverGroupUpdateProperties 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 FailoverGroupUpdateProperties object itself. + */ + public FailoverGroupUpdateProperties 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/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..8b516d96dc28a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FirewallRuleInner.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.resourcemanager.sql.generated.models.ProxyResourceWithWritableName; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A server firewall rule. */ +@Fluent +public final class FirewallRuleInner extends ProxyResourceWithWritableName { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerFirewallRuleProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerFirewallRuleProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public FirewallRuleInner withName(String name) { + super.withName(name); + return this; + } + + /** + * Get the startIpAddress property: The start IP address of the firewall rule. Must be IPv4 format. Use value + * '0.0.0.0' for all Azure-internal IP addresses. + * + * @return the startIpAddress value. + */ + public String startIpAddress() { + return this.innerProperties() == null ? null : this.innerProperties().startIpAddress(); + } + + /** + * Set the startIpAddress property: The start IP address of the firewall rule. Must be IPv4 format. Use value + * '0.0.0.0' for all Azure-internal IP addresses. + * + * @param startIpAddress the startIpAddress value to set. + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withStartIpAddress(String startIpAddress) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerFirewallRuleProperties(); + } + this.innerProperties().withStartIpAddress(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' for all Azure-internal IP addresses. + * + * @return the endIpAddress value. + */ + public String endIpAddress() { + return this.innerProperties() == null ? null : this.innerProperties().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' for all Azure-internal IP addresses. + * + * @param endIpAddress the endIpAddress value to set. + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withEndIpAddress(String endIpAddress) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerFirewallRuleProperties(); + } + this.innerProperties().withEndIpAddress(endIpAddress); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().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..1e4769245ad21 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyInner.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.models; + +import com.azure.core.annotation.Fluent; +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.JsonProperty; + +/** A database geo backup policy. */ +@Fluent +public final class GeoBackupPolicyInner extends ProxyResource { + /* + * The properties of the geo backup policy. + */ + @JsonProperty(value = "properties", required = true) + private GeoBackupPolicyProperties innerProperties = new GeoBackupPolicyProperties(); + + /* + * 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; + + /** + * Get the innerProperties property: The properties of the geo backup policy. + * + * @return the innerProperties value. + */ + private GeoBackupPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new GeoBackupPolicyProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the storageType property: The storage type of the geo backup policy. + * + * @return the storageType value. + */ + public String storageType() { + return this.innerProperties() == null ? null : this.innerProperties().storageType(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model GeoBackupPolicyInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GeoBackupPolicyInner.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyProperties.java new file mode 100644 index 0000000000000..79c565b8afd38 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the geo backup policy. */ +@Fluent +public final class GeoBackupPolicyProperties { + /* + * The state of the geo backup policy. + */ + @JsonProperty(value = "state", required = true) + private GeoBackupPolicyState state; + + /* + * The storage type of the geo backup policy. + */ + @JsonProperty(value = "storageType", access = JsonProperty.Access.WRITE_ONLY) + private String storageType; + + /** + * 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 GeoBackupPolicyProperties object itself. + */ + public GeoBackupPolicyProperties 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 GeoBackupPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GeoBackupPolicyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/IPv6FirewallRuleInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/IPv6FirewallRuleInner.java new file mode 100644 index 0000000000000..65f921204094f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/IPv6FirewallRuleInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.ProxyResourceWithWritableName; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An IPv6 server firewall rule. */ +@Fluent +public final class IPv6FirewallRuleInner extends ProxyResourceWithWritableName { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private IPv6ServerFirewallRuleProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private IPv6ServerFirewallRuleProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public IPv6FirewallRuleInner withName(String name) { + super.withName(name); + return this; + } + + /** + * Get the startIPv6Address property: The start IP address of the firewall rule. Must be IPv6 format. + * + * @return the startIPv6Address value. + */ + public String startIPv6Address() { + return this.innerProperties() == null ? null : this.innerProperties().startIPv6Address(); + } + + /** + * Set the startIPv6Address property: The start IP address of the firewall rule. Must be IPv6 format. + * + * @param startIPv6Address the startIPv6Address value to set. + * @return the IPv6FirewallRuleInner object itself. + */ + public IPv6FirewallRuleInner withStartIPv6Address(String startIPv6Address) { + if (this.innerProperties() == null) { + this.innerProperties = new IPv6ServerFirewallRuleProperties(); + } + this.innerProperties().withStartIPv6Address(startIPv6Address); + return this; + } + + /** + * Get the endIPv6Address property: The end IP address of the firewall rule. Must be IPv6 format. Must be greater + * than or equal to startIpAddress. + * + * @return the endIPv6Address value. + */ + public String endIPv6Address() { + return this.innerProperties() == null ? null : this.innerProperties().endIPv6Address(); + } + + /** + * Set the endIPv6Address property: The end IP address of the firewall rule. Must be IPv6 format. Must be greater + * than or equal to startIpAddress. + * + * @param endIPv6Address the endIPv6Address value to set. + * @return the IPv6FirewallRuleInner object itself. + */ + public IPv6FirewallRuleInner withEndIPv6Address(String endIPv6Address) { + if (this.innerProperties() == null) { + this.innerProperties = new IPv6ServerFirewallRuleProperties(); + } + this.innerProperties().withEndIPv6Address(endIPv6Address); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/IPv6ServerFirewallRuleProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/IPv6ServerFirewallRuleProperties.java new file mode 100644 index 0000000000000..4b0942227a614 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/IPv6ServerFirewallRuleProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an IPv6 server firewall rule. */ +@Fluent +public final class IPv6ServerFirewallRuleProperties { + /* + * The start IP address of the firewall rule. Must be IPv6 format. + */ + @JsonProperty(value = "startIPv6Address") + private String startIPv6Address; + + /* + * The end IP address of the firewall rule. Must be IPv6 format. Must be + * greater than or equal to startIpAddress. + */ + @JsonProperty(value = "endIPv6Address") + private String endIPv6Address; + + /** + * Get the startIPv6Address property: The start IP address of the firewall rule. Must be IPv6 format. + * + * @return the startIPv6Address value. + */ + public String startIPv6Address() { + return this.startIPv6Address; + } + + /** + * Set the startIPv6Address property: The start IP address of the firewall rule. Must be IPv6 format. + * + * @param startIPv6Address the startIPv6Address value to set. + * @return the IPv6ServerFirewallRuleProperties object itself. + */ + public IPv6ServerFirewallRuleProperties withStartIPv6Address(String startIPv6Address) { + this.startIPv6Address = startIPv6Address; + return this; + } + + /** + * Get the endIPv6Address property: The end IP address of the firewall rule. Must be IPv6 format. Must be greater + * than or equal to startIpAddress. + * + * @return the endIPv6Address value. + */ + public String endIPv6Address() { + return this.endIPv6Address; + } + + /** + * Set the endIPv6Address property: The end IP address of the firewall rule. Must be IPv6 format. Must be greater + * than or equal to startIpAddress. + * + * @param endIPv6Address the endIPv6Address value to set. + * @return the IPv6ServerFirewallRuleProperties object itself. + */ + public IPv6ServerFirewallRuleProperties withEndIPv6Address(String endIPv6Address) { + this.endIPv6Address = endIPv6Address; + 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/ImportExportExtensionsOperationResultInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportExtensionsOperationResultInner.java new file mode 100644 index 0000000000000..e7ac95e812fd2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportExtensionsOperationResultInner.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.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** An Extension operation result resource. */ +@Fluent +public final class ImportExportExtensionsOperationResultInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ImportExportExtensionsOperationResultProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ImportExportExtensionsOperationResultProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the requestId property: Request Id. + * + * @return the requestId value. + */ + public UUID requestId() { + return this.innerProperties() == null ? null : this.innerProperties().requestId(); + } + + /** + * Get the requestType property: Request type. + * + * @return the requestType value. + */ + public String requestType() { + return this.innerProperties() == null ? null : this.innerProperties().requestType(); + } + + /** + * Get the lastModifiedTime property: Last modified time. + * + * @return the lastModifiedTime value. + */ + public String lastModifiedTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTime(); + } + + /** + * Get the serverName property: Server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the databaseName property: Database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the errorMessage property: Error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.innerProperties() == null ? null : this.innerProperties().errorMessage(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportExtensionsOperationResultProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportExtensionsOperationResultProperties.java new file mode 100644 index 0000000000000..0282e7bb89501 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportExtensionsOperationResultProperties.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Contains the operation result properties for import/export operation. */ +@Immutable +public final class ImportExportExtensionsOperationResultProperties { + /* + * Request Id. + */ + @JsonProperty(value = "requestId", access = JsonProperty.Access.WRITE_ONLY) + private UUID requestId; + + /* + * Request type. + */ + @JsonProperty(value = "requestType", access = JsonProperty.Access.WRITE_ONLY) + private String requestType; + + /* + * Last modified time. + */ + @JsonProperty(value = "lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private String lastModifiedTime; + + /* + * Server name. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * Database name. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * Operation status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * Error message. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * 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 lastModifiedTime property: Last modified time. + * + * @return the lastModifiedTime value. + */ + public String lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * 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; + } + + /** + * 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/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..1e1c9e596ee35 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnectionRequestStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** An ImportExport operation result resource. */ +@Fluent +public final class ImportExportOperationResultInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ImportExportOperationResultProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ImportExportOperationResultProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the requestId property: Request Id. + * + * @return the requestId value. + */ + public UUID requestId() { + return this.innerProperties() == null ? null : this.innerProperties().requestId(); + } + + /** + * Get the requestType property: Request type. + * + * @return the requestType value. + */ + public String requestType() { + return this.innerProperties() == null ? null : this.innerProperties().requestType(); + } + + /** + * Get the queuedTime property: Queued time. + * + * @return the queuedTime value. + */ + public String queuedTime() { + return this.innerProperties() == null ? null : this.innerProperties().queuedTime(); + } + + /** + * Get the lastModifiedTime property: Last modified time. + * + * @return the lastModifiedTime value. + */ + public String lastModifiedTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTime(); + } + + /** + * Get the blobUri property: Blob Uri. + * + * @return the blobUri value. + */ + public String blobUri() { + return this.innerProperties() == null ? null : this.innerProperties().blobUri(); + } + + /** + * Get the serverName property: Server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the databaseName property: Database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the errorMessage property: Error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.innerProperties() == null ? null : this.innerProperties().errorMessage(); + } + + /** + * Get the privateEndpointConnections property: Gets the status of private endpoints associated with this request. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultProperties.java new file mode 100644 index 0000000000000..5e1035df7a590 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultProperties.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.Immutable; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnectionRequestStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** Contains the operation result properties for import/export operation. */ +@Immutable +public final class ImportExportOperationResultProperties { + /* + * Request Id. + */ + @JsonProperty(value = "requestId", access = JsonProperty.Access.WRITE_ONLY) + private UUID requestId; + + /* + * Request type. + */ + @JsonProperty(value = "requestType", access = JsonProperty.Access.WRITE_ONLY) + private String requestType; + + /* + * Queued time. + */ + @JsonProperty(value = "queuedTime", access = JsonProperty.Access.WRITE_ONLY) + private String queuedTime; + + /* + * Last modified time. + */ + @JsonProperty(value = "lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private String lastModifiedTime; + + /* + * Blob Uri. + */ + @JsonProperty(value = "blobUri", access = JsonProperty.Access.WRITE_ONLY) + private String blobUri; + + /* + * Server name. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * Database name. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * Operation status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * Error message. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /* + * Gets the status of private endpoints associated with this request. + */ + @JsonProperty(value = "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..7dfe1a908feca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupInner.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.Fluent; +import com.azure.core.management.ProxyResource; +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.JsonProperty; +import java.util.List; + +/** An instance failover group. */ +@Fluent +public final class InstanceFailoverGroupInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private InstanceFailoverGroupProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private InstanceFailoverGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + public InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new InstanceFailoverGroupProperties(); + } + this.innerProperties().withReadWriteEndpoint(readWriteEndpoint); + return this; + } + + /** + * Get the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + public InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new InstanceFailoverGroupProperties(); + } + this.innerProperties().withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } + + /** + * Get the replicationRole property: Local replication role of the failover group instance. + * + * @return the replicationRole value. + */ + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.innerProperties() == null ? null : this.innerProperties().replicationRole(); + } + + /** + * Get the replicationState property: Replication state of the failover group instance. + * + * @return the replicationState value. + */ + public String replicationState() { + return this.innerProperties() == null ? null : this.innerProperties().replicationState(); + } + + /** + * Get the partnerRegions property: Partner region information for the failover group. + * + * @return the partnerRegions value. + */ + public List partnerRegions() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new InstanceFailoverGroupProperties(); + } + this.innerProperties().withPartnerRegions(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new InstanceFailoverGroupProperties(); + } + this.innerProperties().withManagedInstancePairs(managedInstancePairs); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupProperties.java new file mode 100644 index 0000000000000..a6a804b518027 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +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.JsonProperty; +import java.util.List; + +/** Properties of a instance failover group. */ +@Fluent +public final class InstanceFailoverGroupProperties { + /* + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "readWriteEndpoint", required = true) + private InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint; + + /* + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "readOnlyEndpoint") + private InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /* + * Local replication role of the failover group instance. + */ + @JsonProperty(value = "replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private InstanceFailoverGroupReplicationRole replicationRole; + + /* + * Replication state of the failover group instance. + */ + @JsonProperty(value = "replicationState", access = JsonProperty.Access.WRITE_ONLY) + private String replicationState; + + /* + * Partner region information for the failover group. + */ + @JsonProperty(value = "partnerRegions", required = true) + private List partnerRegions; + + /* + * List of managed instance pairs in the failover group. + */ + @JsonProperty(value = "managedInstancePairs", required = true) + 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 InstanceFailoverGroupProperties object itself. + */ + public InstanceFailoverGroupProperties 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 InstanceFailoverGroupProperties object itself. + */ + public InstanceFailoverGroupProperties 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 InstanceFailoverGroupProperties object itself. + */ + public InstanceFailoverGroupProperties 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 InstanceFailoverGroupProperties object itself. + */ + public InstanceFailoverGroupProperties 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property readWriteEndpoint in model InstanceFailoverGroupProperties")); + } else { + readWriteEndpoint().validate(); + } + if (readOnlyEndpoint() != null) { + readOnlyEndpoint().validate(); + } + if (partnerRegions() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property partnerRegions in model InstanceFailoverGroupProperties")); + } else { + partnerRegions().forEach(e -> e.validate()); + } + if (managedInstancePairs() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property managedInstancePairs in model InstanceFailoverGroupProperties")); + } else { + managedInstancePairs().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InstanceFailoverGroupProperties.class); +} 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..af4fe56e71b31 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolInner.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.management.Resource; +import com.azure.resourcemanager.sql.generated.models.InstancePoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure SQL instance pool. */ +@Fluent +public final class InstancePoolInner extends Resource { + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private InstancePoolProperties innerProperties; + + /** + * 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private InstancePoolProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public InstancePoolInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public InstancePoolInner withTags(Map tags) { + super.withTags(tags); + 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new InstancePoolProperties(); + } + this.innerProperties().withSubnetId(subnetId); + return this; + } + + /** + * Get the vCores property: Count of vCores belonging to this instance pool. + * + * @return the vCores value. + */ + public Integer vCores() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new InstancePoolProperties(); + } + this.innerProperties().withVCores(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new InstancePoolProperties(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolProperties.java new file mode 100644 index 0000000000000..dc80ff48dd053 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolProperties.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.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.InstancePoolLicenseType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an instance pool. */ +@Fluent +public final class InstancePoolProperties { + /* + * Resource ID of the subnet to place this instance pool in. + */ + @JsonProperty(value = "subnetId", required = true) + private String subnetId; + + /* + * Count of vCores belonging to this instance pool. + */ + @JsonProperty(value = "vCores", required = true) + private int vCores; + + /* + * The license type. Possible values are 'LicenseIncluded' (price for SQL + * license is included) and 'BasePrice' (without SQL license price). + */ + @JsonProperty(value = "licenseType", required = true) + private InstancePoolLicenseType licenseType; + + /** + * 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 InstancePoolProperties object itself. + */ + public InstancePoolProperties 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 int 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 InstancePoolProperties object itself. + */ + public InstancePoolProperties withVCores(int 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 InstancePoolProperties object itself. + */ + public InstancePoolProperties withLicenseType(InstancePoolLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (subnetId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property subnetId in model InstancePoolProperties")); + } + if (licenseType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property licenseType in model InstancePoolProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InstancePoolProperties.class); +} 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..9d2e4bb1386fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentInner.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.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.sql.generated.models.JobAgentState; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure SQL job agent. */ +@Fluent +public final class JobAgentInner extends Resource { + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private JobAgentProperties innerProperties; + + /** + * 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private JobAgentProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public JobAgentInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public JobAgentInner withTags(Map tags) { + super.withTags(tags); + 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobAgentProperties(); + } + this.innerProperties().withDatabaseId(databaseId); + return this; + } + + /** + * Get the state property: The state of the job agent. + * + * @return the state value. + */ + public JobAgentState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentProperties.java new file mode 100644 index 0000000000000..780a34fd81dfa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.JobAgentState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a job agent. */ +@Fluent +public final class JobAgentProperties { + /* + * Resource ID of the database to store job metadata in. + */ + @JsonProperty(value = "databaseId", required = true) + private String databaseId; + + /* + * The state of the job agent. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private JobAgentState state; + + /** + * 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 JobAgentProperties object itself. + */ + public JobAgentProperties 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (databaseId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property databaseId in model JobAgentProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobAgentProperties.class); +} 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..0ce7c5e3c0ee7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A stored credential that can be used by a job to connect to target databases. */ +@Fluent +public final class JobCredentialInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private JobCredentialProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private JobCredentialProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the username property: The credential user name. + * + * @return the username value. + */ + public String username() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobCredentialProperties(); + } + this.innerProperties().withUsername(username); + return this; + } + + /** + * Get the password property: The credential password. + * + * @return the password value. + */ + public String password() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobCredentialProperties(); + } + this.innerProperties().withPassword(password); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialProperties.java new file mode 100644 index 0000000000000..1fa16294b708f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialProperties.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.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a job credential. */ +@Fluent +public final class JobCredentialProperties { + /* + * The credential user name. + */ + @JsonProperty(value = "username", required = true) + private String username; + + /* + * The credential password. + */ + @JsonProperty(value = "password", required = true) + 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 JobCredentialProperties object itself. + */ + public JobCredentialProperties 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 JobCredentialProperties object itself. + */ + public JobCredentialProperties withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (username() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property username in model JobCredentialProperties")); + } + if (password() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property password in model JobCredentialProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobCredentialProperties.class); +} 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..4b7abc534e91c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +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.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An execution of a job. */ +@Fluent +public final class JobExecutionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private JobExecutionProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private JobExecutionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the jobVersion property: The job version number. + * + * @return the jobVersion value. + */ + public Integer jobVersion() { + return this.innerProperties() == null ? null : this.innerProperties().jobVersion(); + } + + /** + * Get the stepName property: The job step name. + * + * @return the stepName value. + */ + public String stepName() { + return this.innerProperties() == null ? null : this.innerProperties().stepName(); + } + + /** + * Get the stepId property: The job step id. + * + * @return the stepId value. + */ + public Integer stepId() { + return this.innerProperties() == null ? null : this.innerProperties().stepId(); + } + + /** + * Get the jobExecutionId property: The unique identifier of the job execution. + * + * @return the jobExecutionId value. + */ + public UUID jobExecutionId() { + return this.innerProperties() == null ? null : this.innerProperties().jobExecutionId(); + } + + /** + * Get the lifecycle property: The detailed state of the job execution. + * + * @return the lifecycle value. + */ + public JobExecutionLifecycle lifecycle() { + return this.innerProperties() == null ? null : this.innerProperties().lifecycle(); + } + + /** + * Get the provisioningState property: The ARM provisioning state of the job execution. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the createTime property: The time that the job execution was created. + * + * @return the createTime value. + */ + public OffsetDateTime createTime() { + return this.innerProperties() == null ? null : this.innerProperties().createTime(); + } + + /** + * Get the startTime property: The time that the job execution started. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the endTime property: The time that the job execution completed. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Get the currentAttempts property: Number of times the job execution has been attempted. + * + * @return the currentAttempts value. + */ + public Integer currentAttempts() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobExecutionProperties(); + } + this.innerProperties().withCurrentAttempts(currentAttempts); + return this; + } + + /** + * Get the currentAttemptStartTime property: Start time of the current attempt. + * + * @return the currentAttemptStartTime value. + */ + public OffsetDateTime currentAttemptStartTime() { + return this.innerProperties() == null ? null : this.innerProperties().currentAttemptStartTime(); + } + + /** + * Get the lastMessage property: The last status or error message. + * + * @return the lastMessage value. + */ + public String lastMessage() { + return this.innerProperties() == null ? null : this.innerProperties().lastMessage(); + } + + /** + * Get the target property: The target that this execution is executed on. + * + * @return the target value. + */ + public JobExecutionTarget target() { + return this.innerProperties() == null ? null : this.innerProperties().target(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionProperties.java new file mode 100644 index 0000000000000..696f3e9ae1430 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionProperties.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +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.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Properties for an Azure SQL Database Elastic job execution. */ +@Fluent +public final class JobExecutionProperties { + /* + * The job version number. + */ + @JsonProperty(value = "jobVersion", access = JsonProperty.Access.WRITE_ONLY) + private Integer jobVersion; + + /* + * The job step name. + */ + @JsonProperty(value = "stepName", access = JsonProperty.Access.WRITE_ONLY) + private String stepName; + + /* + * The job step id. + */ + @JsonProperty(value = "stepId", access = JsonProperty.Access.WRITE_ONLY) + private Integer stepId; + + /* + * The unique identifier of the job execution. + */ + @JsonProperty(value = "jobExecutionId", access = JsonProperty.Access.WRITE_ONLY) + private UUID jobExecutionId; + + /* + * The detailed state of the job execution. + */ + @JsonProperty(value = "lifecycle", access = JsonProperty.Access.WRITE_ONLY) + private JobExecutionLifecycle lifecycle; + + /* + * The ARM provisioning state of the job execution. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The time that the job execution was created. + */ + @JsonProperty(value = "createTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createTime; + + /* + * The time that the job execution started. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The time that the job execution completed. + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * Number of times the job execution has been attempted. + */ + @JsonProperty(value = "currentAttempts") + private Integer currentAttempts; + + /* + * Start time of the current attempt. + */ + @JsonProperty(value = "currentAttemptStartTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime currentAttemptStartTime; + + /* + * The last status or error message. + */ + @JsonProperty(value = "lastMessage", access = JsonProperty.Access.WRITE_ONLY) + private String lastMessage; + + /* + * The target that this execution is executed on. + */ + @JsonProperty(value = "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 JobExecutionProperties object itself. + */ + public JobExecutionProperties 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..23997f9516ec9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.JobSchedule; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A job. */ +@Fluent +public final class JobInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private JobProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private JobProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the description property: User-defined description of the job. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the version property: The job version number. + * + * @return the version value. + */ + public Integer version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Get the schedule property: Schedule properties of the job. + * + * @return the schedule value. + */ + public JobSchedule schedule() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobProperties(); + } + this.innerProperties().withSchedule(schedule); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobProperties.java new file mode 100644 index 0000000000000..51f18fbb40df2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobProperties.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.Fluent; +import com.azure.resourcemanager.sql.generated.models.JobSchedule; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a job. */ +@Fluent +public final class JobProperties { + /* + * User-defined description of the job. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The job version number. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private Integer version; + + /* + * Schedule properties of the job. + */ + @JsonProperty(value = "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 JobProperties object itself. + */ + public JobProperties 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 JobProperties object itself. + */ + public JobProperties 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..2ecfcd4474e99 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +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.JsonProperty; + +/** A job step. */ +@Fluent +public final class JobStepInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private JobStepProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private JobStepProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobStepProperties(); + } + this.innerProperties().withStepId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobStepProperties(); + } + this.innerProperties().withTargetGroup(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobStepProperties(); + } + this.innerProperties().withCredential(credential); + return this; + } + + /** + * Get the action property: The action payload of the job step. + * + * @return the action value. + */ + public JobStepAction action() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobStepProperties(); + } + this.innerProperties().withAction(action); + return this; + } + + /** + * Get the output property: Output destination properties of the job step. + * + * @return the output value. + */ + public JobStepOutput output() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobStepProperties(); + } + this.innerProperties().withOutput(output); + return this; + } + + /** + * Get the executionOptions property: Execution options for the job step. + * + * @return the executionOptions value. + */ + public JobStepExecutionOptions executionOptions() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobStepProperties(); + } + this.innerProperties().withExecutionOptions(executionOptions); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepProperties.java new file mode 100644 index 0000000000000..16b2a1c885bbb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +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.JsonProperty; + +/** Properties of a job step. */ +@Fluent +public final class JobStepProperties { + /* + * 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 = "stepId") + private Integer stepId; + + /* + * The resource ID of the target group that the job step will be executed + * on. + */ + @JsonProperty(value = "targetGroup", required = true) + private String targetGroup; + + /* + * The resource ID of the job credential that will be used to connect to + * the targets. + */ + @JsonProperty(value = "credential", required = true) + private String credential; + + /* + * The action payload of the job step. + */ + @JsonProperty(value = "action", required = true) + private JobStepAction action; + + /* + * Output destination properties of the job step. + */ + @JsonProperty(value = "output") + private JobStepOutput output; + + /* + * Execution options for the job step. + */ + @JsonProperty(value = "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 JobStepProperties object itself. + */ + public JobStepProperties 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 JobStepProperties object itself. + */ + public JobStepProperties 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 JobStepProperties object itself. + */ + public JobStepProperties 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 JobStepProperties object itself. + */ + public JobStepProperties 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 JobStepProperties object itself. + */ + public JobStepProperties 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 JobStepProperties object itself. + */ + public JobStepProperties withExecutionOptions(JobStepExecutionOptions executionOptions) { + this.executionOptions = executionOptions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetGroup() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property targetGroup in model JobStepProperties")); + } + if (credential() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property credential in model JobStepProperties")); + } + if (action() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property action in model JobStepProperties")); + } else { + action().validate(); + } + if (output() != null) { + output().validate(); + } + if (executionOptions() != null) { + executionOptions().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobStepProperties.class); +} 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..9cb72ff803285 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.JobTarget; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A group of job targets. */ +@Fluent +public final class JobTargetGroupInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private JobTargetGroupProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private JobTargetGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the members property: Members of the target group. + * + * @return the members value. + */ + public List members() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobTargetGroupProperties(); + } + this.innerProperties().withMembers(members); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupProperties.java new file mode 100644 index 0000000000000..2b1f56dbc2403 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.JobTarget; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of job target group. */ +@Fluent +public final class JobTargetGroupProperties { + /* + * Members of the target group. + */ + @JsonProperty(value = "members", required = true) + 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 JobTargetGroupProperties object itself. + */ + public JobTargetGroupProperties 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property members in model JobTargetGroupProperties")); + } else { + members().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobTargetGroupProperties.class); +} 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..25b83c899ccaf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobVersionInner.java @@ -0,0 +1,20 @@ +// Copyright (c) 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; + +/** A job version. */ +@Immutable +public final class JobVersionInner extends ProxyResource { + /** + * 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/LedgerDigestUploadsInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LedgerDigestUploadsInner.java new file mode 100644 index 0000000000000..c741150f33d9f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LedgerDigestUploadsInner.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.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure SQL Database ledger digest upload settings. */ +@Fluent +public final class LedgerDigestUploadsInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private LedgerDigestUploadsProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private LedgerDigestUploadsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the digestStorageEndpoint property: The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + * + * @return the digestStorageEndpoint value. + */ + public String digestStorageEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().digestStorageEndpoint(); + } + + /** + * Set the digestStorageEndpoint property: The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + * + * @param digestStorageEndpoint the digestStorageEndpoint value to set. + * @return the LedgerDigestUploadsInner object itself. + */ + public LedgerDigestUploadsInner withDigestStorageEndpoint(String digestStorageEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new LedgerDigestUploadsProperties(); + } + this.innerProperties().withDigestStorageEndpoint(digestStorageEndpoint); + return this; + } + + /** + * Get the state property: Specifies the state of ledger digest upload. + * + * @return the state value. + */ + public LedgerDigestUploadsState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LedgerDigestUploadsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LedgerDigestUploadsProperties.java new file mode 100644 index 0000000000000..7213287cca64b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LedgerDigestUploadsProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a database ledger digest upload settings. */ +@Fluent +public final class LedgerDigestUploadsProperties { + /* + * The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + */ + @JsonProperty(value = "digestStorageEndpoint") + private String digestStorageEndpoint; + + /* + * Specifies the state of ledger digest upload. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private LedgerDigestUploadsState state; + + /** + * Get the digestStorageEndpoint property: The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + * + * @return the digestStorageEndpoint value. + */ + public String digestStorageEndpoint() { + return this.digestStorageEndpoint; + } + + /** + * Set the digestStorageEndpoint property: The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + * + * @param digestStorageEndpoint the digestStorageEndpoint value to set. + * @return the LedgerDigestUploadsProperties object itself. + */ + public LedgerDigestUploadsProperties withDigestStorageEndpoint(String digestStorageEndpoint) { + this.digestStorageEndpoint = digestStorageEndpoint; + return this; + } + + /** + * Get the state property: Specifies the state of ledger digest upload. + * + * @return the state value. + */ + public LedgerDigestUploadsState 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/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..2b4b3c2f5622e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LocationCapabilitiesInner.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.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.JsonProperty; +import java.util.List; + +/** The location capability. */ +@Fluent +public final class LocationCapabilitiesInner { + /* + * 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/LogicalDatabaseTransparentDataEncryptionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LogicalDatabaseTransparentDataEncryptionInner.java new file mode 100644 index 0000000000000..3029c9b47ba08 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LogicalDatabaseTransparentDataEncryptionInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A logical database transparent data encryption state. */ +@Fluent +public final class LogicalDatabaseTransparentDataEncryptionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private TransparentDataEncryptionProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private TransparentDataEncryptionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: Specifies the state of the transparent data encryption. + * + * @return the state value. + */ + public TransparentDataEncryptionState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the transparent data encryption. + * + * @param state the state value to set. + * @return the LogicalDatabaseTransparentDataEncryptionInner object itself. + */ + public LogicalDatabaseTransparentDataEncryptionInner withState(TransparentDataEncryptionState state) { + if (this.innerProperties() == null) { + this.innerProperties = new TransparentDataEncryptionProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..08b519db135f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupInner.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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A long term retention backup. */ +@Fluent +public final class LongTermRetentionBackupInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private LongTermRetentionBackupProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private LongTermRetentionBackupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the serverName property: The server name that the backup database belong to. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the serverCreateTime property: The create time of the server. + * + * @return the serverCreateTime value. + */ + public OffsetDateTime serverCreateTime() { + return this.innerProperties() == null ? null : this.innerProperties().serverCreateTime(); + } + + /** + * Get the databaseName property: The name of the database the backup belong to. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the databaseDeletionTime property: The delete time of the database. + * + * @return the databaseDeletionTime value. + */ + public OffsetDateTime databaseDeletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().databaseDeletionTime(); + } + + /** + * Get the backupTime property: The time the backup was taken. + * + * @return the backupTime value. + */ + public OffsetDateTime backupTime() { + return this.innerProperties() == null ? null : this.innerProperties().backupTime(); + } + + /** + * Get the backupExpirationTime property: The time the long term retention backup will expire. + * + * @return the backupExpirationTime value. + */ + public OffsetDateTime backupExpirationTime() { + return this.innerProperties() == null ? null : this.innerProperties().backupExpirationTime(); + } + + /** + * Get the backupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the backupStorageRedundancy value. + */ + public BackupStorageRedundancy backupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().backupStorageRedundancy(); + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new LongTermRetentionBackupProperties(); + } + this.innerProperties().withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..05a48c8f35918 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupOperationResultInner.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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** A LongTermRetentionBackup operation result resource. */ +@Fluent +public final class LongTermRetentionBackupOperationResultInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private LongTermRetentionOperationResultProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private LongTermRetentionOperationResultProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the requestId property: Request Id. + * + * @return the requestId value. + */ + public UUID requestId() { + return this.innerProperties() == null ? null : this.innerProperties().requestId(); + } + + /** + * Get the operationType property: Operation type. + * + * @return the operationType value. + */ + public String operationType() { + return this.innerProperties() == null ? null : this.innerProperties().operationType(); + } + + /** + * Get the fromBackupResourceId property: Source backup resource id. + * + * @return the fromBackupResourceId value. + */ + public String fromBackupResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().fromBackupResourceId(); + } + + /** + * Get the toBackupResourceId property: Target backup resource id. + * + * @return the toBackupResourceId value. + */ + public String toBackupResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().toBackupResourceId(); + } + + /** + * Get the targetBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the targetBackupStorageRedundancy value. + */ + public BackupStorageRedundancy targetBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().targetBackupStorageRedundancy(); + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the message property: Progress message. + * + * @return the message value. + */ + public String message() { + return this.innerProperties() == null ? null : this.innerProperties().message(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupProperties.java new file mode 100644 index 0000000000000..b3b324d5070f1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupProperties.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.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of a long term retention backup. */ +@Fluent +public final class LongTermRetentionBackupProperties { + /* + * The server name that the backup database belong to. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The create time of the server. + */ + @JsonProperty(value = "serverCreateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime serverCreateTime; + + /* + * The name of the database the backup belong to + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The delete time of the database + */ + @JsonProperty(value = "databaseDeletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime databaseDeletionTime; + + /* + * The time the backup was taken + */ + @JsonProperty(value = "backupTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime backupTime; + + /* + * The time the long term retention backup will expire. + */ + @JsonProperty(value = "backupExpirationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime backupExpirationTime; + + /* + * The storage redundancy type of the backup + */ + @JsonProperty(value = "backupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy backupStorageRedundancy; + + /* + * The storage redundancy type of the backup + */ + @JsonProperty(value = "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 LongTermRetentionBackupProperties object itself. + */ + public LongTermRetentionBackupProperties 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/LongTermRetentionOperationResultProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionOperationResultProperties.java new file mode 100644 index 0000000000000..ec42013d78705 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionOperationResultProperties.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Contains the operation result properties for long term retention backup operation. */ +@Immutable +public final class LongTermRetentionOperationResultProperties { + /* + * Request Id. + */ + @JsonProperty(value = "requestId", access = JsonProperty.Access.WRITE_ONLY) + private UUID requestId; + + /* + * Operation type. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private String operationType; + + /* + * Source backup resource id + */ + @JsonProperty(value = "fromBackupResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String fromBackupResourceId; + + /* + * Target backup resource id + */ + @JsonProperty(value = "toBackupResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String toBackupResourceId; + + /* + * The storage redundancy type of the copied backup + */ + @JsonProperty(value = "targetBackupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy targetBackupStorageRedundancy; + + /* + * Operation status + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * Progress message + */ + @JsonProperty(value = "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..5f982957b87eb --- /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.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A long term retention policy. */ +@Fluent +public final class LongTermRetentionPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private BaseLongTermRetentionPolicyProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private BaseLongTermRetentionPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withWeeklyRetention(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withMonthlyRetention(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withYearlyRetention(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withWeekOfYear(weekOfYear); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowOptionsInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowOptionsInner.java new file mode 100644 index 0000000000000..168f790923f41 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowOptionsInner.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Maintenance window options. */ +@Fluent +public final class MaintenanceWindowOptionsInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private MaintenanceWindowOptionsProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private MaintenanceWindowOptionsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the isEnabled property: Whether maintenance windows are enabled for the database. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isEnabled(); + } + + /** + * Set the isEnabled property: Whether maintenance windows are enabled for the database. + * + * @param isEnabled the isEnabled value to set. + * @return the MaintenanceWindowOptionsInner object itself. + */ + public MaintenanceWindowOptionsInner withIsEnabled(Boolean isEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowOptionsProperties(); + } + this.innerProperties().withIsEnabled(isEnabled); + return this; + } + + /** + * Get the maintenanceWindowCycles property: Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, + * 24*60}. + * + * @return the maintenanceWindowCycles value. + */ + public List maintenanceWindowCycles() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceWindowCycles(); + } + + /** + * Set the maintenanceWindowCycles property: Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, + * 24*60}. + * + * @param maintenanceWindowCycles the maintenanceWindowCycles value to set. + * @return the MaintenanceWindowOptionsInner object itself. + */ + public MaintenanceWindowOptionsInner withMaintenanceWindowCycles( + List maintenanceWindowCycles) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowOptionsProperties(); + } + this.innerProperties().withMaintenanceWindowCycles(maintenanceWindowCycles); + return this; + } + + /** + * Get the minDurationInMinutes property: Minimum duration of maintenance window. + * + * @return the minDurationInMinutes value. + */ + public Integer minDurationInMinutes() { + return this.innerProperties() == null ? null : this.innerProperties().minDurationInMinutes(); + } + + /** + * Set the minDurationInMinutes property: Minimum duration of maintenance window. + * + * @param minDurationInMinutes the minDurationInMinutes value to set. + * @return the MaintenanceWindowOptionsInner object itself. + */ + public MaintenanceWindowOptionsInner withMinDurationInMinutes(Integer minDurationInMinutes) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowOptionsProperties(); + } + this.innerProperties().withMinDurationInMinutes(minDurationInMinutes); + return this; + } + + /** + * Get the defaultDurationInMinutes property: Default duration for maintenance window. + * + * @return the defaultDurationInMinutes value. + */ + public Integer defaultDurationInMinutes() { + return this.innerProperties() == null ? null : this.innerProperties().defaultDurationInMinutes(); + } + + /** + * Set the defaultDurationInMinutes property: Default duration for maintenance window. + * + * @param defaultDurationInMinutes the defaultDurationInMinutes value to set. + * @return the MaintenanceWindowOptionsInner object itself. + */ + public MaintenanceWindowOptionsInner withDefaultDurationInMinutes(Integer defaultDurationInMinutes) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowOptionsProperties(); + } + this.innerProperties().withDefaultDurationInMinutes(defaultDurationInMinutes); + return this; + } + + /** + * Get the minCycles property: Minimum number of maintenance windows cycles to be set on the database. + * + * @return the minCycles value. + */ + public Integer minCycles() { + return this.innerProperties() == null ? null : this.innerProperties().minCycles(); + } + + /** + * Set the minCycles property: Minimum number of maintenance windows cycles to be set on the database. + * + * @param minCycles the minCycles value to set. + * @return the MaintenanceWindowOptionsInner object itself. + */ + public MaintenanceWindowOptionsInner withMinCycles(Integer minCycles) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowOptionsProperties(); + } + this.innerProperties().withMinCycles(minCycles); + return this; + } + + /** + * Get the timeGranularityInMinutes property: Time granularity in minutes for maintenance windows. + * + * @return the timeGranularityInMinutes value. + */ + public Integer timeGranularityInMinutes() { + return this.innerProperties() == null ? null : this.innerProperties().timeGranularityInMinutes(); + } + + /** + * Set the timeGranularityInMinutes property: Time granularity in minutes for maintenance windows. + * + * @param timeGranularityInMinutes the timeGranularityInMinutes value to set. + * @return the MaintenanceWindowOptionsInner object itself. + */ + public MaintenanceWindowOptionsInner withTimeGranularityInMinutes(Integer timeGranularityInMinutes) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowOptionsProperties(); + } + this.innerProperties().withTimeGranularityInMinutes(timeGranularityInMinutes); + return this; + } + + /** + * Get the allowMultipleMaintenanceWindowsPerCycle property: Whether we allow multiple maintenance windows per + * cycle. + * + * @return the allowMultipleMaintenanceWindowsPerCycle value. + */ + public Boolean allowMultipleMaintenanceWindowsPerCycle() { + return this.innerProperties() == null ? null : this.innerProperties().allowMultipleMaintenanceWindowsPerCycle(); + } + + /** + * Set the allowMultipleMaintenanceWindowsPerCycle property: Whether we allow multiple maintenance windows per + * cycle. + * + * @param allowMultipleMaintenanceWindowsPerCycle the allowMultipleMaintenanceWindowsPerCycle value to set. + * @return the MaintenanceWindowOptionsInner object itself. + */ + public MaintenanceWindowOptionsInner withAllowMultipleMaintenanceWindowsPerCycle( + Boolean allowMultipleMaintenanceWindowsPerCycle) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowOptionsProperties(); + } + this.innerProperties().withAllowMultipleMaintenanceWindowsPerCycle(allowMultipleMaintenanceWindowsPerCycle); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowOptionsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowOptionsProperties.java new file mode 100644 index 0000000000000..dfc1846be70f5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowOptionsProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Maintenance window options properties. */ +@Fluent +public final class MaintenanceWindowOptionsProperties { + /* + * Whether maintenance windows are enabled for the database. + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /* + * Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, + * 24*60}. + */ + @JsonProperty(value = "maintenanceWindowCycles") + private List maintenanceWindowCycles; + + /* + * Minimum duration of maintenance window. + */ + @JsonProperty(value = "minDurationInMinutes") + private Integer minDurationInMinutes; + + /* + * Default duration for maintenance window. + */ + @JsonProperty(value = "defaultDurationInMinutes") + private Integer defaultDurationInMinutes; + + /* + * Minimum number of maintenance windows cycles to be set on the database. + */ + @JsonProperty(value = "minCycles") + private Integer minCycles; + + /* + * Time granularity in minutes for maintenance windows. + */ + @JsonProperty(value = "timeGranularityInMinutes") + private Integer timeGranularityInMinutes; + + /* + * Whether we allow multiple maintenance windows per cycle. + */ + @JsonProperty(value = "allowMultipleMaintenanceWindowsPerCycle") + private Boolean allowMultipleMaintenanceWindowsPerCycle; + + /** + * Get the isEnabled property: Whether maintenance windows are enabled for the database. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Whether maintenance windows are enabled for the database. + * + * @param isEnabled the isEnabled value to set. + * @return the MaintenanceWindowOptionsProperties object itself. + */ + public MaintenanceWindowOptionsProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the maintenanceWindowCycles property: Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, + * 24*60}. + * + * @return the maintenanceWindowCycles value. + */ + public List maintenanceWindowCycles() { + return this.maintenanceWindowCycles; + } + + /** + * Set the maintenanceWindowCycles property: Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, + * 24*60}. + * + * @param maintenanceWindowCycles the maintenanceWindowCycles value to set. + * @return the MaintenanceWindowOptionsProperties object itself. + */ + public MaintenanceWindowOptionsProperties withMaintenanceWindowCycles( + List maintenanceWindowCycles) { + this.maintenanceWindowCycles = maintenanceWindowCycles; + return this; + } + + /** + * Get the minDurationInMinutes property: Minimum duration of maintenance window. + * + * @return the minDurationInMinutes value. + */ + public Integer minDurationInMinutes() { + return this.minDurationInMinutes; + } + + /** + * Set the minDurationInMinutes property: Minimum duration of maintenance window. + * + * @param minDurationInMinutes the minDurationInMinutes value to set. + * @return the MaintenanceWindowOptionsProperties object itself. + */ + public MaintenanceWindowOptionsProperties withMinDurationInMinutes(Integer minDurationInMinutes) { + this.minDurationInMinutes = minDurationInMinutes; + return this; + } + + /** + * Get the defaultDurationInMinutes property: Default duration for maintenance window. + * + * @return the defaultDurationInMinutes value. + */ + public Integer defaultDurationInMinutes() { + return this.defaultDurationInMinutes; + } + + /** + * Set the defaultDurationInMinutes property: Default duration for maintenance window. + * + * @param defaultDurationInMinutes the defaultDurationInMinutes value to set. + * @return the MaintenanceWindowOptionsProperties object itself. + */ + public MaintenanceWindowOptionsProperties withDefaultDurationInMinutes(Integer defaultDurationInMinutes) { + this.defaultDurationInMinutes = defaultDurationInMinutes; + return this; + } + + /** + * Get the minCycles property: Minimum number of maintenance windows cycles to be set on the database. + * + * @return the minCycles value. + */ + public Integer minCycles() { + return this.minCycles; + } + + /** + * Set the minCycles property: Minimum number of maintenance windows cycles to be set on the database. + * + * @param minCycles the minCycles value to set. + * @return the MaintenanceWindowOptionsProperties object itself. + */ + public MaintenanceWindowOptionsProperties withMinCycles(Integer minCycles) { + this.minCycles = minCycles; + return this; + } + + /** + * Get the timeGranularityInMinutes property: Time granularity in minutes for maintenance windows. + * + * @return the timeGranularityInMinutes value. + */ + public Integer timeGranularityInMinutes() { + return this.timeGranularityInMinutes; + } + + /** + * Set the timeGranularityInMinutes property: Time granularity in minutes for maintenance windows. + * + * @param timeGranularityInMinutes the timeGranularityInMinutes value to set. + * @return the MaintenanceWindowOptionsProperties object itself. + */ + public MaintenanceWindowOptionsProperties withTimeGranularityInMinutes(Integer timeGranularityInMinutes) { + this.timeGranularityInMinutes = timeGranularityInMinutes; + return this; + } + + /** + * Get the allowMultipleMaintenanceWindowsPerCycle property: Whether we allow multiple maintenance windows per + * cycle. + * + * @return the allowMultipleMaintenanceWindowsPerCycle value. + */ + public Boolean allowMultipleMaintenanceWindowsPerCycle() { + return this.allowMultipleMaintenanceWindowsPerCycle; + } + + /** + * Set the allowMultipleMaintenanceWindowsPerCycle property: Whether we allow multiple maintenance windows per + * cycle. + * + * @param allowMultipleMaintenanceWindowsPerCycle the allowMultipleMaintenanceWindowsPerCycle value to set. + * @return the MaintenanceWindowOptionsProperties object itself. + */ + public MaintenanceWindowOptionsProperties withAllowMultipleMaintenanceWindowsPerCycle( + Boolean allowMultipleMaintenanceWindowsPerCycle) { + this.allowMultipleMaintenanceWindowsPerCycle = allowMultipleMaintenanceWindowsPerCycle; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (maintenanceWindowCycles() != null) { + maintenanceWindowCycles().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowsInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowsInner.java new file mode 100644 index 0000000000000..4e841485950e7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowsInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Maintenance windows. */ +@Fluent +public final class MaintenanceWindowsInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private MaintenanceWindowsProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private MaintenanceWindowsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the timeRanges property: The timeRanges property. + * + * @return the timeRanges value. + */ + public List timeRanges() { + return this.innerProperties() == null ? null : this.innerProperties().timeRanges(); + } + + /** + * Set the timeRanges property: The timeRanges property. + * + * @param timeRanges the timeRanges value to set. + * @return the MaintenanceWindowsInner object itself. + */ + public MaintenanceWindowsInner withTimeRanges(List timeRanges) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowsProperties(); + } + this.innerProperties().withTimeRanges(timeRanges); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowsProperties.java new file mode 100644 index 0000000000000..b8acf02cf546a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowsProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Maintenance windows resource properties. */ +@Fluent +public final class MaintenanceWindowsProperties { + /* + * The timeRanges property. + */ + @JsonProperty(value = "timeRanges") + private List timeRanges; + + /** + * Get the timeRanges property: The timeRanges property. + * + * @return the timeRanges value. + */ + public List timeRanges() { + return this.timeRanges; + } + + /** + * Set the timeRanges property: The timeRanges property. + * + * @param timeRanges the timeRanges value to set. + * @return the MaintenanceWindowsProperties object itself. + */ + public MaintenanceWindowsProperties withTimeRanges(List timeRanges) { + this.timeRanges = timeRanges; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (timeRanges() != null) { + timeRanges().forEach(e -> e.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..f03118a0edc68 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A short term retention policy. */ +@Fluent +public final class ManagedBackupShortTermRetentionPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedBackupShortTermRetentionPolicyProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedBackupShortTermRetentionPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedBackupShortTermRetentionPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyProperties.java new file mode 100644 index 0000000000000..a1a7f791450cf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a short term retention policy. */ +@Fluent +public final class ManagedBackupShortTermRetentionPolicyProperties { + /* + * The backup retention period in days. This is how many days Point-in-Time + * Restore will be supported. + */ + @JsonProperty(value = "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 ManagedBackupShortTermRetentionPolicyProperties object itself. + */ + public ManagedBackupShortTermRetentionPolicyProperties 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..87a5c47acef80 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseInner.java @@ -0,0 +1,408 @@ +// Copyright (c) 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.management.Resource; +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.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** A managed database resource. */ +@Fluent +public final class ManagedDatabaseInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedDatabaseProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ManagedDatabaseInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ManagedDatabaseInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the collation property: Collation of the managed database. + * + * @return the collation value. + */ + public String collation() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withCollation(collation); + return this; + } + + /** + * Get the status property: Status of the database. + * + * @return the status value. + */ + public ManagedDatabaseStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the creationDate property: Creation date of the database. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the earliestRestorePoint property: Earliest restore point in time for point in time restore. + * + * @return the earliestRestorePoint value. + */ + public OffsetDateTime earliestRestorePoint() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withRestorePointInTime(restorePointInTime); + return this; + } + + /** + * Get the defaultSecondaryLocation property: Geo paired region. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.innerProperties() == null ? null : this.innerProperties().defaultSecondaryLocation(); + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withCatalogCollation(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withCreateMode(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withStorageContainerUri(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withSourceDatabaseId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withRestorableDroppedDatabaseId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withStorageContainerSasToken(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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withRecoverableDatabaseId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withLongTermRetentionBackupResourceId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withAutoCompleteRestore(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withLastBackupName(lastBackupName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseProperties.java new file mode 100644 index 0000000000000..6e1fb62b5ed4b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +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.JsonProperty; +import java.time.OffsetDateTime; + +/** The managed database's properties. */ +@Fluent +public final class ManagedDatabaseProperties { + /* + * Collation of the managed database. + */ + @JsonProperty(value = "collation") + private String collation; + + /* + * Status of the database. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ManagedDatabaseStatus status; + + /* + * Creation date of the database. + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * Earliest restore point in time for point in time restore. + */ + @JsonProperty(value = "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 = "restorePointInTime") + private OffsetDateTime restorePointInTime; + + /* + * Geo paired region. + */ + @JsonProperty(value = "defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /* + * Collation of the metadata catalog. + */ + @JsonProperty(value = "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 = "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 = "storageContainerUri") + private String storageContainerUri; + + /* + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "sourceDatabaseId") + private String sourceDatabaseId; + + /* + * The restorable dropped database resource id to restore when creating + * this database. + */ + @JsonProperty(value = "restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /* + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + */ + @JsonProperty(value = "storageContainerSasToken") + private String storageContainerSasToken; + + /* + * Instance Failover Group resource identifier that this managed database + * belongs to. + */ + @JsonProperty(value = "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 = "recoverableDatabaseId") + private String recoverableDatabaseId; + + /* + * The name of the Long Term Retention backup to be used for restore of + * this managed database. + */ + @JsonProperty(value = "longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /* + * Whether to auto complete restore of this managed database. + */ + @JsonProperty(value = "autoCompleteRestore") + private Boolean autoCompleteRestore; + + /* + * Last backup file name for restore of this managed database. + */ + @JsonProperty(value = "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 ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties 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 ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties 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 ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties 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 ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties 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 ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties 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 ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties 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 ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties 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 ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties 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 ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties 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 ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties 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 ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties 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 ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties 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/fluent/models/ManagedDatabaseRestoreDetailsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseRestoreDetailsProperties.java new file mode 100644 index 0000000000000..fa47afc31dca4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseRestoreDetailsProperties.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The managed database's restore details properties. */ +@Immutable +public final class ManagedDatabaseRestoreDetailsProperties { + /* + * Restore status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * Current restoring file name. + */ + @JsonProperty(value = "currentRestoringFileName", access = JsonProperty.Access.WRITE_ONLY) + private String currentRestoringFileName; + + /* + * Last restored file name. + */ + @JsonProperty(value = "lastRestoredFileName", access = JsonProperty.Access.WRITE_ONLY) + private String lastRestoredFileName; + + /* + * Last restored file time. + */ + @JsonProperty(value = "lastRestoredFileTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastRestoredFileTime; + + /* + * Percent completed. + */ + @JsonProperty(value = "percentCompleted", access = JsonProperty.Access.WRITE_ONLY) + private Double percentCompleted; + + /* + * List of unrestorable files. + */ + @JsonProperty(value = "unrestorableFiles", access = JsonProperty.Access.WRITE_ONLY) + private List unrestorableFiles; + + /* + * Number of files detected. + */ + @JsonProperty(value = "numberOfFilesDetected", access = JsonProperty.Access.WRITE_ONLY) + private Long numberOfFilesDetected; + + /* + * Last uploaded file name. + */ + @JsonProperty(value = "lastUploadedFileName", access = JsonProperty.Access.WRITE_ONLY) + private String lastUploadedFileName; + + /* + * Last uploaded file time. + */ + @JsonProperty(value = "lastUploadedFileTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUploadedFileTime; + + /* + * The reason why restore is in Blocked state. + */ + @JsonProperty(value = "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/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..4403f55640c88 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseRestoreDetailsResultInner.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.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A managed database restore details. */ +@Fluent +public final class ManagedDatabaseRestoreDetailsResultInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedDatabaseRestoreDetailsProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedDatabaseRestoreDetailsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the status property: Restore status. + * + * @return the status value. + */ + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the currentRestoringFileName property: Current restoring file name. + * + * @return the currentRestoringFileName value. + */ + public String currentRestoringFileName() { + return this.innerProperties() == null ? null : this.innerProperties().currentRestoringFileName(); + } + + /** + * Get the lastRestoredFileName property: Last restored file name. + * + * @return the lastRestoredFileName value. + */ + public String lastRestoredFileName() { + return this.innerProperties() == null ? null : this.innerProperties().lastRestoredFileName(); + } + + /** + * Get the lastRestoredFileTime property: Last restored file time. + * + * @return the lastRestoredFileTime value. + */ + public OffsetDateTime lastRestoredFileTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastRestoredFileTime(); + } + + /** + * Get the percentCompleted property: Percent completed. + * + * @return the percentCompleted value. + */ + public Double percentCompleted() { + return this.innerProperties() == null ? null : this.innerProperties().percentCompleted(); + } + + /** + * Get the unrestorableFiles property: List of unrestorable files. + * + * @return the unrestorableFiles value. + */ + public List unrestorableFiles() { + return this.innerProperties() == null ? null : this.innerProperties().unrestorableFiles(); + } + + /** + * Get the numberOfFilesDetected property: Number of files detected. + * + * @return the numberOfFilesDetected value. + */ + public Long numberOfFilesDetected() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfFilesDetected(); + } + + /** + * Get the lastUploadedFileName property: Last uploaded file name. + * + * @return the lastUploadedFileName value. + */ + public String lastUploadedFileName() { + return this.innerProperties() == null ? null : this.innerProperties().lastUploadedFileName(); + } + + /** + * Get the lastUploadedFileTime property: Last uploaded file time. + * + * @return the lastUploadedFileTime value. + */ + public OffsetDateTime lastUploadedFileTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastUploadedFileTime(); + } + + /** + * Get the blockReason property: The reason why restore is in Blocked state. + * + * @return the blockReason value. + */ + public String blockReason() { + return this.innerProperties() == null ? null : this.innerProperties().blockReason(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().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..0b55f2a8c136b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseSecurityAlertPolicyInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A managed database security alert policy. */ +@Fluent +public final class ManagedDatabaseSecurityAlertPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SecurityAlertPolicyProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SecurityAlertPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withState(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, Brute_Force. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.innerProperties() == null ? null : this.innerProperties().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, Brute_Force. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withDisabledAlerts(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withEmailAddresses(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withEmailAccountAdmins(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.innerProperties() == null ? null : this.innerProperties().creationTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().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..1df99ff18dea6 --- /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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministratorType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** An Azure SQL managed instance administrator. */ +@Fluent +public final class ManagedInstanceAdministratorInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceAdministratorProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceAdministratorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the administratorType property: Type of the managed instance administrator. + * + * @return the administratorType value. + */ + public ManagedInstanceAdministratorType administratorType() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceAdministratorProperties(); + } + this.innerProperties().withAdministratorType(administratorType); + return this; + } + + /** + * Get the login property: Login name of the managed instance administrator. + * + * @return the login value. + */ + public String login() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceAdministratorProperties(); + } + this.innerProperties().withLogin(login); + return this; + } + + /** + * Get the sid property: SID (object ID) of the managed instance administrator. + * + * @return the sid value. + */ + public UUID sid() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceAdministratorProperties(); + } + this.innerProperties().withSid(sid); + return this; + } + + /** + * Get the tenantId property: Tenant ID of the managed instance administrator. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceAdministratorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdministratorProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdministratorProperties.java new file mode 100644 index 0000000000000..6aa4f9299e792 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdministratorProperties.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.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministratorType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** The properties of a managed instance administrator. */ +@Fluent +public final class ManagedInstanceAdministratorProperties { + /* + * Type of the managed instance administrator. + */ + @JsonProperty(value = "administratorType", required = true) + private ManagedInstanceAdministratorType administratorType; + + /* + * Login name of the managed instance administrator. + */ + @JsonProperty(value = "login", required = true) + private String login; + + /* + * SID (object ID) of the managed instance administrator. + */ + @JsonProperty(value = "sid", required = true) + private UUID sid; + + /* + * Tenant ID of the managed instance administrator. + */ + @JsonProperty(value = "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 ManagedInstanceAdministratorProperties object itself. + */ + public ManagedInstanceAdministratorProperties 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 ManagedInstanceAdministratorProperties object itself. + */ + public ManagedInstanceAdministratorProperties 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 ManagedInstanceAdministratorProperties object itself. + */ + public ManagedInstanceAdministratorProperties 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 ManagedInstanceAdministratorProperties object itself. + */ + public ManagedInstanceAdministratorProperties withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (administratorType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorType in model ManagedInstanceAdministratorProperties")); + } + if (login() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property login in model ManagedInstanceAdministratorProperties")); + } + if (sid() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sid in model ManagedInstanceAdministratorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceAdministratorProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthProperties.java new file mode 100644 index 0000000000000..ac026036b7f8a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a active directory only authentication for Managed Instance. */ +@Fluent +public final class ManagedInstanceAzureADOnlyAuthProperties { + /* + * Azure Active Directory only Authentication enabled. + */ + @JsonProperty(value = "azureADOnlyAuthentication", required = true) + 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 ManagedInstanceAzureADOnlyAuthProperties object itself. + */ + public ManagedInstanceAzureADOnlyAuthProperties 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/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..fcb1c8e9d1e84 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthenticationInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure Active Directory only authentication. */ +@Fluent +public final class ManagedInstanceAzureADOnlyAuthenticationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceAzureADOnlyAuthProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceAzureADOnlyAuthProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + public Boolean azureADOnlyAuthentication() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceAzureADOnlyAuthProperties(); + } + this.innerProperties().withAzureADOnlyAuthentication(azureADOnlyAuthentication); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..3fc96cb42ed18 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The managed instance encryption protector. */ +@Fluent +public final class ManagedInstanceEncryptionProtectorInner extends ProxyResource { + /* + * 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 properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceEncryptionProtectorProperties innerProperties; + + /** + * 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceEncryptionProtectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the serverKeyName property: The name of the managed instance key. + * + * @return the serverKeyName value. + */ + public String serverKeyName() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceEncryptionProtectorProperties(); + } + this.innerProperties().withServerKeyName(serverKeyName); + return this; + } + + /** + * Get the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceEncryptionProtectorProperties(); + } + this.innerProperties().withServerKeyType(serverKeyType); + return this; + } + + /** + * Get the uri property: The URI of the server key. + * + * @return the uri value. + */ + public String uri() { + return this.innerProperties() == null ? null : this.innerProperties().uri(); + } + + /** + * Get the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.innerProperties() == null ? null : this.innerProperties().thumbprint(); + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().autoRotationEnabled(); + } + + /** + * Set the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @param autoRotationEnabled the autoRotationEnabled value to set. + * @return the ManagedInstanceEncryptionProtectorInner object itself. + */ + public ManagedInstanceEncryptionProtectorInner withAutoRotationEnabled(Boolean autoRotationEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceEncryptionProtectorProperties(); + } + this.innerProperties().withAutoRotationEnabled(autoRotationEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorProperties.java new file mode 100644 index 0000000000000..20bffb8221996 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorProperties.java @@ -0,0 +1,139 @@ +// Copyright (c) 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.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for an encryption protector execution. */ +@Fluent +public final class ManagedInstanceEncryptionProtectorProperties { + /* + * The name of the managed instance key. + */ + @JsonProperty(value = "serverKeyName") + private String serverKeyName; + + /* + * The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /* + * The URI of the server key. + */ + @JsonProperty(value = "uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /* + * Thumbprint of the server key. + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * Key auto rotation opt-in flag. Either true or false. + */ + @JsonProperty(value = "autoRotationEnabled") + private Boolean autoRotationEnabled; + + /** + * 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 ManagedInstanceEncryptionProtectorProperties object itself. + */ + public ManagedInstanceEncryptionProtectorProperties 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 ManagedInstanceEncryptionProtectorProperties object itself. + */ + public ManagedInstanceEncryptionProtectorProperties 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; + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.autoRotationEnabled; + } + + /** + * Set the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @param autoRotationEnabled the autoRotationEnabled value to set. + * @return the ManagedInstanceEncryptionProtectorProperties object itself. + */ + public ManagedInstanceEncryptionProtectorProperties withAutoRotationEnabled(Boolean autoRotationEnabled) { + this.autoRotationEnabled = autoRotationEnabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverKeyType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property serverKeyType in model" + + " ManagedInstanceEncryptionProtectorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceEncryptionProtectorProperties.class); +} 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..aa79ff4ec2938 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceInner.java @@ -0,0 +1,753 @@ +// Copyright (c) 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.management.Resource; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceExternalAdministrator; +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.ServicePrincipal; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An Azure SQL managed instance. */ +@Fluent +public final class ManagedInstanceInner extends Resource { + /* + * 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; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceProperties innerProperties; + + /** + * 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ManagedInstanceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ManagedInstanceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ManagedInstancePropertiesProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withManagedInstanceCreateMode(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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withAdministratorLogin(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + /** + * Get the subnetId property: Subnet resource ID for the managed instance. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withSubnetId(subnetId); + return this; + } + + /** + * Get the state property: The state of the managed instance. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withLicenseType(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withVCores(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withStorageSizeInGB(storageSizeInGB); + return this; + } + + /** + * Get the collation property: Collation of the managed instance. + * + * @return the collation value. + */ + public String collation() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withCollation(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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withDnsZonePartner(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withPublicDataEndpointEnabled(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withSourceManagedInstanceId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withRestorePointInTime(restorePointInTime); + return this; + } + + /** + * Get the proxyOverride property: Connection type used for connecting to the instance. + * + * @return the proxyOverride value. + */ + public ManagedInstanceProxyOverride proxyOverride() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withProxyOverride(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withTimezoneId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withInstancePoolId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withMaintenanceConfigurationId(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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** + * Get the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the currentBackupStorageRedundancy value. + */ + public BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().currentBackupStorageRedundancy(); + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().requestedBackupStorageRedundancy(); + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } + + /** + * Get the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withZoneRedundant(zoneRedundant); + return this; + } + + /** + * Get the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + public String primaryUserAssignedIdentityId() { + return this.innerProperties() == null ? null : this.innerProperties().primaryUserAssignedIdentityId(); + } + + /** + * Set the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } + + /** + * Get the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + public String keyId() { + return this.innerProperties() == null ? null : this.innerProperties().keyId(); + } + + /** + * Set the keyId property: A CMK URI of the key to use for encryption. + * + * @param keyId the keyId value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withKeyId(String keyId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withKeyId(keyId); + return this; + } + + /** + * Get the administrators property: The Azure Active Directory administrator of the server. + * + * @return the administrators value. + */ + public ManagedInstanceExternalAdministrator administrators() { + return this.innerProperties() == null ? null : this.innerProperties().administrators(); + } + + /** + * Set the administrators property: The Azure Active Directory administrator of the server. + * + * @param administrators the administrators value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withAdministrators(ManagedInstanceExternalAdministrator administrators) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withAdministrators(administrators); + return this; + } + + /** + * Get the servicePrincipal property: The managed instance's service principal. + * + * @return the servicePrincipal value. + */ + public ServicePrincipal servicePrincipal() { + return this.innerProperties() == null ? null : this.innerProperties().servicePrincipal(); + } + + /** + * Set the servicePrincipal property: The managed instance's service principal. + * + * @param servicePrincipal the servicePrincipal value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withServicePrincipal(ServicePrincipal servicePrincipal) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withServicePrincipal(servicePrincipal); + 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 (innerProperties() != null) { + innerProperties().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..7aef2e6369b91 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyInner.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.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A managed instance key. */ +@Fluent +public final class ManagedInstanceKeyInner extends ProxyResource { + /* + * 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 properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceKeyProperties innerProperties; + + /** + * 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceKeyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the serverKeyType property: The key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceKeyProperties(); + } + this.innerProperties().withServerKeyType(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceKeyProperties(); + } + this.innerProperties().withUri(uri); + return this; + } + + /** + * Get the thumbprint property: Thumbprint of the key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.innerProperties() == null ? null : this.innerProperties().thumbprint(); + } + + /** + * Get the creationDate property: The key creation date. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().autoRotationEnabled(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyProperties.java new file mode 100644 index 0000000000000..288a39ff335d4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties for a key execution. */ +@Fluent +public final class ManagedInstanceKeyProperties { + /* + * The key type like 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /* + * The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI + * is required. + */ + @JsonProperty(value = "uri") + private String uri; + + /* + * Thumbprint of the key. + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * The key creation date. + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * Key auto rotation opt-in flag. Either true or false. + */ + @JsonProperty(value = "autoRotationEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean autoRotationEnabled; + + /** + * 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 ManagedInstanceKeyProperties object itself. + */ + public ManagedInstanceKeyProperties 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 ManagedInstanceKeyProperties object itself. + */ + public ManagedInstanceKeyProperties 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; + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.autoRotationEnabled; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverKeyType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property serverKeyType in model ManagedInstanceKeyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceKeyProperties.class); +} 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..df7ac85ca9a46 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupInner.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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A long term retention backup for a managed database. */ +@Fluent +public final class ManagedInstanceLongTermRetentionBackupInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceLongTermRetentionBackupProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceLongTermRetentionBackupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the managedInstanceName property: The managed instance that the backup database belongs to. + * + * @return the managedInstanceName value. + */ + public String managedInstanceName() { + return this.innerProperties() == null ? null : this.innerProperties().managedInstanceName(); + } + + /** + * Get the managedInstanceCreateTime property: The create time of the instance. + * + * @return the managedInstanceCreateTime value. + */ + public OffsetDateTime managedInstanceCreateTime() { + return this.innerProperties() == null ? null : this.innerProperties().managedInstanceCreateTime(); + } + + /** + * Get the databaseName property: The name of the database the backup belong to. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the databaseDeletionTime property: The delete time of the database. + * + * @return the databaseDeletionTime value. + */ + public OffsetDateTime databaseDeletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().databaseDeletionTime(); + } + + /** + * Get the backupTime property: The time the backup was taken. + * + * @return the backupTime value. + */ + public OffsetDateTime backupTime() { + return this.innerProperties() == null ? null : this.innerProperties().backupTime(); + } + + /** + * Get the backupExpirationTime property: The time the long term retention backup will expire. + * + * @return the backupExpirationTime value. + */ + public OffsetDateTime backupExpirationTime() { + return this.innerProperties() == null ? null : this.innerProperties().backupExpirationTime(); + } + + /** + * Get the backupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the backupStorageRedundancy value. + */ + public BackupStorageRedundancy backupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().backupStorageRedundancy(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupProperties.java new file mode 100644 index 0000000000000..b23f1ea7370b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupProperties.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of a long term retention backup. */ +@Immutable +public final class ManagedInstanceLongTermRetentionBackupProperties { + /* + * The managed instance that the backup database belongs to. + */ + @JsonProperty(value = "managedInstanceName", access = JsonProperty.Access.WRITE_ONLY) + private String managedInstanceName; + + /* + * The create time of the instance. + */ + @JsonProperty(value = "managedInstanceCreateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime managedInstanceCreateTime; + + /* + * The name of the database the backup belong to + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The delete time of the database + */ + @JsonProperty(value = "databaseDeletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime databaseDeletionTime; + + /* + * The time the backup was taken + */ + @JsonProperty(value = "backupTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime backupTime; + + /* + * The time the long term retention backup will expire. + */ + @JsonProperty(value = "backupExpirationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime backupExpirationTime; + + /* + * The storage redundancy type of the backup + */ + @JsonProperty(value = "backupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy backupStorageRedundancy; + + /** + * 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; + } + + /** + * Get the backupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the backupStorageRedundancy value. + */ + public BackupStorageRedundancy backupStorageRedundancy() { + return this.backupStorageRedundancy; + } + + /** + * 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..a76c90ba74cae --- /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.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A long term retention policy. */ +@Fluent +public final class ManagedInstanceLongTermRetentionPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private BaseLongTermRetentionPolicyProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private BaseLongTermRetentionPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withWeeklyRetention(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withMonthlyRetention(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withYearlyRetention(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withWeekOfYear(weekOfYear); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..5613be7c627a5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +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.JsonProperty; +import java.time.OffsetDateTime; + +/** A managed instance operation. */ +@Fluent +public final class ManagedInstanceOperationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceOperationProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceOperationProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().managedInstanceName(); + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.innerProperties() == null ? null : this.innerProperties().operation(); + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.innerProperties() == null ? null : this.innerProperties().operationFriendlyName(); + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public ManagementOperationState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.innerProperties() == null ? null : this.innerProperties().errorDescription(); + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.innerProperties() == null ? null : this.innerProperties().errorSeverity(); + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.innerProperties() == null ? null : this.innerProperties().isUserError(); + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().estimatedCompletionTime(); + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.innerProperties() == null ? null : this.innerProperties().isCancellable(); + } + + /** + * Get the operationParameters property: The operation parameters. + * + * @return the operationParameters value. + */ + public ManagedInstanceOperationParametersPair operationParameters() { + return this.innerProperties() == null ? null : this.innerProperties().operationParameters(); + } + + /** + * Get the operationSteps property: The operation steps. + * + * @return the operationSteps value. + */ + public ManagedInstanceOperationSteps operationSteps() { + return this.innerProperties() == null ? null : this.innerProperties().operationSteps(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationProperties.java new file mode 100644 index 0000000000000..aa5c79f46ec13 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationProperties.java @@ -0,0 +1,255 @@ +// Copyright (c) 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.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.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a managed instance operation. */ +@Immutable +public final class ManagedInstanceOperationProperties { + /* + * The name of the managed instance the operation is being performed on. + */ + @JsonProperty(value = "managedInstanceName", access = JsonProperty.Access.WRITE_ONLY) + private String managedInstanceName; + + /* + * The name of operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The friendly name of operation. + */ + @JsonProperty(value = "operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /* + * The percentage of the operation completed. + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The operation start time. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The operation state. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private ManagementOperationState state; + + /* + * The operation error code. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The operation error description. + */ + @JsonProperty(value = "errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /* + * The operation error severity. + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * Whether or not the error is a user error. + */ + @JsonProperty(value = "isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /* + * The estimated completion time of the operation. + */ + @JsonProperty(value = "estimatedCompletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime estimatedCompletionTime; + + /* + * The operation description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Whether the operation can be cancelled. + */ + @JsonProperty(value = "isCancellable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isCancellable; + + /* + * The operation parameters. + */ + @JsonProperty(value = "operationParameters", access = JsonProperty.Access.WRITE_ONLY) + private ManagedInstanceOperationParametersPair operationParameters; + + /* + * The operation steps. + */ + @JsonProperty(value = "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/ManagedInstancePrivateEndpointConnectionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..1905af66557e0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateEndpointConnectionInner.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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointProperty; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection. */ +@Fluent +public final class ManagedInstancePrivateEndpointConnectionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstancePrivateEndpointConnectionProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstancePrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public ManagedInstancePrivateEndpointProperty privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the ManagedInstancePrivateEndpointConnectionInner object itself. + */ + public ManagedInstancePrivateEndpointConnectionInner withPrivateEndpoint( + ManagedInstancePrivateEndpointProperty privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstancePrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the ManagedInstancePrivateEndpointConnectionInner object itself. + */ + public ManagedInstancePrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( + ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstancePrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: State of the Private Endpoint Connection. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateEndpointConnectionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..afb7b850d92ad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateEndpointConnectionProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointProperty; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a private endpoint connection. */ +@Fluent +public final class ManagedInstancePrivateEndpointConnectionProperties { + /* + * 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/fluent/models/ManagedInstancePrivateLinkInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateLinkInner.java new file mode 100644 index 0000000000000..cd3612382a86c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateLinkInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private link resource. */ +@Immutable +public final class ManagedInstancePrivateLinkInner extends ProxyResource { + /* + * The private link resource group id. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private ManagedInstancePrivateLinkProperties properties; + + /** + * Get the properties property: The private link resource group id. + * + * @return the properties value. + */ + public ManagedInstancePrivateLinkProperties 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/ManagedInstanceProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceProperties.java new file mode 100644 index 0000000000000..06150862420cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceProperties.java @@ -0,0 +1,804 @@ +// Copyright (c) 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.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceExternalAdministrator; +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.ServicePrincipal; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The properties of a managed instance. */ +@Fluent +public final class ManagedInstanceProperties { + /* + * The provisioningState property. + */ + @JsonProperty(value = "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 = "managedInstanceCreateMode") + private ManagedServerCreateMode managedInstanceCreateMode; + + /* + * The fully qualified domain name of the managed instance. + */ + @JsonProperty(value = "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 = "administratorLogin") + private String administratorLogin; + + /* + * The administrator login password (required for managed instance + * creation). + */ + @JsonProperty(value = "administratorLoginPassword") + private String administratorLoginPassword; + + /* + * Subnet resource ID for the managed instance. + */ + @JsonProperty(value = "subnetId") + private String subnetId; + + /* + * The state of the managed instance. + */ + @JsonProperty(value = "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 = "licenseType") + private ManagedInstanceLicenseType licenseType; + + /* + * The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + */ + @JsonProperty(value = "vCores") + private Integer vCores; + + /* + * Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments + * of 32 GB allowed only. + */ + @JsonProperty(value = "storageSizeInGB") + private Integer storageSizeInGB; + + /* + * Collation of the managed instance. + */ + @JsonProperty(value = "collation") + private String collation; + + /* + * The Dns Zone that the managed instance is in. + */ + @JsonProperty(value = "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 = "dnsZonePartner") + private String dnsZonePartner; + + /* + * Whether or not the public data endpoint is enabled. + */ + @JsonProperty(value = "publicDataEndpointEnabled") + private Boolean publicDataEndpointEnabled; + + /* + * The resource identifier of the source managed instance associated with + * create operation of this instance. + */ + @JsonProperty(value = "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 = "restorePointInTime") + private OffsetDateTime restorePointInTime; + + /* + * Connection type used for connecting to the instance. + */ + @JsonProperty(value = "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 = "timezoneId") + private String timezoneId; + + /* + * The Id of the instance pool this managed server belongs to. + */ + @JsonProperty(value = "instancePoolId") + private String instancePoolId; + + /* + * Specifies maintenance configuration id to apply to this managed + * instance. + */ + @JsonProperty(value = "maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /* + * List of private endpoint connections on a managed instance. + */ + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' + */ + @JsonProperty(value = "minimalTlsVersion") + private String minimalTlsVersion; + + /* + * The storage account type used to store backups for this instance. The + * options are Local (LocallyRedundantStorage), Zone + * (ZoneRedundantStorage), Geo (GeoRedundantStorage) and + * GeoZone(GeoZoneRedundantStorage) + */ + @JsonProperty(value = "currentBackupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy currentBackupStorageRedundancy; + + /* + * The storage account type to be used to store backups for this instance. + * The options are Local (LocallyRedundantStorage), Zone + * (ZoneRedundantStorage), Geo (GeoRedundantStorage) and + * GeoZone(GeoZoneRedundantStorage) + */ + @JsonProperty(value = "requestedBackupStorageRedundancy") + private BackupStorageRedundancy requestedBackupStorageRedundancy; + + /* + * Whether or not the multi-az is enabled. + */ + @JsonProperty(value = "zoneRedundant") + private Boolean zoneRedundant; + + /* + * The resource id of a user assigned identity to be used by default. + */ + @JsonProperty(value = "primaryUserAssignedIdentityId") + private String primaryUserAssignedIdentityId; + + /* + * A CMK URI of the key to use for encryption. + */ + @JsonProperty(value = "keyId") + private String keyId; + + /* + * The Azure Active Directory administrator of the server. + */ + @JsonProperty(value = "administrators") + private ManagedInstanceExternalAdministrator administrators; + + /* + * The managed instance's service principal. + */ + @JsonProperty(value = "servicePrincipal") + private ServicePrincipal servicePrincipal; + + /** + * 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withMinimalTlsVersion(String minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the currentBackupStorageRedundancy value. + */ + public BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.currentBackupStorageRedundancy; + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.requestedBackupStorageRedundancy; + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + this.requestedBackupStorageRedundancy = requestedBackupStorageRedundancy; + 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + public String primaryUserAssignedIdentityId() { + return this.primaryUserAssignedIdentityId; + } + + /** + * Set the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + this.primaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + return this; + } + + /** + * Get the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + public String keyId() { + return this.keyId; + } + + /** + * Set the keyId property: A CMK URI of the key to use for encryption. + * + * @param keyId the keyId value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withKeyId(String keyId) { + this.keyId = keyId; + return this; + } + + /** + * Get the administrators property: The Azure Active Directory administrator of the server. + * + * @return the administrators value. + */ + public ManagedInstanceExternalAdministrator administrators() { + return this.administrators; + } + + /** + * Set the administrators property: The Azure Active Directory administrator of the server. + * + * @param administrators the administrators value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withAdministrators(ManagedInstanceExternalAdministrator administrators) { + this.administrators = administrators; + return this; + } + + /** + * Get the servicePrincipal property: The managed instance's service principal. + * + * @return the servicePrincipal value. + */ + public ServicePrincipal servicePrincipal() { + return this.servicePrincipal; + } + + /** + * Set the servicePrincipal property: The managed instance's service principal. + * + * @param servicePrincipal the servicePrincipal value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withServicePrincipal(ServicePrincipal servicePrincipal) { + this.servicePrincipal = servicePrincipal; + 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()); + } + if (administrators() != null) { + administrators().validate(); + } + if (servicePrincipal() != null) { + servicePrincipal().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceQueryInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceQueryInner.java new file mode 100644 index 0000000000000..807df4a21821e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceQueryInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Database query. */ +@Fluent +public final class ManagedInstanceQueryInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private QueryProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private QueryProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the queryText property: Query text. + * + * @return the queryText value. + */ + public String queryText() { + return this.innerProperties() == null ? null : this.innerProperties().queryText(); + } + + /** + * Set the queryText property: Query text. + * + * @param queryText the queryText value to set. + * @return the ManagedInstanceQueryInner object itself. + */ + public ManagedInstanceQueryInner withQueryText(String queryText) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryProperties(); + } + this.innerProperties().withQueryText(queryText); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..6b6bb986a2fe7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A managed instance vulnerability assessment. */ +@Fluent +public final class ManagedInstanceVulnerabilityAssessmentInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceVulnerabilityAssessmentProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceVulnerabilityAssessmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageContainerPath(storageContainerPath); + return this; + } + + /** + * Get the storageContainerSasKey property: A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageContainerSasKey value. + */ + public String storageContainerSasKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageContainerSasKey(); + } + + /** + * Set the storageContainerSasKey property: A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageContainerSasKey the storageContainerSasKey value to set. + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageContainerSasKey(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. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.innerProperties() == null ? null : this.innerProperties().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. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceVulnerabilityAssessmentProperties(); + } + this.innerProperties().withRecurringScans(recurringScans); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentProperties.java new file mode 100644 index 0000000000000..ab61fb75ab0b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a managed instance vulnerability assessment. */ +@Fluent +public final class ManagedInstanceVulnerabilityAssessmentProperties { + /* + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "storageContainerPath", required = true) + private String storageContainerPath; + + /* + * A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If + * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is + * required. Applies only if the storage account is not behind a Vnet or a + * firewall + */ + @JsonProperty(value = "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. Applies only if the storage account + * is not behind a Vnet or a firewall + */ + @JsonProperty(value = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * The recurring scans settings + */ + @JsonProperty(value = "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 ManagedInstanceVulnerabilityAssessmentProperties object itself. + */ + public ManagedInstanceVulnerabilityAssessmentProperties withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * Get the storageContainerSasKey property: A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageContainerSasKey value. + */ + public String storageContainerSasKey() { + return this.storageContainerSasKey; + } + + /** + * Set the storageContainerSasKey property: A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageContainerSasKey the storageContainerSasKey value to set. + * @return the ManagedInstanceVulnerabilityAssessmentProperties object itself. + */ + public ManagedInstanceVulnerabilityAssessmentProperties 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. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @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. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ManagedInstanceVulnerabilityAssessmentProperties object itself. + */ + public ManagedInstanceVulnerabilityAssessmentProperties 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 ManagedInstanceVulnerabilityAssessmentProperties object itself. + */ + public ManagedInstanceVulnerabilityAssessmentProperties withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageContainerPath() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageContainerPath in model" + + " ManagedInstanceVulnerabilityAssessmentProperties")); + } + if (recurringScans() != null) { + recurringScans().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceVulnerabilityAssessmentProperties.class); +} 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..971e3ddd1e4b8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerSecurityAlertPolicyInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A managed server security alert policy. */ +@Fluent +public final class ManagedServerSecurityAlertPolicyInner extends ProxyResource { + /* + * SystemData of SecurityAlertPolicyResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SecurityAlertsPolicyProperties innerProperties; + + /** + * Get the systemData property: SystemData of SecurityAlertPolicyResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SecurityAlertsPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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 SecurityAlertsPolicyState state() { + return this.innerProperties() == null ? null : this.innerProperties().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(SecurityAlertsPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withState(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, Brute_Force. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.innerProperties() == null ? null : this.innerProperties().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, Brute_Force. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withDisabledAlerts(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withEmailAddresses(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withEmailAccountAdmins(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.innerProperties() == null ? null : this.innerProperties().creationTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedTransparentDataEncryptionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedTransparentDataEncryptionInner.java new file mode 100644 index 0000000000000..4df7838e71341 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedTransparentDataEncryptionInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A managed database transparent data encryption state. */ +@Fluent +public final class ManagedTransparentDataEncryptionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedTransparentDataEncryptionProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedTransparentDataEncryptionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: Specifies the state of the transparent data encryption. + * + * @return the state value. + */ + public TransparentDataEncryptionState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the transparent data encryption. + * + * @param state the state value to set. + * @return the ManagedTransparentDataEncryptionInner object itself. + */ + public ManagedTransparentDataEncryptionInner withState(TransparentDataEncryptionState state) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedTransparentDataEncryptionProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedTransparentDataEncryptionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedTransparentDataEncryptionProperties.java new file mode 100644 index 0000000000000..e113562276f33 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedTransparentDataEncryptionProperties.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.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a transparent data encryption. */ +@Fluent +public final class ManagedTransparentDataEncryptionProperties { + /* + * Specifies the state of the transparent data encryption. + */ + @JsonProperty(value = "state", required = true) + private TransparentDataEncryptionState state; + + /** + * Get the state property: Specifies the state of the transparent data encryption. + * + * @return the state value. + */ + public TransparentDataEncryptionState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the transparent data encryption. + * + * @param state the state value to set. + * @return the ManagedTransparentDataEncryptionProperties object itself. + */ + public ManagedTransparentDataEncryptionProperties withState(TransparentDataEncryptionState state) { + this.state = state; + return this; + } + + /** + * 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 ManagedTransparentDataEncryptionProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedTransparentDataEncryptionProperties.class); +} 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..2e6ad403a7b71 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricDefinitionInner.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.Immutable; +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.JsonProperty; +import java.util.List; + +/** A database metric definition. */ +@Immutable +public final class MetricDefinitionInner { + /* + * 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..a029708bc38d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricInner.java @@ -0,0 +1,121 @@ +// Copyright (c) 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.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.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Database metrics. */ +@Immutable +public final class MetricInner { + /* + * 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..fd282b5621667 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OperationInner.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.resourcemanager.sql.generated.models.OperationDisplay; +import com.azure.resourcemanager.sql.generated.models.OperationOrigin; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** SQL REST API operation definition. */ +@Immutable +public final class OperationInner { + /* + * The name of the operation being performed on this particular object. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The localized display information for this particular operation / + * action. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /* + * The intended executor of the operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private OperationOrigin origin; + + /* + * Additional descriptions for the operation. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map properties; + + /** + * Get the name property: The name of the operation being performed on this particular object. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the display property: The localized display information for this particular operation / action. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + public OperationOrigin origin() { + return this.origin; + } + + /** + * Get the properties property: Additional descriptions for the operation. + * + * @return the properties value. + */ + public Map properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OutboundFirewallRuleInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OutboundFirewallRuleInner.java new file mode 100644 index 0000000000000..8c4c0ac50c916 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OutboundFirewallRuleInner.java @@ -0,0 +1,48 @@ +// Copyright (c) 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.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure SQL DB Server Outbound Firewall Rule. */ +@Fluent +public final class OutboundFirewallRuleInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private OutboundFirewallRuleProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private OutboundFirewallRuleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the provisioningState property: The state of the outbound rule. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OutboundFirewallRuleProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OutboundFirewallRuleProperties.java new file mode 100644 index 0000000000000..299bf584fd4a1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OutboundFirewallRuleProperties.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an outbound firewall rule. */ +@Immutable +public final class OutboundFirewallRuleProperties { + /* + * The state of the outbound rule. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the provisioningState property: The state of the outbound rule. + * + * @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() { + } +} 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..ab55b264093a1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionInner.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.management.ProxyResource; +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.JsonProperty; + +/** A private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..9906b4d26b827 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +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.JsonProperty; + +/** Properties of a private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + /* + * 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/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..cc713b4762c4b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateLinkResourceInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private link resource. */ +@Immutable +public final class PrivateLinkResourceInner extends ProxyResource { + /* + * 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/QueryProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryProperties.java new file mode 100644 index 0000000000000..8771bc3a21662 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a database query. */ +@Fluent +public final class QueryProperties { + /* + * Query text. + */ + @JsonProperty(value = "queryText") + private String queryText; + + /** + * Get the queryText property: Query text. + * + * @return the queryText value. + */ + public String queryText() { + return this.queryText; + } + + /** + * Set the queryText property: Query text. + * + * @param queryText the queryText value to set. + * @return the QueryProperties object itself. + */ + public QueryProperties withQueryText(String queryText) { + this.queryText = queryText; + 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/QueryStatisticsInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryStatisticsInner.java new file mode 100644 index 0000000000000..ea2595c12f672 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryStatisticsInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.QueryMetricInterval; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The QueryStatistics model. */ +@Fluent +public final class QueryStatisticsInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private QueryStatisticsProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private QueryStatisticsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the databaseName property: Database name of the database in which this query was executed. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the queryId property: Unique query id (unique within one database). + * + * @return the queryId value. + */ + public String queryId() { + return this.innerProperties() == null ? null : this.innerProperties().queryId(); + } + + /** + * Get the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + public String startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + public String endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Get the intervals property: List of intervals with appropriate metric data. + * + * @return the intervals value. + */ + public List intervals() { + return this.innerProperties() == null ? null : this.innerProperties().intervals(); + } + + /** + * Set the intervals property: List of intervals with appropriate metric data. + * + * @param intervals the intervals value to set. + * @return the QueryStatisticsInner object itself. + */ + public QueryStatisticsInner withIntervals(List intervals) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryStatisticsProperties(); + } + this.innerProperties().withIntervals(intervals); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryStatisticsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryStatisticsProperties.java new file mode 100644 index 0000000000000..0284aaa15b222 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryStatisticsProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.QueryMetricInterval; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a query execution statistics. */ +@Fluent +public final class QueryStatisticsProperties { + /* + * 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/fluent/models/RecommendedActionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedActionInner.java new file mode 100644 index 0000000000000..bd6564b5ac5d7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedActionInner.java @@ -0,0 +1,312 @@ +// Copyright (c) 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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionErrorInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionImpactRecord; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionImplementationInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionInitiatedBy; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionMetricInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionStateInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Database, Server or Elastic Pool Recommended Action. */ +@Fluent +public final class RecommendedActionInner extends ProxyResource { + /* + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private RecommendedActionProperties innerProperties; + + /** + * Get the kind property: Resource kind. + * + * @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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private RecommendedActionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the recommendationReason property: Gets the reason for recommending this action. e.g., DuplicateIndex. + * + * @return the recommendationReason value. + */ + public String recommendationReason() { + return this.innerProperties() == null ? null : this.innerProperties().recommendationReason(); + } + + /** + * Get the validSince property: Gets the time since when this recommended action is valid. + * + * @return the validSince value. + */ + public OffsetDateTime validSince() { + return this.innerProperties() == null ? null : this.innerProperties().validSince(); + } + + /** + * Get the lastRefresh property: Gets time when this recommended action was last refreshed. + * + * @return the lastRefresh value. + */ + public OffsetDateTime lastRefresh() { + return this.innerProperties() == null ? null : this.innerProperties().lastRefresh(); + } + + /** + * Get the state property: Gets the info of the current state the recommended action is in. + * + * @return the state value. + */ + public RecommendedActionStateInfo state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Gets the info of the current state the recommended action is in. + * + * @param state the state value to set. + * @return the RecommendedActionInner object itself. + */ + public RecommendedActionInner withState(RecommendedActionStateInfo state) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendedActionProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the isExecutableAction property: Gets if this recommended action is actionable by user. + * + * @return the isExecutableAction value. + */ + public Boolean isExecutableAction() { + return this.innerProperties() == null ? null : this.innerProperties().isExecutableAction(); + } + + /** + * Get the isRevertableAction property: Gets if changes applied by this recommended action can be reverted by user. + * + * @return the isRevertableAction value. + */ + public Boolean isRevertableAction() { + return this.innerProperties() == null ? null : this.innerProperties().isRevertableAction(); + } + + /** + * Get the isArchivedAction property: Gets if this recommended action was suggested some time ago but user chose to + * ignore this and system added a new recommended action again. + * + * @return the isArchivedAction value. + */ + public Boolean isArchivedAction() { + return this.innerProperties() == null ? null : this.innerProperties().isArchivedAction(); + } + + /** + * Get the executeActionStartTime property: Gets the time when system started applying this recommended action on + * the user resource. e.g., index creation start time. + * + * @return the executeActionStartTime value. + */ + public OffsetDateTime executeActionStartTime() { + return this.innerProperties() == null ? null : this.innerProperties().executeActionStartTime(); + } + + /** + * Get the executeActionDuration property: Gets the time taken for applying this recommended action on user + * resource. e.g., time taken for index creation. + * + * @return the executeActionDuration value. + */ + public String executeActionDuration() { + return this.innerProperties() == null ? null : this.innerProperties().executeActionDuration(); + } + + /** + * Get the revertActionStartTime property: Gets the time when system started reverting changes of this recommended + * action on user resource. e.g., time when index drop is executed. + * + * @return the revertActionStartTime value. + */ + public OffsetDateTime revertActionStartTime() { + return this.innerProperties() == null ? null : this.innerProperties().revertActionStartTime(); + } + + /** + * Get the revertActionDuration property: Gets the time taken for reverting changes of this recommended action on + * user resource. e.g., time taken for dropping the created index. + * + * @return the revertActionDuration value. + */ + public String revertActionDuration() { + return this.innerProperties() == null ? null : this.innerProperties().revertActionDuration(); + } + + /** + * Get the executeActionInitiatedBy property: Gets if approval for applying this recommended action was given by + * user/system. + * + * @return the executeActionInitiatedBy value. + */ + public RecommendedActionInitiatedBy executeActionInitiatedBy() { + return this.innerProperties() == null ? null : this.innerProperties().executeActionInitiatedBy(); + } + + /** + * Get the executeActionInitiatedTime property: Gets the time when this recommended action was approved for + * execution. + * + * @return the executeActionInitiatedTime value. + */ + public OffsetDateTime executeActionInitiatedTime() { + return this.innerProperties() == null ? null : this.innerProperties().executeActionInitiatedTime(); + } + + /** + * Get the revertActionInitiatedBy property: Gets if approval for reverting this recommended action was given by + * user/system. + * + * @return the revertActionInitiatedBy value. + */ + public RecommendedActionInitiatedBy revertActionInitiatedBy() { + return this.innerProperties() == null ? null : this.innerProperties().revertActionInitiatedBy(); + } + + /** + * Get the revertActionInitiatedTime property: Gets the time when this recommended action was approved for revert. + * + * @return the revertActionInitiatedTime value. + */ + public OffsetDateTime revertActionInitiatedTime() { + return this.innerProperties() == null ? null : this.innerProperties().revertActionInitiatedTime(); + } + + /** + * Get the score property: Gets the impact of this recommended action. Possible values are 1 - Low impact, 2 - + * Medium Impact and 3 - High Impact. + * + * @return the score value. + */ + public Integer score() { + return this.innerProperties() == null ? null : this.innerProperties().score(); + } + + /** + * Get the implementationDetails property: Gets the implementation details of this recommended action for user to + * apply it manually. + * + * @return the implementationDetails value. + */ + public RecommendedActionImplementationInfo implementationDetails() { + return this.innerProperties() == null ? null : this.innerProperties().implementationDetails(); + } + + /** + * Get the errorDetails property: Gets the error details if and why this recommended action is put to error state. + * + * @return the errorDetails value. + */ + public RecommendedActionErrorInfo errorDetails() { + return this.innerProperties() == null ? null : this.innerProperties().errorDetails(); + } + + /** + * Get the estimatedImpact property: Gets the estimated impact info for this recommended action e.g., Estimated CPU + * gain, Estimated Disk Space change. + * + * @return the estimatedImpact value. + */ + public List estimatedImpact() { + return this.innerProperties() == null ? null : this.innerProperties().estimatedImpact(); + } + + /** + * Get the observedImpact property: Gets the observed/actual impact info for this recommended action e.g., Actual + * CPU gain, Actual Disk Space change. + * + * @return the observedImpact value. + */ + public List observedImpact() { + return this.innerProperties() == null ? null : this.innerProperties().observedImpact(); + } + + /** + * Get the timeSeries property: Gets the time series info of metrics for this recommended action e.g., CPU + * consumption time series. + * + * @return the timeSeries value. + */ + public List timeSeries() { + return this.innerProperties() == null ? null : this.innerProperties().timeSeries(); + } + + /** + * Get the linkedObjects property: Gets the linked objects, if any. + * + * @return the linkedObjects value. + */ + public List linkedObjects() { + return this.innerProperties() == null ? null : this.innerProperties().linkedObjects(); + } + + /** + * Get the details property: Gets additional details specific to this recommended action. + * + * @return the details value. + */ + public Map details() { + return this.innerProperties() == null ? null : this.innerProperties().details(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedActionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedActionProperties.java new file mode 100644 index 0000000000000..99d2493555e01 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedActionProperties.java @@ -0,0 +1,440 @@ +// Copyright (c) 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.RecommendedActionErrorInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionImpactRecord; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionImplementationInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionInitiatedBy; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionMetricInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionStateInfo; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Properties for a Database, Server or Elastic Pool Recommended Action. */ +@Fluent +public final class RecommendedActionProperties { + /* + * Gets the reason for recommending this action. e.g., DuplicateIndex + */ + @JsonProperty(value = "recommendationReason", access = JsonProperty.Access.WRITE_ONLY) + private String recommendationReason; + + /* + * Gets the time since when this recommended action is valid. + */ + @JsonProperty(value = "validSince", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime validSince; + + /* + * Gets time when this recommended action was last refreshed. + */ + @JsonProperty(value = "lastRefresh", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastRefresh; + + /* + * Gets the info of the current state the recommended action is in. + */ + @JsonProperty(value = "state", required = true) + private RecommendedActionStateInfo state; + + /* + * Gets if this recommended action is actionable by user + */ + @JsonProperty(value = "isExecutableAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isExecutableAction; + + /* + * Gets if changes applied by this recommended action can be reverted by + * user + */ + @JsonProperty(value = "isRevertableAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isRevertableAction; + + /* + * Gets if this recommended action was suggested some time ago but user + * chose to ignore this and system added a new recommended action again. + */ + @JsonProperty(value = "isArchivedAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isArchivedAction; + + /* + * Gets the time when system started applying this recommended action on + * the user resource. e.g., index creation start time + */ + @JsonProperty(value = "executeActionStartTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime executeActionStartTime; + + /* + * Gets the time taken for applying this recommended action on user + * resource. e.g., time taken for index creation + */ + @JsonProperty(value = "executeActionDuration", access = JsonProperty.Access.WRITE_ONLY) + private String executeActionDuration; + + /* + * Gets the time when system started reverting changes of this recommended + * action on user resource. e.g., time when index drop is executed. + */ + @JsonProperty(value = "revertActionStartTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime revertActionStartTime; + + /* + * Gets the time taken for reverting changes of this recommended action on + * user resource. e.g., time taken for dropping the created index. + */ + @JsonProperty(value = "revertActionDuration", access = JsonProperty.Access.WRITE_ONLY) + private String revertActionDuration; + + /* + * Gets if approval for applying this recommended action was given by + * user/system. + */ + @JsonProperty(value = "executeActionInitiatedBy", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedActionInitiatedBy executeActionInitiatedBy; + + /* + * Gets the time when this recommended action was approved for execution. + */ + @JsonProperty(value = "executeActionInitiatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime executeActionInitiatedTime; + + /* + * Gets if approval for reverting this recommended action was given by + * user/system. + */ + @JsonProperty(value = "revertActionInitiatedBy", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedActionInitiatedBy revertActionInitiatedBy; + + /* + * Gets the time when this recommended action was approved for revert. + */ + @JsonProperty(value = "revertActionInitiatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime revertActionInitiatedTime; + + /* + * Gets the impact of this recommended action. Possible values are 1 - Low + * impact, 2 - Medium Impact and 3 - High Impact + */ + @JsonProperty(value = "score", access = JsonProperty.Access.WRITE_ONLY) + private Integer score; + + /* + * Gets the implementation details of this recommended action for user to + * apply it manually. + */ + @JsonProperty(value = "implementationDetails", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedActionImplementationInfo implementationDetails; + + /* + * Gets the error details if and why this recommended action is put to + * error state. + */ + @JsonProperty(value = "errorDetails", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedActionErrorInfo errorDetails; + + /* + * Gets the estimated impact info for this recommended action e.g., + * Estimated CPU gain, Estimated Disk Space change + */ + @JsonProperty(value = "estimatedImpact", access = JsonProperty.Access.WRITE_ONLY) + private List estimatedImpact; + + /* + * Gets the observed/actual impact info for this recommended action e.g., + * Actual CPU gain, Actual Disk Space change + */ + @JsonProperty(value = "observedImpact", access = JsonProperty.Access.WRITE_ONLY) + private List observedImpact; + + /* + * Gets the time series info of metrics for this recommended action e.g., + * CPU consumption time series + */ + @JsonProperty(value = "timeSeries", access = JsonProperty.Access.WRITE_ONLY) + private List timeSeries; + + /* + * Gets the linked objects, if any. + */ + @JsonProperty(value = "linkedObjects", access = JsonProperty.Access.WRITE_ONLY) + private List linkedObjects; + + /* + * Gets additional details specific to this recommended action. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map details; + + /** + * Get the recommendationReason property: Gets the reason for recommending this action. e.g., DuplicateIndex. + * + * @return the recommendationReason value. + */ + public String recommendationReason() { + return this.recommendationReason; + } + + /** + * Get the validSince property: Gets the time since when this recommended action is valid. + * + * @return the validSince value. + */ + public OffsetDateTime validSince() { + return this.validSince; + } + + /** + * Get the lastRefresh property: Gets time when this recommended action was last refreshed. + * + * @return the lastRefresh value. + */ + public OffsetDateTime lastRefresh() { + return this.lastRefresh; + } + + /** + * Get the state property: Gets the info of the current state the recommended action is in. + * + * @return the state value. + */ + public RecommendedActionStateInfo state() { + return this.state; + } + + /** + * Set the state property: Gets the info of the current state the recommended action is in. + * + * @param state the state value to set. + * @return the RecommendedActionProperties object itself. + */ + public RecommendedActionProperties withState(RecommendedActionStateInfo state) { + this.state = state; + return this; + } + + /** + * Get the isExecutableAction property: Gets if this recommended action is actionable by user. + * + * @return the isExecutableAction value. + */ + public Boolean isExecutableAction() { + return this.isExecutableAction; + } + + /** + * Get the isRevertableAction property: Gets if changes applied by this recommended action can be reverted by user. + * + * @return the isRevertableAction value. + */ + public Boolean isRevertableAction() { + return this.isRevertableAction; + } + + /** + * Get the isArchivedAction property: Gets if this recommended action was suggested some time ago but user chose to + * ignore this and system added a new recommended action again. + * + * @return the isArchivedAction value. + */ + public Boolean isArchivedAction() { + return this.isArchivedAction; + } + + /** + * Get the executeActionStartTime property: Gets the time when system started applying this recommended action on + * the user resource. e.g., index creation start time. + * + * @return the executeActionStartTime value. + */ + public OffsetDateTime executeActionStartTime() { + return this.executeActionStartTime; + } + + /** + * Get the executeActionDuration property: Gets the time taken for applying this recommended action on user + * resource. e.g., time taken for index creation. + * + * @return the executeActionDuration value. + */ + public String executeActionDuration() { + return this.executeActionDuration; + } + + /** + * Get the revertActionStartTime property: Gets the time when system started reverting changes of this recommended + * action on user resource. e.g., time when index drop is executed. + * + * @return the revertActionStartTime value. + */ + public OffsetDateTime revertActionStartTime() { + return this.revertActionStartTime; + } + + /** + * Get the revertActionDuration property: Gets the time taken for reverting changes of this recommended action on + * user resource. e.g., time taken for dropping the created index. + * + * @return the revertActionDuration value. + */ + public String revertActionDuration() { + return this.revertActionDuration; + } + + /** + * Get the executeActionInitiatedBy property: Gets if approval for applying this recommended action was given by + * user/system. + * + * @return the executeActionInitiatedBy value. + */ + public RecommendedActionInitiatedBy executeActionInitiatedBy() { + return this.executeActionInitiatedBy; + } + + /** + * Get the executeActionInitiatedTime property: Gets the time when this recommended action was approved for + * execution. + * + * @return the executeActionInitiatedTime value. + */ + public OffsetDateTime executeActionInitiatedTime() { + return this.executeActionInitiatedTime; + } + + /** + * Get the revertActionInitiatedBy property: Gets if approval for reverting this recommended action was given by + * user/system. + * + * @return the revertActionInitiatedBy value. + */ + public RecommendedActionInitiatedBy revertActionInitiatedBy() { + return this.revertActionInitiatedBy; + } + + /** + * Get the revertActionInitiatedTime property: Gets the time when this recommended action was approved for revert. + * + * @return the revertActionInitiatedTime value. + */ + public OffsetDateTime revertActionInitiatedTime() { + return this.revertActionInitiatedTime; + } + + /** + * Get the score property: Gets the impact of this recommended action. Possible values are 1 - Low impact, 2 - + * Medium Impact and 3 - High Impact. + * + * @return the score value. + */ + public Integer score() { + return this.score; + } + + /** + * Get the implementationDetails property: Gets the implementation details of this recommended action for user to + * apply it manually. + * + * @return the implementationDetails value. + */ + public RecommendedActionImplementationInfo implementationDetails() { + return this.implementationDetails; + } + + /** + * Get the errorDetails property: Gets the error details if and why this recommended action is put to error state. + * + * @return the errorDetails value. + */ + public RecommendedActionErrorInfo errorDetails() { + return this.errorDetails; + } + + /** + * Get the estimatedImpact property: Gets the estimated impact info for this recommended action e.g., Estimated CPU + * gain, Estimated Disk Space change. + * + * @return the estimatedImpact value. + */ + public List estimatedImpact() { + return this.estimatedImpact; + } + + /** + * Get the observedImpact property: Gets the observed/actual impact info for this recommended action e.g., Actual + * CPU gain, Actual Disk Space change. + * + * @return the observedImpact value. + */ + public List observedImpact() { + return this.observedImpact; + } + + /** + * Get the timeSeries property: Gets the time series info of metrics for this recommended action e.g., CPU + * consumption time series. + * + * @return the timeSeries value. + */ + public List timeSeries() { + return this.timeSeries; + } + + /** + * Get the linkedObjects property: Gets the linked objects, if any. + * + * @return the linkedObjects value. + */ + public List linkedObjects() { + return this.linkedObjects; + } + + /** + * Get the details property: Gets additional details specific to this recommended action. + * + * @return the details value. + */ + public Map details() { + return this.details; + } + + /** + * 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 RecommendedActionProperties")); + } else { + state().validate(); + } + if (implementationDetails() != null) { + implementationDetails().validate(); + } + if (errorDetails() != null) { + errorDetails().validate(); + } + if (estimatedImpact() != null) { + estimatedImpact().forEach(e -> e.validate()); + } + if (observedImpact() != null) { + observedImpact().forEach(e -> e.validate()); + } + if (timeSeries() != null) { + timeSeries().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RecommendedActionProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedSensitivityLabelUpdateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedSensitivityLabelUpdateProperties.java new file mode 100644 index 0000000000000..951950bfd98b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedSensitivityLabelUpdateProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateKind; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an operation executed on a recommended sensitivity label. */ +@Fluent +public final class RecommendedSensitivityLabelUpdateProperties { + /* + * The op property. + */ + @JsonProperty(value = "op", required = true) + private RecommendedSensitivityLabelUpdateKind op; + + /* + * Schema name of the column to update. + */ + @JsonProperty(value = "schema", required = true) + private String schema; + + /* + * Table name of the column to update. + */ + @JsonProperty(value = "table", required = true) + private String table; + + /* + * Column name to update. + */ + @JsonProperty(value = "column", required = true) + private String column; + + /** + * Get the op property: The op property. + * + * @return the op value. + */ + public RecommendedSensitivityLabelUpdateKind op() { + return this.op; + } + + /** + * Set the op property: The op property. + * + * @param op the op value to set. + * @return the RecommendedSensitivityLabelUpdateProperties object itself. + */ + public RecommendedSensitivityLabelUpdateProperties withOp(RecommendedSensitivityLabelUpdateKind op) { + this.op = op; + return this; + } + + /** + * Get the schema property: Schema name of the column to update. + * + * @return the schema value. + */ + public String schema() { + return this.schema; + } + + /** + * Set the schema property: Schema name of the column to update. + * + * @param schema the schema value to set. + * @return the RecommendedSensitivityLabelUpdateProperties object itself. + */ + public RecommendedSensitivityLabelUpdateProperties withSchema(String schema) { + this.schema = schema; + return this; + } + + /** + * Get the table property: Table name of the column to update. + * + * @return the table value. + */ + public String table() { + return this.table; + } + + /** + * Set the table property: Table name of the column to update. + * + * @param table the table value to set. + * @return the RecommendedSensitivityLabelUpdateProperties object itself. + */ + public RecommendedSensitivityLabelUpdateProperties withTable(String table) { + this.table = table; + return this; + } + + /** + * Get the column property: Column name to update. + * + * @return the column value. + */ + public String column() { + return this.column; + } + + /** + * Set the column property: Column name to update. + * + * @param column the column value to set. + * @return the RecommendedSensitivityLabelUpdateProperties object itself. + */ + public RecommendedSensitivityLabelUpdateProperties withColumn(String column) { + this.column = column; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (op() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property op in model RecommendedSensitivityLabelUpdateProperties")); + } + if (schema() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property schema in model RecommendedSensitivityLabelUpdateProperties")); + } + if (table() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property table in model RecommendedSensitivityLabelUpdateProperties")); + } + if (column() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property column in model RecommendedSensitivityLabelUpdateProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RecommendedSensitivityLabelUpdateProperties.class); +} 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..ef7d19a1f8308 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A recoverable database. */ +@Fluent +public final class RecoverableDatabaseInner extends ProxyResource { + /* + * The properties of a recoverable database + */ + @JsonProperty(value = "properties") + private RecoverableDatabaseProperties innerProperties; + + /** + * Get the innerProperties property: The properties of a recoverable database. + * + * @return the innerProperties value. + */ + private RecoverableDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the edition property: The edition of the database. + * + * @return the edition value. + */ + public String edition() { + return this.innerProperties() == null ? null : this.innerProperties().edition(); + } + + /** + * Get the serviceLevelObjective property: The service level objective name of the database. + * + * @return the serviceLevelObjective value. + */ + public String serviceLevelObjective() { + return this.innerProperties() == null ? null : this.innerProperties().serviceLevelObjective(); + } + + /** + * Get the elasticPoolName property: The elastic pool name of the database. + * + * @return the elasticPoolName value. + */ + public String elasticPoolName() { + return this.innerProperties() == null ? null : this.innerProperties().elasticPoolName(); + } + + /** + * Get the lastAvailableBackupDate property: The last available backup date of the database (ISO8601 format). + * + * @return the lastAvailableBackupDate value. + */ + public OffsetDateTime lastAvailableBackupDate() { + return this.innerProperties() == null ? null : this.innerProperties().lastAvailableBackupDate(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseProperties.java new file mode 100644 index 0000000000000..08233daf996eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseProperties.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.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a recoverable database. */ +@Immutable +public final class RecoverableDatabaseProperties { + /* + * The edition of the database + */ + @JsonProperty(value = "edition", access = JsonProperty.Access.WRITE_ONLY) + private String edition; + + /* + * The service level objective name of the database + */ + @JsonProperty(value = "serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String serviceLevelObjective; + + /* + * The elastic pool name of the database + */ + @JsonProperty(value = "elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /* + * The last available backup date of the database (ISO8601 format) + */ + @JsonProperty(value = "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..446e646a39032 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseInner.java @@ -0,0 +1,48 @@ +// Copyright (c) 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.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A recoverable managed database resource. */ +@Fluent +public final class RecoverableManagedDatabaseInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private RecoverableManagedDatabaseProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private RecoverableManagedDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the lastAvailableBackupDate property: The last available backup date. + * + * @return the lastAvailableBackupDate value. + */ + public String lastAvailableBackupDate() { + return this.innerProperties() == null ? null : this.innerProperties().lastAvailableBackupDate(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseProperties.java new file mode 100644 index 0000000000000..8b93caff09511 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseProperties.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The recoverable managed database's properties. */ +@Immutable +public final class RecoverableManagedDatabaseProperties { + /* + * The last available backup date. + */ + @JsonProperty(value = "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..4da25db18c7ba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ReplicationLinkType; +import com.azure.resourcemanager.sql.generated.models.ReplicationRole; +import com.azure.resourcemanager.sql.generated.models.ReplicationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A replication link. */ +@Fluent +public final class ReplicationLinkInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ReplicationLinkProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ReplicationLinkProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the partnerServer property: Resource partner server. + * + * @return the partnerServer value. + */ + public String partnerServer() { + return this.innerProperties() == null ? null : this.innerProperties().partnerServer(); + } + + /** + * Get the partnerDatabase property: Resource partner database. + * + * @return the partnerDatabase value. + */ + public String partnerDatabase() { + return this.innerProperties() == null ? null : this.innerProperties().partnerDatabase(); + } + + /** + * Get the partnerLocation property: Resource partner location. + * + * @return the partnerLocation value. + */ + public String partnerLocation() { + return this.innerProperties() == null ? null : this.innerProperties().partnerLocation(); + } + + /** + * Get the role property: Local replication role. + * + * @return the role value. + */ + public ReplicationRole role() { + return this.innerProperties() == null ? null : this.innerProperties().role(); + } + + /** + * Get the partnerRole property: Partner replication role. + * + * @return the partnerRole value. + */ + public ReplicationRole partnerRole() { + return this.innerProperties() == null ? null : this.innerProperties().partnerRole(); + } + + /** + * Get the replicationMode property: Replication mode. + * + * @return the replicationMode value. + */ + public String replicationMode() { + return this.innerProperties() == null ? null : this.innerProperties().replicationMode(); + } + + /** + * Get the startTime property: Time at which the link was created. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the percentComplete property: Seeding completion percentage for the link. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Get the replicationState property: Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). + * + * @return the replicationState value. + */ + public ReplicationState replicationState() { + return this.innerProperties() == null ? null : this.innerProperties().replicationState(); + } + + /** + * Get the isTerminationAllowed property: Whether the user is currently allowed to terminate the link. + * + * @return the isTerminationAllowed value. + */ + public Boolean isTerminationAllowed() { + return this.innerProperties() == null ? null : this.innerProperties().isTerminationAllowed(); + } + + /** + * Get the linkType property: Link type (GEO, NAMED). + * + * @return the linkType value. + */ + public ReplicationLinkType linkType() { + return this.innerProperties() == null ? null : this.innerProperties().linkType(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkProperties.java new file mode 100644 index 0000000000000..1edc5c9f5b647 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkProperties.java @@ -0,0 +1,189 @@ +// Copyright (c) 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.resourcemanager.sql.generated.models.ReplicationLinkType; +import com.azure.resourcemanager.sql.generated.models.ReplicationRole; +import com.azure.resourcemanager.sql.generated.models.ReplicationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of a replication link. */ +@Immutable +public final class ReplicationLinkProperties { + /* + * Resource partner server. + */ + @JsonProperty(value = "partnerServer", access = JsonProperty.Access.WRITE_ONLY) + private String partnerServer; + + /* + * Resource partner database. + */ + @JsonProperty(value = "partnerDatabase", access = JsonProperty.Access.WRITE_ONLY) + private String partnerDatabase; + + /* + * Resource partner location. + */ + @JsonProperty(value = "partnerLocation", access = JsonProperty.Access.WRITE_ONLY) + private String partnerLocation; + + /* + * Local replication role. + */ + @JsonProperty(value = "role", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationRole role; + + /* + * Partner replication role. + */ + @JsonProperty(value = "partnerRole", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationRole partnerRole; + + /* + * Replication mode. + */ + @JsonProperty(value = "replicationMode", access = JsonProperty.Access.WRITE_ONLY) + private String replicationMode; + + /* + * Time at which the link was created. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * Seeding completion percentage for the link. + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). + */ + @JsonProperty(value = "replicationState", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationState replicationState; + + /* + * Whether the user is currently allowed to terminate the link. + */ + @JsonProperty(value = "isTerminationAllowed", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isTerminationAllowed; + + /* + * Link type (GEO, NAMED). + */ + @JsonProperty(value = "linkType", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationLinkType linkType; + + /** + * Get the partnerServer property: Resource partner server. + * + * @return the partnerServer value. + */ + public String partnerServer() { + return this.partnerServer; + } + + /** + * Get the partnerDatabase property: Resource partner database. + * + * @return the partnerDatabase value. + */ + public String partnerDatabase() { + return this.partnerDatabase; + } + + /** + * Get the partnerLocation property: Resource partner location. + * + * @return the partnerLocation value. + */ + public String partnerLocation() { + return this.partnerLocation; + } + + /** + * Get the role property: Local replication role. + * + * @return the role value. + */ + public ReplicationRole role() { + return this.role; + } + + /** + * Get the partnerRole property: Partner replication role. + * + * @return the partnerRole value. + */ + public ReplicationRole partnerRole() { + return this.partnerRole; + } + + /** + * Get the replicationMode property: Replication mode. + * + * @return the replicationMode value. + */ + public String replicationMode() { + return this.replicationMode; + } + + /** + * Get the startTime property: Time at which the link was created. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the percentComplete property: Seeding completion percentage for the link. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the replicationState property: Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). + * + * @return the replicationState value. + */ + public ReplicationState replicationState() { + return this.replicationState; + } + + /** + * Get the isTerminationAllowed property: Whether the user is currently allowed to terminate the link. + * + * @return the isTerminationAllowed value. + */ + public Boolean isTerminationAllowed() { + return this.isTerminationAllowed; + } + + /** + * Get the linkType property: Link type (GEO, NAMED). + * + * @return the linkType value. + */ + public ReplicationLinkType linkType() { + return this.linkType; + } + + /** + * 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..d27fc19a65d20 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** A restorable dropped database resource. */ +@Fluent +public final class RestorableDroppedDatabaseInner extends ProxyResource { + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource location. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private RestorableDroppedDatabaseProperties innerProperties; + + /** + * 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 RestorableDroppedDatabaseInner object itself. + */ + public RestorableDroppedDatabaseInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * 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 RestorableDroppedDatabaseInner object itself. + */ + public RestorableDroppedDatabaseInner 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 RestorableDroppedDatabaseInner object itself. + */ + public RestorableDroppedDatabaseInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private RestorableDroppedDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the databaseName property: The name of the database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.innerProperties() == null ? null : this.innerProperties().maxSizeBytes(); + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the deletionDate property: The deletion date of the database (ISO8601 format). + * + * @return the deletionDate value. + */ + public OffsetDateTime deletionDate() { + return this.innerProperties() == null ? null : this.innerProperties().deletionDate(); + } + + /** + * Get the earliestRestoreDate property: The earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreDate(); + } + + /** + * Get the backupStorageRedundancy property: The storage account type used to store backups for this database. + * + * @return the backupStorageRedundancy value. + */ + public BackupStorageRedundancy backupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().backupStorageRedundancy(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseProperties.java new file mode 100644 index 0000000000000..ac4579649fab9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseProperties.java @@ -0,0 +1,112 @@ +// Copyright (c) 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.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The restorable dropped database's properties. */ +@Immutable +public final class RestorableDroppedDatabaseProperties { + /* + * The name of the database. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "maxSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long maxSizeBytes; + + /* + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The deletion date of the database (ISO8601 format). + */ + @JsonProperty(value = "deletionDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime deletionDate; + + /* + * The earliest restore date of the database (ISO8601 format). + */ + @JsonProperty(value = "earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestoreDate; + + /* + * The storage account type used to store backups for this database. + */ + @JsonProperty(value = "backupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy backupStorageRedundancy; + + /** + * Get the databaseName property: The name of the database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * 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; + } + + /** + * Get the backupStorageRedundancy property: The storage account type used to store backups for this database. + * + * @return the backupStorageRedundancy value. + */ + public BackupStorageRedundancy backupStorageRedundancy() { + return this.backupStorageRedundancy; + } + + /** + * 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..604b81d4406bd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseInner.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.Fluent; +import com.azure.core.management.Resource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** A restorable dropped managed database resource. */ +@Fluent +public final class RestorableDroppedManagedDatabaseInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private RestorableDroppedManagedDatabaseProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private RestorableDroppedManagedDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public RestorableDroppedManagedDatabaseInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableDroppedManagedDatabaseInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the databaseName property: The name of the database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the deletionDate property: The deletion date of the database (ISO8601 format). + * + * @return the deletionDate value. + */ + public OffsetDateTime deletionDate() { + return this.innerProperties() == null ? null : this.innerProperties().deletionDate(); + } + + /** + * Get the earliestRestoreDate property: The earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreDate(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseProperties.java new file mode 100644 index 0000000000000..d73da8cd501aa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseProperties.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.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The restorable dropped managed database's properties. */ +@Immutable +public final class RestorableDroppedManagedDatabaseProperties { + /* + * The name of the database. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The deletion date of the database (ISO8601 format). + */ + @JsonProperty(value = "deletionDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime deletionDate; + + /* + * The earliest restore date of the database (ISO8601 format). + */ + @JsonProperty(value = "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; + } + + /** + * 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..9576b43d36870 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.RestorePointType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Database restore points. */ +@Fluent +public final class RestorePointInner extends ProxyResource { + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private RestorePointProperties innerProperties; + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private RestorePointProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the restorePointType property: The type of restore point. + * + * @return the restorePointType value. + */ + public RestorePointType restorePointType() { + return this.innerProperties() == null ? null : this.innerProperties().restorePointType(); + } + + /** + * Get the earliestRestoreDate property: The earliest time to which this database can be restored. + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreDate(); + } + + /** + * Get the restorePointCreationDate property: The time the backup was taken. + * + * @return the restorePointCreationDate value. + */ + public OffsetDateTime restorePointCreationDate() { + return this.innerProperties() == null ? null : this.innerProperties().restorePointCreationDate(); + } + + /** + * Get the restorePointLabel property: The label of restore point for backup request by user. + * + * @return the restorePointLabel value. + */ + public String restorePointLabel() { + return this.innerProperties() == null ? null : this.innerProperties().restorePointLabel(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointProperties.java new file mode 100644 index 0000000000000..12012283bc47f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointProperties.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.RestorePointType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of a database restore point. */ +@Immutable +public final class RestorePointProperties { + /* + * The type of restore point + */ + @JsonProperty(value = "restorePointType", access = JsonProperty.Access.WRITE_ONLY) + private RestorePointType restorePointType; + + /* + * The earliest time to which this database can be restored + */ + @JsonProperty(value = "earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestoreDate; + + /* + * The time the backup was taken + */ + @JsonProperty(value = "restorePointCreationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime restorePointCreationDate; + + /* + * The label of restore point for backup request by user + */ + @JsonProperty(value = "restorePointLabel", access = JsonProperty.Access.WRITE_ONLY) + private String restorePointLabel; + + /** + * 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/SecurityAlertPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityAlertPolicyProperties.java new file mode 100644 index 0000000000000..8a4c902e7d530 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityAlertPolicyProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of a security alert policy. */ +@Fluent +public final class SecurityAlertPolicyProperties { + /* + * 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 = "state", required = true) + 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, Brute_Force + */ + @JsonProperty(value = "disabledAlerts") + private List disabledAlerts; + + /* + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "emailAddresses") + private List emailAddresses; + + /* + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "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 = "storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the Threat Detection audit storage + * account. + */ + @JsonProperty(value = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "retentionDays") + private Integer retentionDays; + + /* + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "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 SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties 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, Brute_Force. + * + * @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, Brute_Force. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties 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 SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties 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 SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties 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 SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties 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 SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties 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 SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties 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() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model SecurityAlertPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityAlertPolicyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityAlertsPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityAlertsPolicyProperties.java new file mode 100644 index 0000000000000..318c7e394ff8b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityAlertsPolicyProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of a security alert policy. */ +@Fluent +public final class SecurityAlertsPolicyProperties { + /* + * 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 = "state", required = true) + private SecurityAlertsPolicyState state; + + /* + * Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, + * Data_Exfiltration, Unsafe_Action, Brute_Force + */ + @JsonProperty(value = "disabledAlerts") + private List disabledAlerts; + + /* + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "emailAddresses") + private List emailAddresses; + + /* + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "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 = "storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the Threat Detection audit storage + * account. + */ + @JsonProperty(value = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "retentionDays") + private Integer retentionDays; + + /* + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "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 SecurityAlertsPolicyState 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 SecurityAlertsPolicyProperties object itself. + */ + public SecurityAlertsPolicyProperties withState(SecurityAlertsPolicyState 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, Brute_Force. + * + * @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, Brute_Force. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the SecurityAlertsPolicyProperties object itself. + */ + public SecurityAlertsPolicyProperties 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 SecurityAlertsPolicyProperties object itself. + */ + public SecurityAlertsPolicyProperties 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 SecurityAlertsPolicyProperties object itself. + */ + public SecurityAlertsPolicyProperties 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 SecurityAlertsPolicyProperties object itself. + */ + public SecurityAlertsPolicyProperties 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 SecurityAlertsPolicyProperties object itself. + */ + public SecurityAlertsPolicyProperties 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 SecurityAlertsPolicyProperties object itself. + */ + public SecurityAlertsPolicyProperties 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() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model SecurityAlertsPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityAlertsPolicyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityEventInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityEventInner.java new file mode 100644 index 0000000000000..64df39f72369c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityEventInner.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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SecurityEventSqlInjectionAdditionalProperties; +import com.azure.resourcemanager.sql.generated.models.SecurityEventType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A security event. */ +@Fluent +public final class SecurityEventInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SecurityEventProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SecurityEventProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the eventTime property: The time when the security event occurred. + * + * @return the eventTime value. + */ + public OffsetDateTime eventTime() { + return this.innerProperties() == null ? null : this.innerProperties().eventTime(); + } + + /** + * Get the securityEventType property: The type of the security event. + * + * @return the securityEventType value. + */ + public SecurityEventType securityEventType() { + return this.innerProperties() == null ? null : this.innerProperties().securityEventType(); + } + + /** + * Get the subscription property: The subscription name. + * + * @return the subscription value. + */ + public String subscription() { + return this.innerProperties() == null ? null : this.innerProperties().subscription(); + } + + /** + * Get the server property: The server name. + * + * @return the server value. + */ + public String server() { + return this.innerProperties() == null ? null : this.innerProperties().server(); + } + + /** + * Get the database property: The database name. + * + * @return the database value. + */ + public String database() { + return this.innerProperties() == null ? null : this.innerProperties().database(); + } + + /** + * Get the clientIp property: The IP address of the client who executed the statement. + * + * @return the clientIp value. + */ + public String clientIp() { + return this.innerProperties() == null ? null : this.innerProperties().clientIp(); + } + + /** + * Get the applicationName property: The application used to execute the statement. + * + * @return the applicationName value. + */ + public String applicationName() { + return this.innerProperties() == null ? null : this.innerProperties().applicationName(); + } + + /** + * Get the principalName property: The principal user who executed the statement. + * + * @return the principalName value. + */ + public String principalName() { + return this.innerProperties() == null ? null : this.innerProperties().principalName(); + } + + /** + * Get the securityEventSqlInjectionAdditionalProperties property: The sql injection additional properties, + * populated only if the type of the security event is sql injection. + * + * @return the securityEventSqlInjectionAdditionalProperties value. + */ + public SecurityEventSqlInjectionAdditionalProperties securityEventSqlInjectionAdditionalProperties() { + return this.innerProperties() == null + ? null + : this.innerProperties().securityEventSqlInjectionAdditionalProperties(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityEventProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityEventProperties.java new file mode 100644 index 0000000000000..56a9a56ce7798 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityEventProperties.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.resourcemanager.sql.generated.models.SecurityEventSqlInjectionAdditionalProperties; +import com.azure.resourcemanager.sql.generated.models.SecurityEventType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a security event. */ +@Immutable +public final class SecurityEventProperties { + /* + * The time when the security event occurred. + */ + @JsonProperty(value = "eventTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime eventTime; + + /* + * The type of the security event. + */ + @JsonProperty(value = "securityEventType", access = JsonProperty.Access.WRITE_ONLY) + private SecurityEventType securityEventType; + + /* + * The subscription name + */ + @JsonProperty(value = "subscription", access = JsonProperty.Access.WRITE_ONLY) + private String subscription; + + /* + * The server name + */ + @JsonProperty(value = "server", access = JsonProperty.Access.WRITE_ONLY) + private String server; + + /* + * The database name + */ + @JsonProperty(value = "database", access = JsonProperty.Access.WRITE_ONLY) + private String database; + + /* + * The IP address of the client who executed the statement. + */ + @JsonProperty(value = "clientIp", access = JsonProperty.Access.WRITE_ONLY) + private String clientIp; + + /* + * The application used to execute the statement. + */ + @JsonProperty(value = "applicationName", access = JsonProperty.Access.WRITE_ONLY) + private String applicationName; + + /* + * The principal user who executed the statement + */ + @JsonProperty(value = "principalName", access = JsonProperty.Access.WRITE_ONLY) + private String principalName; + + /* + * The sql injection additional properties, populated only if the type of + * the security event is sql injection. + */ + @JsonProperty(value = "securityEventSqlInjectionAdditionalProperties", access = JsonProperty.Access.WRITE_ONLY) + private SecurityEventSqlInjectionAdditionalProperties securityEventSqlInjectionAdditionalProperties; + + /** + * Get the eventTime property: The time when the security event occurred. + * + * @return the eventTime value. + */ + public OffsetDateTime eventTime() { + return this.eventTime; + } + + /** + * Get the securityEventType property: The type of the security event. + * + * @return the securityEventType value. + */ + public SecurityEventType securityEventType() { + return this.securityEventType; + } + + /** + * Get the subscription property: The subscription name. + * + * @return the subscription value. + */ + public String subscription() { + return this.subscription; + } + + /** + * Get the server property: The server name. + * + * @return the server value. + */ + public String server() { + return this.server; + } + + /** + * Get the database property: The database name. + * + * @return the database value. + */ + public String database() { + return this.database; + } + + /** + * Get the clientIp property: The IP address of the client who executed the statement. + * + * @return the clientIp value. + */ + public String clientIp() { + return this.clientIp; + } + + /** + * Get the applicationName property: The application used to execute the statement. + * + * @return the applicationName value. + */ + public String applicationName() { + return this.applicationName; + } + + /** + * Get the principalName property: The principal user who executed the statement. + * + * @return the principalName value. + */ + public String principalName() { + return this.principalName; + } + + /** + * Get the securityEventSqlInjectionAdditionalProperties property: The sql injection additional properties, + * populated only if the type of the security event is sql injection. + * + * @return the securityEventSqlInjectionAdditionalProperties value. + */ + public SecurityEventSqlInjectionAdditionalProperties securityEventSqlInjectionAdditionalProperties() { + return this.securityEventSqlInjectionAdditionalProperties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (securityEventSqlInjectionAdditionalProperties() != null) { + securityEventSqlInjectionAdditionalProperties().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..fa8dba0a539ee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A sensitivity label. */ +@Fluent +public final class SensitivityLabelInner extends ProxyResource { + /* + * Resource that manages the sensitivity label. + */ + @JsonProperty(value = "managedBy", access = JsonProperty.Access.WRITE_ONLY) + private String managedBy; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SensitivityLabelProperties innerProperties; + + /** + * Get the managedBy property: Resource that manages the sensitivity label. + * + * @return the managedBy value. + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SensitivityLabelProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the schemaName property: The schema name. + * + * @return the schemaName value. + */ + public String schemaName() { + return this.innerProperties() == null ? null : this.innerProperties().schemaName(); + } + + /** + * Get the tableName property: The table name. + * + * @return the tableName value. + */ + public String tableName() { + return this.innerProperties() == null ? null : this.innerProperties().tableName(); + } + + /** + * Get the columnName property: The column name. + * + * @return the columnName value. + */ + public String columnName() { + return this.innerProperties() == null ? null : this.innerProperties().columnName(); + } + + /** + * Get the labelName property: The label name. + * + * @return the labelName value. + */ + public String labelName() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelProperties(); + } + this.innerProperties().withLabelName(labelName); + return this; + } + + /** + * Get the labelId property: The label ID. + * + * @return the labelId value. + */ + public String labelId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelProperties(); + } + this.innerProperties().withLabelId(labelId); + return this; + } + + /** + * Get the informationType property: The information type. + * + * @return the informationType value. + */ + public String informationType() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelProperties(); + } + this.innerProperties().withInformationType(informationType); + return this; + } + + /** + * Get the informationTypeId property: The information type ID. + * + * @return the informationTypeId value. + */ + public String informationTypeId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelProperties(); + } + this.innerProperties().withInformationTypeId(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.innerProperties() == null ? null : this.innerProperties().isDisabled(); + } + + /** + * Get the rank property: The rank property. + * + * @return the rank value. + */ + public SensitivityLabelRank rank() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelProperties(); + } + this.innerProperties().withRank(rank); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelProperties.java new file mode 100644 index 0000000000000..01bb93366a037 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a sensitivity label. */ +@Fluent +public final class SensitivityLabelProperties { + /* + * The schema name. + */ + @JsonProperty(value = "schemaName", access = JsonProperty.Access.WRITE_ONLY) + private String schemaName; + + /* + * The table name. + */ + @JsonProperty(value = "tableName", access = JsonProperty.Access.WRITE_ONLY) + private String tableName; + + /* + * The column name. + */ + @JsonProperty(value = "columnName", access = JsonProperty.Access.WRITE_ONLY) + private String columnName; + + /* + * The label name. + */ + @JsonProperty(value = "labelName") + private String labelName; + + /* + * The label ID. + */ + @JsonProperty(value = "labelId") + private String labelId; + + /* + * The information type. + */ + @JsonProperty(value = "informationType") + private String informationType; + + /* + * The information type ID. + */ + @JsonProperty(value = "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 = "isDisabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDisabled; + + /* + * The rank property. + */ + @JsonProperty(value = "rank") + private SensitivityLabelRank rank; + + /** + * Get the schemaName property: The schema name. + * + * @return the schemaName value. + */ + public String schemaName() { + return this.schemaName; + } + + /** + * Get the tableName property: The table name. + * + * @return the tableName value. + */ + public String tableName() { + return this.tableName; + } + + /** + * Get the columnName property: The column name. + * + * @return the columnName value. + */ + public String columnName() { + return this.columnName; + } + + /** + * 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 SensitivityLabelProperties object itself. + */ + public SensitivityLabelProperties 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 SensitivityLabelProperties object itself. + */ + public SensitivityLabelProperties 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 SensitivityLabelProperties object itself. + */ + public SensitivityLabelProperties 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 SensitivityLabelProperties object itself. + */ + public SensitivityLabelProperties 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 SensitivityLabelProperties object itself. + */ + public SensitivityLabelProperties 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/SensitivityLabelUpdateInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelUpdateInner.java new file mode 100644 index 0000000000000..9bdc07c675741 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelUpdateInner.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.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A sensitivity label update operation. */ +@Fluent +public final class SensitivityLabelUpdateInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SensitivityLabelUpdatePropertiesInner innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SensitivityLabelUpdatePropertiesInner innerProperties() { + return this.innerProperties; + } + + /** + * Get the op property: The op property. + * + * @return the op value. + */ + public SensitivityLabelUpdateKind op() { + return this.innerProperties() == null ? null : this.innerProperties().op(); + } + + /** + * Set the op property: The op property. + * + * @param op the op value to set. + * @return the SensitivityLabelUpdateInner object itself. + */ + public SensitivityLabelUpdateInner withOp(SensitivityLabelUpdateKind op) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelUpdatePropertiesInner(); + } + this.innerProperties().withOp(op); + return this; + } + + /** + * Get the schema property: Schema name of the column to update. + * + * @return the schema value. + */ + public String schema() { + return this.innerProperties() == null ? null : this.innerProperties().schema(); + } + + /** + * Set the schema property: Schema name of the column to update. + * + * @param schema the schema value to set. + * @return the SensitivityLabelUpdateInner object itself. + */ + public SensitivityLabelUpdateInner withSchema(String schema) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelUpdatePropertiesInner(); + } + this.innerProperties().withSchema(schema); + return this; + } + + /** + * Get the table property: Table name of the column to update. + * + * @return the table value. + */ + public String table() { + return this.innerProperties() == null ? null : this.innerProperties().table(); + } + + /** + * Set the table property: Table name of the column to update. + * + * @param table the table value to set. + * @return the SensitivityLabelUpdateInner object itself. + */ + public SensitivityLabelUpdateInner withTable(String table) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelUpdatePropertiesInner(); + } + this.innerProperties().withTable(table); + return this; + } + + /** + * Get the column property: Column name to update. + * + * @return the column value. + */ + public String column() { + return this.innerProperties() == null ? null : this.innerProperties().column(); + } + + /** + * Set the column property: Column name to update. + * + * @param column the column value to set. + * @return the SensitivityLabelUpdateInner object itself. + */ + public SensitivityLabelUpdateInner withColumn(String column) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelUpdatePropertiesInner(); + } + this.innerProperties().withColumn(column); + return this; + } + + /** + * Get the sensitivityLabel property: The sensitivity label information to apply on a column. + * + * @return the sensitivityLabel value. + */ + public SensitivityLabelInner sensitivityLabel() { + return this.innerProperties() == null ? null : this.innerProperties().sensitivityLabel(); + } + + /** + * Set the sensitivityLabel property: The sensitivity label information to apply on a column. + * + * @param sensitivityLabel the sensitivityLabel value to set. + * @return the SensitivityLabelUpdateInner object itself. + */ + public SensitivityLabelUpdateInner withSensitivityLabel(SensitivityLabelInner sensitivityLabel) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelUpdatePropertiesInner(); + } + this.innerProperties().withSensitivityLabel(sensitivityLabel); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelUpdatePropertiesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelUpdatePropertiesInner.java new file mode 100644 index 0000000000000..c5b9f9cf43a58 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelUpdatePropertiesInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an operation executed on a sensitivity label. */ +@Fluent +public final class SensitivityLabelUpdatePropertiesInner { + /* + * The op property. + */ + @JsonProperty(value = "op", required = true) + private SensitivityLabelUpdateKind op; + + /* + * Schema name of the column to update. + */ + @JsonProperty(value = "schema", required = true) + private String schema; + + /* + * Table name of the column to update. + */ + @JsonProperty(value = "table", required = true) + private String table; + + /* + * Column name to update. + */ + @JsonProperty(value = "column", required = true) + private String column; + + /* + * The sensitivity label information to apply on a column. + */ + @JsonProperty(value = "sensitivityLabel") + private SensitivityLabelInner sensitivityLabel; + + /** + * Get the op property: The op property. + * + * @return the op value. + */ + public SensitivityLabelUpdateKind op() { + return this.op; + } + + /** + * Set the op property: The op property. + * + * @param op the op value to set. + * @return the SensitivityLabelUpdatePropertiesInner object itself. + */ + public SensitivityLabelUpdatePropertiesInner withOp(SensitivityLabelUpdateKind op) { + this.op = op; + return this; + } + + /** + * Get the schema property: Schema name of the column to update. + * + * @return the schema value. + */ + public String schema() { + return this.schema; + } + + /** + * Set the schema property: Schema name of the column to update. + * + * @param schema the schema value to set. + * @return the SensitivityLabelUpdatePropertiesInner object itself. + */ + public SensitivityLabelUpdatePropertiesInner withSchema(String schema) { + this.schema = schema; + return this; + } + + /** + * Get the table property: Table name of the column to update. + * + * @return the table value. + */ + public String table() { + return this.table; + } + + /** + * Set the table property: Table name of the column to update. + * + * @param table the table value to set. + * @return the SensitivityLabelUpdatePropertiesInner object itself. + */ + public SensitivityLabelUpdatePropertiesInner withTable(String table) { + this.table = table; + return this; + } + + /** + * Get the column property: Column name to update. + * + * @return the column value. + */ + public String column() { + return this.column; + } + + /** + * Set the column property: Column name to update. + * + * @param column the column value to set. + * @return the SensitivityLabelUpdatePropertiesInner object itself. + */ + public SensitivityLabelUpdatePropertiesInner withColumn(String column) { + this.column = column; + return this; + } + + /** + * Get the sensitivityLabel property: The sensitivity label information to apply on a column. + * + * @return the sensitivityLabel value. + */ + public SensitivityLabelInner sensitivityLabel() { + return this.sensitivityLabel; + } + + /** + * Set the sensitivityLabel property: The sensitivity label information to apply on a column. + * + * @param sensitivityLabel the sensitivityLabel value to set. + * @return the SensitivityLabelUpdatePropertiesInner object itself. + */ + public SensitivityLabelUpdatePropertiesInner withSensitivityLabel(SensitivityLabelInner sensitivityLabel) { + this.sensitivityLabel = sensitivityLabel; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (op() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property op in model SensitivityLabelUpdatePropertiesInner")); + } + if (schema() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property schema in model SensitivityLabelUpdatePropertiesInner")); + } + if (table() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property table in model SensitivityLabelUpdatePropertiesInner")); + } + if (column() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property column in model SensitivityLabelUpdatePropertiesInner")); + } + if (sensitivityLabel() != null) { + sensitivityLabel().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SensitivityLabelUpdatePropertiesInner.class); +} 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..7785e4622dbff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAutomaticTuningInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerOptions; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Server-level Automatic Tuning. */ +@Fluent +public final class ServerAutomaticTuningInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private AutomaticTuningServerProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private AutomaticTuningServerProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the desiredState property: Automatic tuning desired state. + * + * @return the desiredState value. + */ + public AutomaticTuningServerMode desiredState() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new AutomaticTuningServerProperties(); + } + this.innerProperties().withDesiredState(desiredState); + return this; + } + + /** + * Get the actualState property: Automatic tuning actual state. + * + * @return the actualState value. + */ + public AutomaticTuningServerMode actualState() { + return this.innerProperties() == null ? null : this.innerProperties().actualState(); + } + + /** + * Get the options property: Automatic tuning options definition. + * + * @return the options value. + */ + public Map options() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new AutomaticTuningServerProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..2004fc063aa20 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADAdministratorInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.AdministratorType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Azure Active Directory administrator. */ +@Fluent +public final class ServerAzureADAdministratorInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private AdministratorProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private AdministratorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the administratorType property: Type of the sever administrator. + * + * @return the administratorType value. + */ + public AdministratorType administratorType() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorProperties(); + } + this.innerProperties().withAdministratorType(administratorType); + return this; + } + + /** + * Get the login property: Login name of the server administrator. + * + * @return the login value. + */ + public String login() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorProperties(); + } + this.innerProperties().withLogin(login); + return this; + } + + /** + * Get the sid property: SID (object ID) of the server administrator. + * + * @return the sid value. + */ + public UUID sid() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorProperties(); + } + this.innerProperties().withSid(sid); + return this; + } + + /** + * Get the tenantId property: Tenant ID of the administrator. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + public Boolean azureADOnlyAuthentication() { + return this.innerProperties() == null ? null : this.innerProperties().azureADOnlyAuthentication(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().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..fcf79a4680718 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADOnlyAuthenticationInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure Active Directory only authentication. */ +@Fluent +public final class ServerAzureADOnlyAuthenticationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private AzureADOnlyAuthProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private AzureADOnlyAuthProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + public Boolean azureADOnlyAuthentication() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureADOnlyAuthProperties(); + } + this.innerProperties().withAzureADOnlyAuthentication(azureADOnlyAuthentication); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..1f95a6113d5e1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** A server blob auditing policy. */ +@Fluent +public final class ServerBlobAuditingPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerBlobAuditingPolicyProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerBlobAuditingPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be 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 isDevopsAuditEnabled value. + */ + public Boolean isDevopsAuditEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isDevopsAuditEnabled(); + } + + /** + * Set the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be 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 isDevopsAuditEnabled the isDevopsAuditEnabled value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsDevopsAuditEnabled(isDevopsAuditEnabled); + 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withRetentionDays(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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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.innerProperties() == null ? null : this.innerProperties().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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withAuditActionsAndGroups(auditActionsAndGroups); + 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsStorageSecondaryKeyInUse(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsAzureMonitorTargetEnabled(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withQueueDelayMs(queueDelayMs); + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.innerProperties() == null ? null : this.innerProperties().isManagedIdentityInUse(); + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsManagedIdentityInUse(isManagedIdentityInUse); + 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.innerProperties() == null ? null : this.innerProperties().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 ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withState(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyProperties.java new file mode 100644 index 0000000000000..d1320e1f7f9fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyProperties.java @@ -0,0 +1,594 @@ +// Copyright (c) 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.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** Properties of a server blob auditing policy. */ +@Fluent +public final class ServerBlobAuditingPolicyProperties { + /* + * Specifies the state of devops audit. If state is Enabled, devops logs + * will be sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as + * 'Enabled', 'IsAzureMonitorTargetEnabled' as true and + * 'IsDevopsAuditEnabled' as true + * + * When using REST API to configure auditing, Diagnostic Settings with + * 'DevOpsOperationsAudit' diagnostic logs category on the master database + * should also be 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 = "isDevopsAuditEnabled") + private Boolean isDevopsAuditEnabled; + + /* + * Specifies the number of days to keep in the audit logs in the storage + * account. + */ + @JsonProperty(value = "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 + * DBCC_GROUP + * DATABASE_OWNERSHIP_CHANGE_GROUP + * DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 = "auditActionsAndGroups") + private List auditActionsAndGroups; + + /* + * Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + */ + @JsonProperty(value = "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 = "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 = "queueDelayMs") + private Integer queueDelayMs; + + /* + * Specifies whether Managed Identity is used to access blob storage + */ + @JsonProperty(value = "isManagedIdentityInUse") + private Boolean isManagedIdentityInUse; + + /* + * Specifies the state of the audit. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. + */ + @JsonProperty(value = "state", required = true) + 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 = "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 = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * Get the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be 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 isDevopsAuditEnabled value. + */ + public Boolean isDevopsAuditEnabled() { + return this.isDevopsAuditEnabled; + } + + /** + * Set the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be 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 isDevopsAuditEnabled the isDevopsAuditEnabled value to set. + * @return the ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled) { + this.isDevopsAuditEnabled = isDevopsAuditEnabled; + 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 ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + 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 ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties 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 ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties 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 ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withQueueDelayMs(Integer queueDelayMs) { + this.queueDelayMs = queueDelayMs; + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.isManagedIdentityInUse; + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.isManagedIdentityInUse = isManagedIdentityInUse; + 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 ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties 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 ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties 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 ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties 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 ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * 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 ServerBlobAuditingPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerBlobAuditingPolicyProperties.class); +} 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..35c06beee6277 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkInner.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.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Server communication link. */ +@Fluent +public final class ServerCommunicationLinkInner extends ProxyResource { + /* + * The properties of resource. + */ + @JsonProperty(value = "properties") + private ServerCommunicationLinkProperties innerProperties; + + /* + * 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; + + /** + * Get the innerProperties property: The properties of resource. + * + * @return the innerProperties value. + */ + private ServerCommunicationLinkProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the partnerServer property: The name of the partner server. + * + * @return the partnerServer value. + */ + public String partnerServer() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerCommunicationLinkProperties(); + } + this.innerProperties().withPartnerServer(partnerServer); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkProperties.java new file mode 100644 index 0000000000000..a112030bf8fee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server communication link. */ +@Fluent +public final class ServerCommunicationLinkProperties { + /* + * The state. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The name of the partner server. + */ + @JsonProperty(value = "partnerServer", required = true) + private String partnerServer; + + /** + * 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 ServerCommunicationLinkProperties object itself. + */ + public ServerCommunicationLinkProperties withPartnerServer(String partnerServer) { + this.partnerServer = partnerServer; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (partnerServer() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property partnerServer in model ServerCommunicationLinkProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerCommunicationLinkProperties.class); +} 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..dd3635ade8b66 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A server connection policy. */ +@Fluent +public final class ServerConnectionPolicyInner extends ProxyResource { + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Metadata used for the Azure portal experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerConnectionPolicyProperties innerProperties; + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the kind property: Metadata used for the Azure portal experience. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerConnectionPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the connectionType property: The server connection type. + * + * @return the connectionType value. + */ + public ServerConnectionType connectionType() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerConnectionPolicyProperties(); + } + this.innerProperties().withConnectionType(connectionType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyProperties.java new file mode 100644 index 0000000000000..9de6ebf9ee8b1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyProperties.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.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server connection policy. */ +@Fluent +public final class ServerConnectionPolicyProperties { + /* + * The server connection type. + */ + @JsonProperty(value = "connectionType", required = true) + private ServerConnectionType connectionType; + + /** + * 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 ServerConnectionPolicyProperties object itself. + */ + public ServerConnectionPolicyProperties withConnectionType(ServerConnectionType connectionType) { + this.connectionType = connectionType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connectionType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property connectionType in model ServerConnectionPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerConnectionPolicyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditSettingsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditSettingsProperties.java new file mode 100644 index 0000000000000..d2db946be7399 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditSettingsProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Properties of a server DevOps audit settings. */ +@Fluent +public final class ServerDevOpsAuditSettingsProperties { + /* + * 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 = "isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /* + * Specifies the state of the audit. If state is Enabled, storageEndpoint + * or isAzureMonitorTargetEnabled are required. + */ + @JsonProperty(value = "state", required = true) + 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 = "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 = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** + * 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 ServerDevOpsAuditSettingsProperties object itself. + */ + public ServerDevOpsAuditSettingsProperties 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 ServerDevOpsAuditSettingsProperties object itself. + */ + public ServerDevOpsAuditSettingsProperties 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 ServerDevOpsAuditSettingsProperties object itself. + */ + public ServerDevOpsAuditSettingsProperties 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 ServerDevOpsAuditSettingsProperties object itself. + */ + public ServerDevOpsAuditSettingsProperties 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 ServerDevOpsAuditSettingsProperties object itself. + */ + public ServerDevOpsAuditSettingsProperties withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * 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 ServerDevOpsAuditSettingsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerDevOpsAuditSettingsProperties.class); +} 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..422b5145d4a80 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditingSettingsInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** A server DevOps auditing settings. */ +@Fluent +public final class ServerDevOpsAuditingSettingsInner extends ProxyResource { + /* + * SystemData of ServerDevOpsAuditSettingsResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerDevOpsAuditSettingsProperties innerProperties; + + /** + * Get the systemData property: SystemData of ServerDevOpsAuditSettingsResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerDevOpsAuditSettingsProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerDevOpsAuditSettingsProperties(); + } + this.innerProperties().withIsAzureMonitorTargetEnabled(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerDevOpsAuditSettingsProperties(); + } + this.innerProperties().withState(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerDevOpsAuditSettingsProperties(); + } + this.innerProperties().withStorageEndpoint(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerDevOpsAuditSettingsProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerDevOpsAuditSettingsProperties(); + } + this.innerProperties().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..924edee1910b0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasInner.java @@ -0,0 +1,48 @@ +// Copyright (c) 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.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A server DNS alias. */ +@Fluent +public final class ServerDnsAliasInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerDnsAliasProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerDnsAliasProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the azureDnsRecord property: The fully qualified DNS record for alias. + * + * @return the azureDnsRecord value. + */ + public String azureDnsRecord() { + return this.innerProperties() == null ? null : this.innerProperties().azureDnsRecord(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasProperties.java new file mode 100644 index 0000000000000..313e0b5c16194 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasProperties.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a server DNS alias. */ +@Immutable +public final class ServerDnsAliasProperties { + /* + * The fully qualified DNS record for alias + */ + @JsonProperty(value = "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/ServerFirewallRuleProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerFirewallRuleProperties.java new file mode 100644 index 0000000000000..02607532ee2c3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerFirewallRuleProperties.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.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server firewall rule. */ +@Fluent +public final class ServerFirewallRuleProperties { + /* + * The start IP address of the firewall rule. Must be IPv4 format. Use + * value '0.0.0.0' for all Azure-internal IP addresses. + */ + @JsonProperty(value = "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' for all + * Azure-internal IP addresses. + */ + @JsonProperty(value = "endIpAddress") + private String endIpAddress; + + /** + * Get the startIpAddress property: The start IP address of the firewall rule. Must be IPv4 format. Use value + * '0.0.0.0' for 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' for all Azure-internal IP addresses. + * + * @param startIpAddress the startIpAddress value to set. + * @return the ServerFirewallRuleProperties object itself. + */ + public ServerFirewallRuleProperties 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' for 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' for all Azure-internal IP addresses. + * + * @param endIpAddress the endIpAddress value to set. + * @return the ServerFirewallRuleProperties object itself. + */ + public ServerFirewallRuleProperties 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/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..dedc938a5227e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerInner.java @@ -0,0 +1,379 @@ +// Copyright (c) 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.management.Resource; +import com.azure.resourcemanager.sql.generated.models.ResourceIdentity; +import com.azure.resourcemanager.sql.generated.models.ServerExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ServerNetworkAccessFlag; +import com.azure.resourcemanager.sql.generated.models.ServerPrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.ServerWorkspaceFeature; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** An Azure SQL Database server. */ +@Fluent +public final class ServerInner extends Resource { + /* + * 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; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerProperties innerProperties; + + /** + * 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ServerInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerInner withTags(Map tags) { + super.withTags(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAdministratorLogin(administratorLogin); + return this; + } + + /** + * Get the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + /** + * Get the version property: The version of the server. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the state property: The state of the server. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().fullyQualifiedDomainName(); + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a server. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withMinimalTlsVersion(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 ServerNetworkAccessFlag publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().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(ServerNetworkAccessFlag publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the workspaceFeature property: Whether or not existing server has a workspace created and if it allows + * connection from workspace. + * + * @return the workspaceFeature value. + */ + public ServerWorkspaceFeature workspaceFeature() { + return this.innerProperties() == null ? null : this.innerProperties().workspaceFeature(); + } + + /** + * Get the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + public String primaryUserAssignedIdentityId() { + return this.innerProperties() == null ? null : this.innerProperties().primaryUserAssignedIdentityId(); + } + + /** + * Set the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. + * @return the ServerInner object itself. + */ + public ServerInner withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } + + /** + * Get the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @return the federatedClientId value. + */ + public UUID federatedClientId() { + return this.innerProperties() == null ? null : this.innerProperties().federatedClientId(); + } + + /** + * Set the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the ServerInner object itself. + */ + public ServerInner withFederatedClientId(UUID federatedClientId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withFederatedClientId(federatedClientId); + return this; + } + + /** + * Get the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + public String keyId() { + return this.innerProperties() == null ? null : this.innerProperties().keyId(); + } + + /** + * Set the keyId property: A CMK URI of the key to use for encryption. + * + * @param keyId the keyId value to set. + * @return the ServerInner object itself. + */ + public ServerInner withKeyId(String keyId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withKeyId(keyId); + return this; + } + + /** + * Get the administrators property: The Azure Active Directory identity of the server. + * + * @return the administrators value. + */ + public ServerExternalAdministrator administrators() { + return this.innerProperties() == null ? null : this.innerProperties().administrators(); + } + + /** + * Set the administrators property: The Azure Active Directory identity of the server. + * + * @param administrators the administrators value to set. + * @return the ServerInner object itself. + */ + public ServerInner withAdministrators(ServerExternalAdministrator administrators) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAdministrators(administrators); + return this; + } + + /** + * Get the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the restrictOutboundNetworkAccess value. + */ + public ServerNetworkAccessFlag restrictOutboundNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().restrictOutboundNetworkAccess(); + } + + /** + * Set the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param restrictOutboundNetworkAccess the restrictOutboundNetworkAccess value to set. + * @return the ServerInner object itself. + */ + public ServerInner withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag restrictOutboundNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withRestrictOutboundNetworkAccess(restrictOutboundNetworkAccess); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().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..ad9092e1b98b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyInner.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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A server key. */ +@Fluent +public final class ServerKeyInner extends ProxyResource { + /* + * 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; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerKeyProperties innerProperties; + + /** + * 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerKeyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the subregion property: Subregion of the server key. + * + * @return the subregion value. + */ + public String subregion() { + return this.innerProperties() == null ? null : this.innerProperties().subregion(); + } + + /** + * Get the serverKeyType property: The server key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerKeyProperties(); + } + this.innerProperties().withServerKeyType(serverKeyType); + return this; + } + + /** + * Get the uri property: The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @return the uri value. + */ + public String uri() { + return this.innerProperties() == null ? null : this.innerProperties().uri(); + } + + /** + * Set the uri property: The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @param uri the uri value to set. + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withUri(String uri) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerKeyProperties(); + } + this.innerProperties().withUri(uri); + return this; + } + + /** + * Get the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.innerProperties() == null ? null : this.innerProperties().thumbprint(); + } + + /** + * Get the creationDate property: The server key creation date. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().autoRotationEnabled(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyProperties.java new file mode 100644 index 0000000000000..6edc728d9221a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties for a server key execution. */ +@Fluent +public final class ServerKeyProperties { + /* + * Subregion of the server key. + */ + @JsonProperty(value = "subregion", access = JsonProperty.Access.WRITE_ONLY) + private String subregion; + + /* + * The server key type like 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /* + * The URI of the server key. If the ServerKeyType is AzureKeyVault, then + * the URI is required. + */ + @JsonProperty(value = "uri") + private String uri; + + /* + * Thumbprint of the server key. + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * The server key creation date. + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * Key auto rotation opt-in flag. Either true or false. + */ + @JsonProperty(value = "autoRotationEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean autoRotationEnabled; + + /** + * 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 ServerKeyProperties object itself. + */ + public ServerKeyProperties withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the uri property: The URI of the server 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 server key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @param uri the uri value to set. + * @return the ServerKeyProperties object itself. + */ + public ServerKeyProperties 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; + } + + /** + * Get the creationDate property: The server key creation date. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.autoRotationEnabled; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverKeyType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property serverKeyType in model ServerKeyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerKeyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerOperationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerOperationInner.java new file mode 100644 index 0000000000000..9517172f7283b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerOperationInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A server operation. */ +@Fluent +public final class ServerOperationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerOperationProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerOperationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.innerProperties() == null ? null : this.innerProperties().operation(); + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.innerProperties() == null ? null : this.innerProperties().operationFriendlyName(); + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Get the serverName property: The name of the server. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public ManagementOperationState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.innerProperties() == null ? null : this.innerProperties().errorDescription(); + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.innerProperties() == null ? null : this.innerProperties().errorSeverity(); + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.innerProperties() == null ? null : this.innerProperties().isUserError(); + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().estimatedCompletionTime(); + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.innerProperties() == null ? null : this.innerProperties().isCancellable(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerOperationProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerOperationProperties.java new file mode 100644 index 0000000000000..162b5b238bcdd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerOperationProperties.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.Immutable; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a server operation. */ +@Immutable +public final class ServerOperationProperties { + /* + * The name of operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The friendly name of operation. + */ + @JsonProperty(value = "operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /* + * The percentage of the operation completed. + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The name of the server. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The operation start time. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The operation state. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private ManagementOperationState state; + + /* + * The operation error code. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The operation error description. + */ + @JsonProperty(value = "errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /* + * The operation error severity. + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * Whether or not the error is a user error. + */ + @JsonProperty(value = "isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /* + * The estimated completion time of the operation. + */ + @JsonProperty(value = "estimatedCompletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime estimatedCompletionTime; + + /* + * The operation description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Whether the operation can be cancelled. + */ + @JsonProperty(value = "isCancellable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isCancellable; + + /** + * 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/ServerProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerProperties.java new file mode 100644 index 0000000000000..913012c161d3b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.ServerExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ServerNetworkAccessFlag; +import com.azure.resourcemanager.sql.generated.models.ServerPrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.ServerWorkspaceFeature; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** The properties of a server. */ +@Fluent +public final class ServerProperties { + /* + * Administrator username for the server. Once created it cannot be + * changed. + */ + @JsonProperty(value = "administratorLogin") + private String administratorLogin; + + /* + * The administrator login password (required for server creation). + */ + @JsonProperty(value = "administratorLoginPassword") + private String administratorLoginPassword; + + /* + * The version of the server. + */ + @JsonProperty(value = "version") + private String version; + + /* + * The state of the server. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The fully qualified domain name of the server. + */ + @JsonProperty(value = "fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /* + * List of private endpoint connections on a server + */ + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * Minimal TLS version. Allowed values: '1.0', '1.1', '1.2' + */ + @JsonProperty(value = "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 = "publicNetworkAccess") + private ServerNetworkAccessFlag publicNetworkAccess; + + /* + * Whether or not existing server has a workspace created and if it allows + * connection from workspace + */ + @JsonProperty(value = "workspaceFeature", access = JsonProperty.Access.WRITE_ONLY) + private ServerWorkspaceFeature workspaceFeature; + + /* + * The resource id of a user assigned identity to be used by default. + */ + @JsonProperty(value = "primaryUserAssignedIdentityId") + private String primaryUserAssignedIdentityId; + + /* + * The Client id used for cross tenant CMK scenario + */ + @JsonProperty(value = "federatedClientId") + private UUID federatedClientId; + + /* + * A CMK URI of the key to use for encryption. + */ + @JsonProperty(value = "keyId") + private String keyId; + + /* + * The Azure Active Directory identity of the server. + */ + @JsonProperty(value = "administrators") + private ServerExternalAdministrator administrators; + + /* + * Whether or not to restrict outbound network access for this server. + * Value is optional but if passed in, must be 'Enabled' or 'Disabled' + */ + @JsonProperty(value = "restrictOutboundNetworkAccess") + private ServerNetworkAccessFlag restrictOutboundNetworkAccess; + + /** + * 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 ServerProperties object itself. + */ + public ServerProperties 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 ServerProperties object itself. + */ + public ServerProperties 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 ServerProperties object itself. + */ + public ServerProperties 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 ServerProperties object itself. + */ + public ServerProperties 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 ServerNetworkAccessFlag 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 ServerProperties object itself. + */ + public ServerProperties withPublicNetworkAccess(ServerNetworkAccessFlag publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the workspaceFeature property: Whether or not existing server has a workspace created and if it allows + * connection from workspace. + * + * @return the workspaceFeature value. + */ + public ServerWorkspaceFeature workspaceFeature() { + return this.workspaceFeature; + } + + /** + * Get the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + public String primaryUserAssignedIdentityId() { + return this.primaryUserAssignedIdentityId; + } + + /** + * Set the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + this.primaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + return this; + } + + /** + * Get the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @return the federatedClientId value. + */ + public UUID federatedClientId() { + return this.federatedClientId; + } + + /** + * Set the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withFederatedClientId(UUID federatedClientId) { + this.federatedClientId = federatedClientId; + return this; + } + + /** + * Get the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + public String keyId() { + return this.keyId; + } + + /** + * Set the keyId property: A CMK URI of the key to use for encryption. + * + * @param keyId the keyId value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withKeyId(String keyId) { + this.keyId = keyId; + return this; + } + + /** + * Get the administrators property: The Azure Active Directory identity of the server. + * + * @return the administrators value. + */ + public ServerExternalAdministrator administrators() { + return this.administrators; + } + + /** + * Set the administrators property: The Azure Active Directory identity of the server. + * + * @param administrators the administrators value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withAdministrators(ServerExternalAdministrator administrators) { + this.administrators = administrators; + return this; + } + + /** + * Get the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the restrictOutboundNetworkAccess value. + */ + public ServerNetworkAccessFlag restrictOutboundNetworkAccess() { + return this.restrictOutboundNetworkAccess; + } + + /** + * Set the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param restrictOutboundNetworkAccess the restrictOutboundNetworkAccess value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag restrictOutboundNetworkAccess) { + this.restrictOutboundNetworkAccess = restrictOutboundNetworkAccess; + 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()); + } + if (administrators() != null) { + administrators().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..dd1f334f032a5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerSecurityAlertPolicyInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A server security alert policy. */ +@Fluent +public final class ServerSecurityAlertPolicyInner extends ProxyResource { + /* + * SystemData of SecurityAlertPolicyResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SecurityAlertsPolicyProperties innerProperties; + + /** + * Get the systemData property: SystemData of SecurityAlertPolicyResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SecurityAlertsPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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 SecurityAlertsPolicyState state() { + return this.innerProperties() == null ? null : this.innerProperties().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(SecurityAlertsPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withState(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, Brute_Force. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.innerProperties() == null ? null : this.innerProperties().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, Brute_Force. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withDisabledAlerts(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withEmailAddresses(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withEmailAccountAdmins(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.innerProperties() == null ? null : this.innerProperties().creationTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustCertificateInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustCertificateInner.java new file mode 100644 index 0000000000000..3704138b2eee8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustCertificateInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Server trust certificate imported from box to enable connection between box and Sql Managed Instance. */ +@Fluent +public final class ServerTrustCertificateInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerTrustCertificateProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerTrustCertificateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the publicBlob property: The certificate public blob. + * + * @return the publicBlob value. + */ + public String publicBlob() { + return this.innerProperties() == null ? null : this.innerProperties().publicBlob(); + } + + /** + * Set the publicBlob property: The certificate public blob. + * + * @param publicBlob the publicBlob value to set. + * @return the ServerTrustCertificateInner object itself. + */ + public ServerTrustCertificateInner withPublicBlob(String publicBlob) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerTrustCertificateProperties(); + } + this.innerProperties().withPublicBlob(publicBlob); + return this; + } + + /** + * Get the thumbprint property: The certificate thumbprint. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.innerProperties() == null ? null : this.innerProperties().thumbprint(); + } + + /** + * Get the certificateName property: The certificate name. + * + * @return the certificateName value. + */ + public String certificateName() { + return this.innerProperties() == null ? null : this.innerProperties().certificateName(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustCertificateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustCertificateProperties.java new file mode 100644 index 0000000000000..5c4343fe173ff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustCertificateProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server trust certificate. */ +@Fluent +public final class ServerTrustCertificateProperties { + /* + * The certificate public blob + */ + @JsonProperty(value = "publicBlob") + private String publicBlob; + + /* + * The certificate thumbprint + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * The certificate name + */ + @JsonProperty(value = "certificateName", access = JsonProperty.Access.WRITE_ONLY) + private String certificateName; + + /** + * Get the publicBlob property: The certificate public blob. + * + * @return the publicBlob value. + */ + public String publicBlob() { + return this.publicBlob; + } + + /** + * Set the publicBlob property: The certificate public blob. + * + * @param publicBlob the publicBlob value to set. + * @return the ServerTrustCertificateProperties object itself. + */ + public ServerTrustCertificateProperties withPublicBlob(String publicBlob) { + this.publicBlob = publicBlob; + return this; + } + + /** + * Get the thumbprint property: The certificate thumbprint. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the certificateName property: The certificate name. + * + * @return the certificateName value. + */ + public String certificateName() { + return this.certificateName; + } + + /** + * 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..956eac83de5a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupInner.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.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ServerInfo; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroupPropertiesTrustScopesItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A server trust group. */ +@Fluent +public final class ServerTrustGroupInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerTrustGroupProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerTrustGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the groupMembers property: Group members information for the server trust group. + * + * @return the groupMembers value. + */ + public List groupMembers() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerTrustGroupProperties(); + } + this.innerProperties().withGroupMembers(groupMembers); + return this; + } + + /** + * Get the trustScopes property: Trust scope of the server trust group. + * + * @return the trustScopes value. + */ + public List trustScopes() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerTrustGroupProperties(); + } + this.innerProperties().withTrustScopes(trustScopes); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupProperties.java new file mode 100644 index 0000000000000..00b2432477669 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerInfo; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroupPropertiesTrustScopesItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a server trust group. */ +@Fluent +public final class ServerTrustGroupProperties { + /* + * Group members information for the server trust group. + */ + @JsonProperty(value = "groupMembers", required = true) + private List groupMembers; + + /* + * Trust scope of the server trust group. + */ + @JsonProperty(value = "trustScopes", required = true) + 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 ServerTrustGroupProperties object itself. + */ + public ServerTrustGroupProperties 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 ServerTrustGroupProperties object itself. + */ + public ServerTrustGroupProperties 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property groupMembers in model ServerTrustGroupProperties")); + } else { + groupMembers().forEach(e -> e.validate()); + } + if (trustScopes() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property trustScopes in model ServerTrustGroupProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerTrustGroupProperties.class); +} 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..f41bba850a6d3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerUsageInner.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents server metrics. */ +@Immutable +public final class ServerUsageInner { + /* + * 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..b05723b7e5f7e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A server vulnerability assessment. */ +@Fluent +public final class ServerVulnerabilityAssessmentInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerVulnerabilityAssessmentProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerVulnerabilityAssessmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageContainerPath(storageContainerPath); + return this; + } + + /** + * Get the storageContainerSasKey property: A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageContainerSasKey value. + */ + public String storageContainerSasKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageContainerSasKey(); + } + + /** + * Set the storageContainerSasKey property: A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageContainerSasKey the storageContainerSasKey value to set. + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageContainerSasKey(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. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.innerProperties() == null ? null : this.innerProperties().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. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerVulnerabilityAssessmentProperties(); + } + this.innerProperties().withRecurringScans(recurringScans); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentProperties.java new file mode 100644 index 0000000000000..b9ff9bb8c9b67 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a server Vulnerability Assessment. */ +@Fluent +public final class ServerVulnerabilityAssessmentProperties { + /* + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "storageContainerPath", required = true) + private String storageContainerPath; + + /* + * A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If + * 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is + * required. Applies only if the storage account is not behind a Vnet or a + * firewall + */ + @JsonProperty(value = "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. Applies only if the storage account + * is not behind a Vnet or a firewall + */ + @JsonProperty(value = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * The recurring scans settings + */ + @JsonProperty(value = "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 ServerVulnerabilityAssessmentProperties object itself. + */ + public ServerVulnerabilityAssessmentProperties withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * Get the storageContainerSasKey property: A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageContainerSasKey value. + */ + public String storageContainerSasKey() { + return this.storageContainerSasKey; + } + + /** + * Set the storageContainerSasKey property: A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageContainerSasKey the storageContainerSasKey value to set. + * @return the ServerVulnerabilityAssessmentProperties object itself. + */ + public ServerVulnerabilityAssessmentProperties 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. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @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. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerVulnerabilityAssessmentProperties object itself. + */ + public ServerVulnerabilityAssessmentProperties 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 ServerVulnerabilityAssessmentProperties object itself. + */ + public ServerVulnerabilityAssessmentProperties withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageContainerPath() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageContainerPath in model" + + " ServerVulnerabilityAssessmentProperties")); + } + if (recurringScans() != null) { + recurringScans().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerVulnerabilityAssessmentProperties.class); +} 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..ce8c59edd5208 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveInner.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.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a database service objective. */ +@Fluent +public final class ServiceObjectiveInner extends ProxyResource { + /* + * Represents the properties of the resource. + */ + @JsonProperty(value = "properties") + private ServiceObjectiveProperties innerProperties; + + /** + * Get the innerProperties property: Represents the properties of the resource. + * + * @return the innerProperties value. + */ + private ServiceObjectiveProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the serviceObjectiveName property: The name for the service objective. + * + * @return the serviceObjectiveName value. + */ + public String serviceObjectiveName() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().isSystem(); + } + + /** + * Get the description property: The description for the service level objective. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the enabled property: Gets whether the service level objective is enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveProperties.java new file mode 100644 index 0000000000000..b35f8dbbc603d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveProperties.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents the properties of a database service objective. */ +@Immutable +public final class ServiceObjectiveProperties { + /* + * The name for the service objective. + */ + @JsonProperty(value = "serviceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String serviceObjectiveName; + + /* + * Gets whether the service level objective is the default service + * objective. + */ + @JsonProperty(value = "isDefault", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDefault; + + /* + * Gets whether the service level objective is a system service objective. + */ + @JsonProperty(value = "isSystem", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isSystem; + + /* + * The description for the service level objective. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Gets whether the service level objective is enabled. + */ + @JsonProperty(value = "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/SqlAgentConfigurationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlAgentConfigurationInner.java new file mode 100644 index 0000000000000..32bb792a8f57c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlAgentConfigurationInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SqlAgentConfigurationPropertiesState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A recoverable managed database resource. */ +@Fluent +public final class SqlAgentConfigurationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SqlAgentConfigurationProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SqlAgentConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: The state of Sql Agent. + * + * @return the state value. + */ + public SqlAgentConfigurationPropertiesState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: The state of Sql Agent. + * + * @param state the state value to set. + * @return the SqlAgentConfigurationInner object itself. + */ + public SqlAgentConfigurationInner withState(SqlAgentConfigurationPropertiesState state) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlAgentConfigurationProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlAgentConfigurationProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlAgentConfigurationProperties.java new file mode 100644 index 0000000000000..529d83be7b6a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlAgentConfigurationProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.SqlAgentConfigurationPropertiesState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Sql agent configuration properties. */ +@Fluent +public final class SqlAgentConfigurationProperties { + /* + * The state of Sql Agent. + */ + @JsonProperty(value = "state") + private SqlAgentConfigurationPropertiesState state; + + /** + * Get the state property: The state of Sql Agent. + * + * @return the state value. + */ + public SqlAgentConfigurationPropertiesState state() { + return this.state; + } + + /** + * Set the state property: The state of Sql Agent. + * + * @param state the state value to set. + * @return the SqlAgentConfigurationProperties object itself. + */ + public SqlAgentConfigurationProperties withState(SqlAgentConfigurationPropertiesState state) { + this.state = state; + 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/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..d82432ec0844b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Usage Metric of a Subscription in a Location. */ +@Fluent +public final class SubscriptionUsageInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SubscriptionUsageProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SubscriptionUsageProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the displayName property: User-readable name of the metric. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Get the currentValue property: Current value of the metric. + * + * @return the currentValue value. + */ + public Double currentValue() { + return this.innerProperties() == null ? null : this.innerProperties().currentValue(); + } + + /** + * Get the limit property: Boundary value of the metric. + * + * @return the limit value. + */ + public Double limit() { + return this.innerProperties() == null ? null : this.innerProperties().limit(); + } + + /** + * Get the unit property: Unit of the metric. + * + * @return the unit value. + */ + public String unit() { + return this.innerProperties() == null ? null : this.innerProperties().unit(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageProperties.java new file mode 100644 index 0000000000000..ec0cd885ba9e7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageProperties.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.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a subscription usage. */ +@Immutable +public final class SubscriptionUsageProperties { + /* + * User-readable name of the metric. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * Current value of the metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /* + * Boundary value of the metric. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /* + * Unit of the metric. + */ + @JsonProperty(value = "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..970763735b44a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentInner.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.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SyncAgentState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An Azure SQL Database sync agent. */ +@Fluent +public final class SyncAgentInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SyncAgentProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SyncAgentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the name property: Name of the sync agent. + * + * @return the name value. + */ + public String namePropertiesName() { + return this.innerProperties() == null ? null : this.innerProperties().name(); + } + + /** + * Get the syncDatabaseId property: ARM resource id of the sync database in the sync agent. + * + * @return the syncDatabaseId value. + */ + public String syncDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncAgentProperties(); + } + this.innerProperties().withSyncDatabaseId(syncDatabaseId); + return this; + } + + /** + * Get the lastAliveTime property: Last alive time of the sync agent. + * + * @return the lastAliveTime value. + */ + public OffsetDateTime lastAliveTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastAliveTime(); + } + + /** + * Get the state property: State of the sync agent. + * + * @return the state value. + */ + public SyncAgentState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the isUpToDate property: If the sync agent version is up to date. + * + * @return the isUpToDate value. + */ + public Boolean isUpToDate() { + return this.innerProperties() == null ? null : this.innerProperties().isUpToDate(); + } + + /** + * Get the expiryTime property: Expiration time of the sync agent version. + * + * @return the expiryTime value. + */ + public OffsetDateTime expiryTime() { + return this.innerProperties() == null ? null : this.innerProperties().expiryTime(); + } + + /** + * Get the version property: Version of the sync agent. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().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..b9199a5b02a8e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentKeyPropertiesInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an Azure SQL Database sync agent key. */ +@Immutable +public final class SyncAgentKeyPropertiesInner { + /* + * 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..7036ca186f7bb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure SQL Database sync agent linked database. */ +@Fluent +public final class SyncAgentLinkedDatabaseInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SyncAgentLinkedDatabaseProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SyncAgentLinkedDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the databaseType property: Type of the sync agent linked database. + * + * @return the databaseType value. + */ + public SyncMemberDbType databaseType() { + return this.innerProperties() == null ? null : this.innerProperties().databaseType(); + } + + /** + * Get the databaseId property: Id of the sync agent linked database. + * + * @return the databaseId value. + */ + public String databaseId() { + return this.innerProperties() == null ? null : this.innerProperties().databaseId(); + } + + /** + * Get the description property: Description of the sync agent linked database. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the serverName property: Server name of the sync agent linked database. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the databaseName property: Database name of the sync agent linked database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the username property: User name of the sync agent linked database. + * + * @return the username value. + */ + public String username() { + return this.innerProperties() == null ? null : this.innerProperties().username(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseProperties.java new file mode 100644 index 0000000000000..4eb1c08cfd9bc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseProperties.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an Azure SQL Database sync agent linked database. */ +@Immutable +public final class SyncAgentLinkedDatabaseProperties { + /* + * Type of the sync agent linked database. + */ + @JsonProperty(value = "databaseType", access = JsonProperty.Access.WRITE_ONLY) + private SyncMemberDbType databaseType; + + /* + * Id of the sync agent linked database. + */ + @JsonProperty(value = "databaseId", access = JsonProperty.Access.WRITE_ONLY) + private String databaseId; + + /* + * Description of the sync agent linked database. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Server name of the sync agent linked database. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * Database name of the sync agent linked database. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * User name of the sync agent linked database. + */ + @JsonProperty(value = "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/SyncAgentProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentProperties.java new file mode 100644 index 0000000000000..260a2e4a9e548 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.SyncAgentState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of an Azure SQL Database sync agent. */ +@Fluent +public final class SyncAgentProperties { + /* + * Name of the sync agent. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * ARM resource id of the sync database in the sync agent. + */ + @JsonProperty(value = "syncDatabaseId") + private String syncDatabaseId; + + /* + * Last alive time of the sync agent. + */ + @JsonProperty(value = "lastAliveTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastAliveTime; + + /* + * State of the sync agent. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private SyncAgentState state; + + /* + * If the sync agent version is up to date. + */ + @JsonProperty(value = "isUpToDate", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUpToDate; + + /* + * Expiration time of the sync agent version. + */ + @JsonProperty(value = "expiryTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime expiryTime; + + /* + * Version of the sync agent. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * Get the name property: Name of the sync agent. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * 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 SyncAgentProperties object itself. + */ + public SyncAgentProperties 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/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..bd5a8009d4995 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncDatabaseIdPropertiesInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the sync database id. */ +@Immutable +public final class SyncDatabaseIdPropertiesInner { + /* + * 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..3c4c694a66a14 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncFullSchemaPropertiesInner.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.Immutable; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaTable; +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 { + /* + * 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..6d59f6acb5888 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupInner.java @@ -0,0 +1,308 @@ +// Copyright (c) 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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.Sku; +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.JsonProperty; +import java.time.OffsetDateTime; + +/** An Azure SQL Database sync group. */ +@Fluent +public final class SyncGroupInner extends ProxyResource { + /* + * The name and capacity of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SyncGroupProperties innerProperties; + + /** + * Get the sku property: The name and capacity of the SKU. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The name and capacity of the SKU. + * + * @param sku the sku value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SyncGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the interval property: Sync interval of the sync group. + * + * @return the interval value. + */ + public Integer interval() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withInterval(interval); + return this; + } + + /** + * Get the lastSyncTime property: Last sync time of the sync group. + * + * @return the lastSyncTime value. + */ + public OffsetDateTime lastSyncTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastSyncTime(); + } + + /** + * Get the conflictResolutionPolicy property: Conflict resolution policy of the sync group. + * + * @return the conflictResolutionPolicy value. + */ + public SyncConflictResolutionPolicy conflictResolutionPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withConflictResolutionPolicy(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withSyncDatabaseId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withHubDatabaseUsername(hubDatabaseUsername); + return this; + } + + /** + * Get the hubDatabasePassword property: Password for the sync group hub database credential. + * + * @return the hubDatabasePassword value. + */ + public String hubDatabasePassword() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withHubDatabasePassword(hubDatabasePassword); + return this; + } + + /** + * Get the syncState property: Sync state of the sync group. + * + * @return the syncState value. + */ + public SyncGroupState syncState() { + return this.innerProperties() == null ? null : this.innerProperties().syncState(); + } + + /** + * Get the schema property: Sync schema of the sync group. + * + * @return the schema value. + */ + public SyncGroupSchema schema() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withSchema(schema); + return this; + } + + /** + * Get the enableConflictLogging property: If conflict logging is enabled. + * + * @return the enableConflictLogging value. + */ + public Boolean enableConflictLogging() { + return this.innerProperties() == null ? null : this.innerProperties().enableConflictLogging(); + } + + /** + * Set the enableConflictLogging property: If conflict logging is enabled. + * + * @param enableConflictLogging the enableConflictLogging value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withEnableConflictLogging(Boolean enableConflictLogging) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withEnableConflictLogging(enableConflictLogging); + return this; + } + + /** + * Get the conflictLoggingRetentionInDays property: Conflict logging retention period. + * + * @return the conflictLoggingRetentionInDays value. + */ + public Integer conflictLoggingRetentionInDays() { + return this.innerProperties() == null ? null : this.innerProperties().conflictLoggingRetentionInDays(); + } + + /** + * Set the conflictLoggingRetentionInDays property: Conflict logging retention period. + * + * @param conflictLoggingRetentionInDays the conflictLoggingRetentionInDays value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withConflictLoggingRetentionInDays(Integer conflictLoggingRetentionInDays) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withConflictLoggingRetentionInDays(conflictLoggingRetentionInDays); + return this; + } + + /** + * Get the usePrivateLinkConnection property: If use private link connection is enabled. + * + * @return the usePrivateLinkConnection value. + */ + public Boolean usePrivateLinkConnection() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withUsePrivateLinkConnection(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.innerProperties() == null ? null : this.innerProperties().privateEndpointName(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().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..973a9da92efd5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupLogPropertiesInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.SyncGroupLogType; +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 { + /* + * 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/SyncGroupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupProperties.java new file mode 100644 index 0000000000000..a2abf6e35736d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupProperties.java @@ -0,0 +1,308 @@ +// Copyright (c) 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.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.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of a sync group. */ +@Fluent +public final class SyncGroupProperties { + /* + * Sync interval of the sync group. + */ + @JsonProperty(value = "interval") + private Integer interval; + + /* + * Last sync time of the sync group. + */ + @JsonProperty(value = "lastSyncTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastSyncTime; + + /* + * Conflict resolution policy of the sync group. + */ + @JsonProperty(value = "conflictResolutionPolicy") + private SyncConflictResolutionPolicy conflictResolutionPolicy; + + /* + * ARM resource id of the sync database in the sync group. + */ + @JsonProperty(value = "syncDatabaseId") + private String syncDatabaseId; + + /* + * User name for the sync group hub database credential. + */ + @JsonProperty(value = "hubDatabaseUserName") + private String hubDatabaseUsername; + + /* + * Password for the sync group hub database credential. + */ + @JsonProperty(value = "hubDatabasePassword") + private String hubDatabasePassword; + + /* + * Sync state of the sync group. + */ + @JsonProperty(value = "syncState", access = JsonProperty.Access.WRITE_ONLY) + private SyncGroupState syncState; + + /* + * Sync schema of the sync group. + */ + @JsonProperty(value = "schema") + private SyncGroupSchema schema; + + /* + * If conflict logging is enabled. + */ + @JsonProperty(value = "enableConflictLogging") + private Boolean enableConflictLogging; + + /* + * Conflict logging retention period. + */ + @JsonProperty(value = "conflictLoggingRetentionInDays") + private Integer conflictLoggingRetentionInDays; + + /* + * If use private link connection is enabled. + */ + @JsonProperty(value = "usePrivateLinkConnection") + private Boolean usePrivateLinkConnection; + + /* + * Private endpoint name of the sync group if use private link connection + * is enabled. + */ + @JsonProperty(value = "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 SyncGroupProperties object itself. + */ + public SyncGroupProperties 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 SyncGroupProperties object itself. + */ + public SyncGroupProperties 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 SyncGroupProperties object itself. + */ + public SyncGroupProperties 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 SyncGroupProperties object itself. + */ + public SyncGroupProperties 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 SyncGroupProperties object itself. + */ + public SyncGroupProperties 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 SyncGroupProperties object itself. + */ + public SyncGroupProperties withSchema(SyncGroupSchema schema) { + this.schema = schema; + return this; + } + + /** + * Get the enableConflictLogging property: If conflict logging is enabled. + * + * @return the enableConflictLogging value. + */ + public Boolean enableConflictLogging() { + return this.enableConflictLogging; + } + + /** + * Set the enableConflictLogging property: If conflict logging is enabled. + * + * @param enableConflictLogging the enableConflictLogging value to set. + * @return the SyncGroupProperties object itself. + */ + public SyncGroupProperties withEnableConflictLogging(Boolean enableConflictLogging) { + this.enableConflictLogging = enableConflictLogging; + return this; + } + + /** + * Get the conflictLoggingRetentionInDays property: Conflict logging retention period. + * + * @return the conflictLoggingRetentionInDays value. + */ + public Integer conflictLoggingRetentionInDays() { + return this.conflictLoggingRetentionInDays; + } + + /** + * Set the conflictLoggingRetentionInDays property: Conflict logging retention period. + * + * @param conflictLoggingRetentionInDays the conflictLoggingRetentionInDays value to set. + * @return the SyncGroupProperties object itself. + */ + public SyncGroupProperties withConflictLoggingRetentionInDays(Integer conflictLoggingRetentionInDays) { + this.conflictLoggingRetentionInDays = conflictLoggingRetentionInDays; + 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 SyncGroupProperties object itself. + */ + public SyncGroupProperties 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/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..994128171bddd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberInner.java @@ -0,0 +1,294 @@ +// Copyright (c) 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.management.ProxyResource; +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.JsonProperty; +import java.util.UUID; + +/** An Azure SQL Database sync member. */ +@Fluent +public final class SyncMemberInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SyncMemberProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SyncMemberProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the databaseType property: Database type of the sync member. + * + * @return the databaseType value. + */ + public SyncMemberDbType databaseType() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withDatabaseType(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withSyncAgentId(syncAgentId); + return this; + } + + /** + * Get the sqlServerDatabaseId property: SQL Server database id of the sync member. + * + * @return the sqlServerDatabaseId value. + */ + public UUID sqlServerDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withSqlServerDatabaseId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withSyncMemberAzureDatabaseResourceId(syncMemberAzureDatabaseResourceId); + return this; + } + + /** + * Get the usePrivateLinkConnection property: Whether to use private link connection. + * + * @return the usePrivateLinkConnection value. + */ + public Boolean usePrivateLinkConnection() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withUsePrivateLinkConnection(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.innerProperties() == null ? null : this.innerProperties().privateEndpointName(); + } + + /** + * Get the serverName property: Server name of the member database in the sync member. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withServerName(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withDatabaseName(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withUsername(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withPassword(password); + return this; + } + + /** + * Get the syncDirection property: Sync direction of the sync member. + * + * @return the syncDirection value. + */ + public SyncDirection syncDirection() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withSyncDirection(syncDirection); + return this; + } + + /** + * Get the syncState property: Sync state of the sync member. + * + * @return the syncState value. + */ + public SyncMemberState syncState() { + return this.innerProperties() == null ? null : this.innerProperties().syncState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberProperties.java new file mode 100644 index 0000000000000..d9b53976f9b88 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +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.JsonProperty; +import java.util.UUID; + +/** Properties of a sync member. */ +@Fluent +public final class SyncMemberProperties { + /* + * Database type of the sync member. + */ + @JsonProperty(value = "databaseType") + private SyncMemberDbType databaseType; + + /* + * ARM resource id of the sync agent in the sync member. + */ + @JsonProperty(value = "syncAgentId") + private String syncAgentId; + + /* + * SQL Server database id of the sync member. + */ + @JsonProperty(value = "sqlServerDatabaseId") + private UUID sqlServerDatabaseId; + + /* + * ARM resource id of the sync member logical database, for sync members in + * Azure. + */ + @JsonProperty(value = "syncMemberAzureDatabaseResourceId") + private String syncMemberAzureDatabaseResourceId; + + /* + * Whether to use private link connection. + */ + @JsonProperty(value = "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 = "privateEndpointName", access = JsonProperty.Access.WRITE_ONLY) + private String privateEndpointName; + + /* + * Server name of the member database in the sync member + */ + @JsonProperty(value = "serverName") + private String serverName; + + /* + * Database name of the member database in the sync member. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /* + * User name of the member database in the sync member. + */ + @JsonProperty(value = "userName") + private String username; + + /* + * Password of the member database in the sync member. + */ + @JsonProperty(value = "password") + private String password; + + /* + * Sync direction of the sync member. + */ + @JsonProperty(value = "syncDirection") + private SyncDirection syncDirection; + + /* + * Sync state of the sync member. + */ + @JsonProperty(value = "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 SyncMemberProperties object itself. + */ + public SyncMemberProperties 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 SyncMemberProperties object itself. + */ + public SyncMemberProperties 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 SyncMemberProperties object itself. + */ + public SyncMemberProperties 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 SyncMemberProperties object itself. + */ + public SyncMemberProperties 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 SyncMemberProperties object itself. + */ + public SyncMemberProperties 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 SyncMemberProperties object itself. + */ + public SyncMemberProperties 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 SyncMemberProperties object itself. + */ + public SyncMemberProperties 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 SyncMemberProperties object itself. + */ + public SyncMemberProperties 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 SyncMemberProperties object itself. + */ + public SyncMemberProperties 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 SyncMemberProperties object itself. + */ + public SyncMemberProperties 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/TdeCertificateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TdeCertificateProperties.java new file mode 100644 index 0000000000000..fc81ddeb20c8d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TdeCertificateProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a TDE certificate. */ +@Fluent +public final class TdeCertificateProperties { + /* + * The base64 encoded certificate private blob. + */ + @JsonProperty(value = "privateBlob", required = true) + private String privateBlob; + + /* + * The certificate password. + */ + @JsonProperty(value = "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 TdeCertificateProperties object itself. + */ + public TdeCertificateProperties 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 TdeCertificateProperties object itself. + */ + public TdeCertificateProperties withCertPassword(String certPassword) { + this.certPassword = certPassword; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateBlob() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property privateBlob in model TdeCertificateProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TdeCertificateProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TimeZoneInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TimeZoneInner.java new file mode 100644 index 0000000000000..bc426ccb0fc53 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TimeZoneInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Time Zone. */ +@Fluent +public final class TimeZoneInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private TimeZoneProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private TimeZoneProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the timeZoneId property: The time zone id. + * + * @return the timeZoneId value. + */ + public String timeZoneId() { + return this.innerProperties() == null ? null : this.innerProperties().timeZoneId(); + } + + /** + * Get the displayName property: The time zone display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TimeZoneProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TimeZoneProperties.java new file mode 100644 index 0000000000000..52e60f2a70a55 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TimeZoneProperties.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a time zone. */ +@Immutable +public final class TimeZoneProperties { + /* + * The time zone id + */ + @JsonProperty(value = "timeZoneId", access = JsonProperty.Access.WRITE_ONLY) + private String timeZoneId; + + /* + * The time zone display name + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * Get the timeZoneId property: The time zone id. + * + * @return the timeZoneId value. + */ + public String timeZoneId() { + return this.timeZoneId; + } + + /** + * Get the displayName property: The time zone display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * 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..62361548eb0c5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TopQueriesInner.java @@ -0,0 +1,141 @@ +// Copyright (c) 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.resourcemanager.sql.generated.models.QueryTimeGrainType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The TopQueries model. */ +@Fluent +public final class TopQueriesInner { + /* + * 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/TransparentDataEncryptionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TransparentDataEncryptionProperties.java new file mode 100644 index 0000000000000..b78861b65e831 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TransparentDataEncryptionProperties.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.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a transparent data encryption. */ +@Fluent +public final class TransparentDataEncryptionProperties { + /* + * Specifies the state of the transparent data encryption. + */ + @JsonProperty(value = "state", required = true) + private TransparentDataEncryptionState state; + + /** + * Get the state property: Specifies the state of the transparent data encryption. + * + * @return the state value. + */ + public TransparentDataEncryptionState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the transparent data encryption. + * + * @param state the state value to set. + * @return the TransparentDataEncryptionProperties object itself. + */ + public TransparentDataEncryptionProperties withState(TransparentDataEncryptionState state) { + this.state = state; + return this; + } + + /** + * 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 TransparentDataEncryptionProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TransparentDataEncryptionProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UpdateLongTermRetentionBackupParametersProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UpdateLongTermRetentionBackupParametersProperties.java new file mode 100644 index 0000000000000..cc4903335b130 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UpdateLongTermRetentionBackupParametersProperties.java @@ -0,0 +1,48 @@ +// Copyright (c) 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.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the properties to perform long term retention backup copy operation. */ +@Fluent +public final class UpdateLongTermRetentionBackupParametersProperties { + /* + * The storage redundancy type of the copied backup + */ + @JsonProperty(value = "requestedBackupStorageRedundancy") + private BackupStorageRedundancy requestedBackupStorageRedundancy; + + /** + * Get the requestedBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy 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 UpdateLongTermRetentionBackupParametersProperties object itself. + */ + public UpdateLongTermRetentionBackupParametersProperties 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/UpdateManagedInstanceDnsServersOperationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UpdateManagedInstanceDnsServersOperationInner.java new file mode 100644 index 0000000000000..b33da03a97c21 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UpdateManagedInstanceDnsServersOperationInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.DnsRefreshConfigurationPropertiesStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A recoverable managed database resource. */ +@Fluent +public final class UpdateManagedInstanceDnsServersOperationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DnsRefreshConfigurationProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DnsRefreshConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the status property: The status of the DNS refresh operation. + * + * @return the status value. + */ + public DnsRefreshConfigurationPropertiesStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().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..657efa5e32c57 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UsageInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.Name; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** ARM usage. */ +@Immutable +public final class UsageInner { + /* + * 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..3efda6c06ea90 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An Azure SQL virtual cluster. */ +@Fluent +public final class VirtualClusterInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private VirtualClusterProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VirtualClusterProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public VirtualClusterInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualClusterInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the subnetId property: Subnet resource ID for the virtual cluster. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualClusterProperties(); + } + this.innerProperties().withFamily(family); + return this; + } + + /** + * Get the childResources property: List of resources in this virtual cluster. + * + * @return the childResources value. + */ + public List childResources() { + return this.innerProperties() == null ? null : this.innerProperties().childResources(); + } + + /** + * Get the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this virtual + * cluster. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceConfigurationId(); + } + + /** + * Set the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this virtual + * cluster. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the VirtualClusterInner object itself. + */ + public VirtualClusterInner withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualClusterProperties(); + } + this.innerProperties().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterProperties.java new file mode 100644 index 0000000000000..0c6564b9ba6b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties of a virtual cluster. */ +@Fluent +public final class VirtualClusterProperties { + /* + * Subnet resource ID for the virtual cluster. + */ + @JsonProperty(value = "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 = "family") + private String family; + + /* + * List of resources in this virtual cluster. + */ + @JsonProperty(value = "childResources", access = JsonProperty.Access.WRITE_ONLY) + private List childResources; + + /* + * Specifies maintenance configuration id to apply to this virtual cluster. + */ + @JsonProperty(value = "maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /** + * 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 VirtualClusterProperties object itself. + */ + public VirtualClusterProperties 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; + } + + /** + * Get the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this virtual + * cluster. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this virtual + * cluster. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the VirtualClusterProperties object itself. + */ + public VirtualClusterProperties withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + 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..4bb54b8226350 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRuleState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A virtual network rule. */ +@Fluent +public final class VirtualNetworkRuleInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private VirtualNetworkRuleProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VirtualNetworkRuleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value. + */ + public String virtualNetworkSubnetId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualNetworkRuleProperties(); + } + this.innerProperties().withVirtualNetworkSubnetId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualNetworkRuleProperties(); + } + this.innerProperties().withIgnoreMissingVnetServiceEndpoint(ignoreMissingVnetServiceEndpoint); + return this; + } + + /** + * Get the state property: Virtual Network Rule State. + * + * @return the state value. + */ + public VirtualNetworkRuleState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleProperties.java new file mode 100644 index 0000000000000..db5b4eac47d24 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRuleState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a virtual network rule. */ +@Fluent +public final class VirtualNetworkRuleProperties { + /* + * The ARM resource id of the virtual network subnet. + */ + @JsonProperty(value = "virtualNetworkSubnetId", required = true) + private String virtualNetworkSubnetId; + + /* + * Create firewall rule before the virtual network has vnet service + * endpoint enabled. + */ + @JsonProperty(value = "ignoreMissingVnetServiceEndpoint") + private Boolean ignoreMissingVnetServiceEndpoint; + + /* + * Virtual Network Rule State + */ + @JsonProperty(value = "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 VirtualNetworkRuleProperties object itself. + */ + public VirtualNetworkRuleProperties 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 VirtualNetworkRuleProperties object itself. + */ + public VirtualNetworkRuleProperties 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() { + if (virtualNetworkSubnetId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property virtualNetworkSubnetId in model VirtualNetworkRuleProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworkRuleProperties.class); +} 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..39357c95cc894 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordInner.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.management.ProxyResource; +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.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A vulnerability assessment scan record. */ +@Fluent +public final class VulnerabilityAssessmentScanRecordInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private VulnerabilityAssessmentScanRecordProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VulnerabilityAssessmentScanRecordProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the scanId property: The scan ID. + * + * @return the scanId value. + */ + public String scanId() { + return this.innerProperties() == null ? null : this.innerProperties().scanId(); + } + + /** + * Get the triggerType property: The scan trigger type. + * + * @return the triggerType value. + */ + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.innerProperties() == null ? null : this.innerProperties().triggerType(); + } + + /** + * Get the state property: The scan status. + * + * @return the state value. + */ + public VulnerabilityAssessmentScanState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the startTime property: The scan start time (UTC). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the endTime property: The scan end time (UTC). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Get the errors property: The scan errors. + * + * @return the errors value. + */ + public List errors() { + return this.innerProperties() == null ? null : this.innerProperties().errors(); + } + + /** + * Get the storageContainerPath property: The scan results storage container path. + * + * @return the storageContainerPath value. + */ + public String storageContainerPath() { + return this.innerProperties() == null ? null : this.innerProperties().storageContainerPath(); + } + + /** + * Get the numberOfFailedSecurityChecks property: The number of failed security checks. + * + * @return the numberOfFailedSecurityChecks value. + */ + public Integer numberOfFailedSecurityChecks() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfFailedSecurityChecks(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordProperties.java new file mode 100644 index 0000000000000..de7c3a07e0e1d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordProperties.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.Immutable; +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.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of a vulnerability assessment scan record. */ +@Immutable +public final class VulnerabilityAssessmentScanRecordProperties { + /* + * The scan ID. + */ + @JsonProperty(value = "scanId", access = JsonProperty.Access.WRITE_ONLY) + private String scanId; + + /* + * The scan trigger type. + */ + @JsonProperty(value = "triggerType", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanTriggerType triggerType; + + /* + * The scan status. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanState state; + + /* + * The scan start time (UTC). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The scan end time (UTC). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The scan errors. + */ + @JsonProperty(value = "errors", access = JsonProperty.Access.WRITE_ONLY) + private List errors; + + /* + * The scan results storage container path. + */ + @JsonProperty(value = "storageContainerPath", access = JsonProperty.Access.WRITE_ONLY) + private String storageContainerPath; + + /* + * The number of failed security checks. + */ + @JsonProperty(value = "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..82887b8c8d8bd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Workload classifier operations for a data warehouse. */ +@Fluent +public final class WorkloadClassifierInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private WorkloadClassifierProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private WorkloadClassifierProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the memberName property: The workload classifier member name. + * + * @return the memberName value. + */ + public String memberName() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadClassifierProperties(); + } + this.innerProperties().withMemberName(memberName); + return this; + } + + /** + * Get the label property: The workload classifier label. + * + * @return the label value. + */ + public String label() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadClassifierProperties(); + } + this.innerProperties().withLabel(label); + return this; + } + + /** + * Get the context property: The workload classifier context. + * + * @return the context value. + */ + public String context() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadClassifierProperties(); + } + this.innerProperties().withContext(context); + return this; + } + + /** + * Get the startTime property: The workload classifier start time for classification. + * + * @return the startTime value. + */ + public String startTime() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadClassifierProperties(); + } + this.innerProperties().withStartTime(startTime); + return this; + } + + /** + * Get the endTime property: The workload classifier end time for classification. + * + * @return the endTime value. + */ + public String endTime() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadClassifierProperties(); + } + this.innerProperties().withEndTime(endTime); + return this; + } + + /** + * Get the importance property: The workload classifier importance. + * + * @return the importance value. + */ + public String importance() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadClassifierProperties(); + } + this.innerProperties().withImportance(importance); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierProperties.java new file mode 100644 index 0000000000000..febfaed9f5bd9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Workload classifier definition. For more information look at sys.workload_management_workload_classifiers (DMV). */ +@Fluent +public final class WorkloadClassifierProperties { + /* + * The workload classifier member name. + */ + @JsonProperty(value = "memberName", required = true) + private String memberName; + + /* + * The workload classifier label. + */ + @JsonProperty(value = "label") + private String label; + + /* + * The workload classifier context. + */ + @JsonProperty(value = "context") + private String context; + + /* + * The workload classifier start time for classification. + */ + @JsonProperty(value = "startTime") + private String startTime; + + /* + * The workload classifier end time for classification. + */ + @JsonProperty(value = "endTime") + private String endTime; + + /* + * The workload classifier importance. + */ + @JsonProperty(value = "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 WorkloadClassifierProperties object itself. + */ + public WorkloadClassifierProperties 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 WorkloadClassifierProperties object itself. + */ + public WorkloadClassifierProperties 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 WorkloadClassifierProperties object itself. + */ + public WorkloadClassifierProperties 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 WorkloadClassifierProperties object itself. + */ + public WorkloadClassifierProperties 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 WorkloadClassifierProperties object itself. + */ + public WorkloadClassifierProperties 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 WorkloadClassifierProperties object itself. + */ + public WorkloadClassifierProperties withImportance(String importance) { + this.importance = importance; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (memberName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property memberName in model WorkloadClassifierProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkloadClassifierProperties.class); +} 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..6a6dd86b48159 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Workload group operations for a data warehouse. */ +@Fluent +public final class WorkloadGroupInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private WorkloadGroupProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private WorkloadGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the minResourcePercent property: The workload group minimum percentage resource. + * + * @return the minResourcePercent value. + */ + public Integer minResourcePercent() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadGroupProperties(); + } + this.innerProperties().withMinResourcePercent(minResourcePercent); + return this; + } + + /** + * Get the maxResourcePercent property: The workload group cap percentage resource. + * + * @return the maxResourcePercent value. + */ + public Integer maxResourcePercent() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadGroupProperties(); + } + this.innerProperties().withMaxResourcePercent(maxResourcePercent); + return this; + } + + /** + * Get the minResourcePercentPerRequest property: The workload group request minimum grant percentage. + * + * @return the minResourcePercentPerRequest value. + */ + public Double minResourcePercentPerRequest() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadGroupProperties(); + } + this.innerProperties().withMinResourcePercentPerRequest(minResourcePercentPerRequest); + return this; + } + + /** + * Get the maxResourcePercentPerRequest property: The workload group request maximum grant percentage. + * + * @return the maxResourcePercentPerRequest value. + */ + public Double maxResourcePercentPerRequest() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadGroupProperties(); + } + this.innerProperties().withMaxResourcePercentPerRequest(maxResourcePercentPerRequest); + return this; + } + + /** + * Get the importance property: The workload group importance level. + * + * @return the importance value. + */ + public String importance() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadGroupProperties(); + } + this.innerProperties().withImportance(importance); + return this; + } + + /** + * Get the queryExecutionTimeout property: The workload group query execution timeout. + * + * @return the queryExecutionTimeout value. + */ + public Integer queryExecutionTimeout() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadGroupProperties(); + } + this.innerProperties().withQueryExecutionTimeout(queryExecutionTimeout); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupProperties.java new file mode 100644 index 0000000000000..3b9d4598eb898 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupProperties.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.fasterxml.jackson.annotation.JsonProperty; + +/** Workload group definition. For more information look at sys.workload_management_workload_groups (DMV). */ +@Fluent +public final class WorkloadGroupProperties { + /* + * The workload group minimum percentage resource. + */ + @JsonProperty(value = "minResourcePercent", required = true) + private int minResourcePercent; + + /* + * The workload group cap percentage resource. + */ + @JsonProperty(value = "maxResourcePercent", required = true) + private int maxResourcePercent; + + /* + * The workload group request minimum grant percentage. + */ + @JsonProperty(value = "minResourcePercentPerRequest", required = true) + private double minResourcePercentPerRequest; + + /* + * The workload group request maximum grant percentage. + */ + @JsonProperty(value = "maxResourcePercentPerRequest") + private Double maxResourcePercentPerRequest; + + /* + * The workload group importance level. + */ + @JsonProperty(value = "importance") + private String importance; + + /* + * The workload group query execution timeout. + */ + @JsonProperty(value = "queryExecutionTimeout") + private Integer queryExecutionTimeout; + + /** + * Get the minResourcePercent property: The workload group minimum percentage resource. + * + * @return the minResourcePercent value. + */ + public int minResourcePercent() { + return this.minResourcePercent; + } + + /** + * Set the minResourcePercent property: The workload group minimum percentage resource. + * + * @param minResourcePercent the minResourcePercent value to set. + * @return the WorkloadGroupProperties object itself. + */ + public WorkloadGroupProperties withMinResourcePercent(int minResourcePercent) { + this.minResourcePercent = minResourcePercent; + return this; + } + + /** + * Get the maxResourcePercent property: The workload group cap percentage resource. + * + * @return the maxResourcePercent value. + */ + public int maxResourcePercent() { + return this.maxResourcePercent; + } + + /** + * Set the maxResourcePercent property: The workload group cap percentage resource. + * + * @param maxResourcePercent the maxResourcePercent value to set. + * @return the WorkloadGroupProperties object itself. + */ + public WorkloadGroupProperties withMaxResourcePercent(int 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 WorkloadGroupProperties object itself. + */ + public WorkloadGroupProperties 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 WorkloadGroupProperties object itself. + */ + public WorkloadGroupProperties 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 WorkloadGroupProperties object itself. + */ + public WorkloadGroupProperties 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 WorkloadGroupProperties object itself. + */ + public WorkloadGroupProperties 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/AdvisorImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/AdvisorImpl.java new file mode 100644 index 0000000000000..a24ba78f2aefe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/AdvisorImpl.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.AdvisorInner; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import com.azure.resourcemanager.sql.generated.models.Advisor; +import com.azure.resourcemanager.sql.generated.models.AdvisorStatus; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatus; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatusInheritedFrom; +import com.azure.resourcemanager.sql.generated.models.RecommendedAction; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class AdvisorImpl implements Advisor { + private AdvisorInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + AdvisorImpl(AdvisorInner 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 kind() { + return this.innerModel().kind(); + } + + public String location() { + return this.innerModel().location(); + } + + public AdvisorStatus advisorStatus() { + return this.innerModel().advisorStatus(); + } + + public AutoExecuteStatus autoExecuteStatus() { + return this.innerModel().autoExecuteStatus(); + } + + public AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom() { + return this.innerModel().autoExecuteStatusInheritedFrom(); + } + + public String recommendationsStatus() { + return this.innerModel().recommendationsStatus(); + } + + public OffsetDateTime lastChecked() { + return this.innerModel().lastChecked(); + } + + public List recommendedActions() { + List inner = this.innerModel().recommendedActions(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new RecommendedActionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public AdvisorInner 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/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..a53d3f8bab6f8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesClientImpl.java @@ -0,0 +1,1367 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-02-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-02-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-02-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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-02-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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..8fa987333b29b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesImpl.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.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; + +public final class BackupShortTermRetentionPoliciesImpl implements BackupShortTermRetentionPolicies { + private static 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..948e046c9c5f1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPolicyImpl.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.BackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.DiffBackupIntervalInHours; +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 DiffBackupIntervalInHours diffBackupIntervalInHours() { + return this.innerModel().diffBackupIntervalInHours(); + } + + 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; + } + + public BackupShortTermRetentionPolicyImpl withDiffBackupIntervalInHours( + DiffBackupIntervalInHours diffBackupIntervalInHours) { + this.innerModel().withDiffBackupIntervalInHours(diffBackupIntervalInHours); + 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..687a4776e70b5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesClientImpl.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.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.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 { + /** 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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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-11-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 along with {@link Response} on + * successful completion of {@link Mono}. + */ + @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-11-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 on successful completion of {@link + * Mono}. + */ + @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 on successful completion of {@link + * Mono}. + */ + @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 along with {@link Response}. + */ + @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..8defbf55b6a16 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesImpl.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.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; + +public final class CapabilitiesImpl implements Capabilities { + private static 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..0f91bf339126b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesClientImpl.java @@ -0,0 +1,467 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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..2dda8132afa13 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesImpl.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.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; + +public final class DataMaskingPoliciesImpl implements DataMaskingPolicies { + private static 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..e5a239d2f2706 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesClientImpl.java @@ -0,0 +1,530 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..3073431427558 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesImpl.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.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; + +public final class DataMaskingRulesImpl implements DataMaskingRules { + private static 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/DataWarehouseUserActivitiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesImpl.java new file mode 100644 index 0000000000000..0bac66cffb3e4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesImpl.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.DataWarehouseUserActivitiesInner; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivities; + +public final class DataWarehouseUserActivitiesImpl implements DataWarehouseUserActivities { + private DataWarehouseUserActivitiesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DataWarehouseUserActivitiesImpl( + DataWarehouseUserActivitiesInner 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 activeQueriesCount() { + return this.innerModel().activeQueriesCount(); + } + + public DataWarehouseUserActivitiesInner 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/DataWarehouseUserActivitiesOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesOperationsClientImpl.java new file mode 100644 index 0000000000000..03af1ef1f507f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesOperationsClientImpl.java @@ -0,0 +1,603 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.DataWarehouseUserActivitiesOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DataWarehouseUserActivitiesInner; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivitiesListResult; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivityName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * DataWarehouseUserActivitiesOperationsClient. + */ +public final class DataWarehouseUserActivitiesOperationsClientImpl + implements DataWarehouseUserActivitiesOperationsClient { + /** The proxy service used to perform REST calls. */ + private final DataWarehouseUserActivitiesOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DataWarehouseUserActivitiesOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataWarehouseUserActivitiesOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DataWarehouseUserActivitiesOperationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDataWarehouseUserActivitiesOperations to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DataWarehouseUserActivitiesOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("dataWarehouseUserActivityName") DataWarehouseUserActivityName dataWarehouseUserActivityName, + @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}/dataWarehouseUserActivities") + @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 user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataWarehouseUserActivityName The activity name of the data warehouse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (dataWarehouseUserActivityName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter dataWarehouseUserActivityName is required and cannot be 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, + dataWarehouseUserActivityName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataWarehouseUserActivityName The activity name of the data warehouse. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (dataWarehouseUserActivityName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter dataWarehouseUserActivityName is required and cannot be 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, + dataWarehouseUserActivityName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataWarehouseUserActivityName The activity name of the data warehouse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataWarehouseUserActivityName The activity name of the data warehouse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataWarehouseUserActivitiesInner get( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName) { + return getAsync(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName).block(); + } + + /** + * Gets the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataWarehouseUserActivityName The activity name of the data warehouse. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName, context) + .block(); + } + + /** + * List the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 user activities of a data warehouse along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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())); + } + + /** + * List the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 user activities of a data warehouse along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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)); + } + + /** + * List the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 user activities of a data warehouse as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 user activities of a data warehouse as paginated response with {@link PagedFlux}. + */ + @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)); + } + + /** + * List the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 user activities of a data warehouse as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * List the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 user activities of a data warehouse as paginated response with {@link PagedIterable}. + */ + @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 user activities of a data warehouse along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 user activities of a data warehouse along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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/DataWarehouseUserActivitiesOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesOperationsImpl.java new file mode 100644 index 0000000000000..073ae1eb2c1e4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesOperationsImpl.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.DataWarehouseUserActivitiesOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DataWarehouseUserActivitiesInner; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivities; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivitiesOperations; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivityName; + +public final class DataWarehouseUserActivitiesOperationsImpl implements DataWarehouseUserActivitiesOperations { + private static final ClientLogger LOGGER = new ClientLogger(DataWarehouseUserActivitiesOperationsImpl.class); + + private final DataWarehouseUserActivitiesOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DataWarehouseUserActivitiesOperationsImpl( + DataWarehouseUserActivitiesOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DataWarehouseUserActivities get( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName) { + DataWarehouseUserActivitiesInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName); + if (inner != null) { + return new DataWarehouseUserActivitiesImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DataWarehouseUserActivitiesImpl(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 DataWarehouseUserActivitiesImpl(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 DataWarehouseUserActivitiesImpl(inner1, this.manager())); + } + + private DataWarehouseUserActivitiesOperationsClient 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/DatabaseAdvisorsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvisorsClientImpl.java new file mode 100644 index 0000000000000..40797ddd1f557 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvisorsClientImpl.java @@ -0,0 +1,710 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.DatabaseAdvisorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseAdvisorsClient. */ +public final class DatabaseAdvisorsClientImpl implements DatabaseAdvisorsClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseAdvisorsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseAdvisorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseAdvisorsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabaseAdvisorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseAdvisors to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseAdvisorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/advisors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/advisors/{advisorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("advisorName") String advisorName, + @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}/advisors/{advisorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("advisorName") String advisorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AdvisorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listByDatabaseWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (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, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listByDatabaseWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (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, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, String expand) { + return listByDatabaseWithResponseAsync(resourceGroupName, serverName, databaseName, expand) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 advisors on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + final String expand = null; + return listByDatabaseWithResponseAsync(resourceGroupName, serverName, databaseName, expand) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 advisors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + final String expand = null; + return listByDatabaseAsync(resourceGroupName, serverName, databaseName, expand).block(); + } + + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listByDatabaseWithResponse( + String resourceGroupName, String serverName, String databaseName, String expand, Context context) { + return listByDatabaseWithResponseAsync(resourceGroupName, serverName, databaseName, expand, context).block(); + } + + /** + * Gets a database 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 the database. + * @param advisorName The name of the Database 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 database advisor along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be 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, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database 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 the database. + * @param advisorName The name of the Database 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 database advisor along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be 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, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a database 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 the database. + * @param advisorName The name of the Database 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 database advisor on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, advisorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a database 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 the database. + * @param advisorName The name of the Database 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 database advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdvisorInner get(String resourceGroupName, String serverName, String databaseName, String advisorName) { + return getAsync(resourceGroupName, serverName, databaseName, advisorName).block(); + } + + /** + * Gets a database 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 the database. + * @param advisorName The name of the Database 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 database advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, advisorName, context).block(); + } + + /** + * Updates a database 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 the database. + * @param advisorName The name of the Database Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName, AdvisorInner 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and 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, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a database 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 the database. + * @param advisorName The name of the Database Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + AdvisorInner 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and 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, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a database 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 the database. + * @param advisorName The name of the Database Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName, AdvisorInner parameters) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, advisorName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a database 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 the database. + * @param advisorName The name of the Database Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdvisorInner update( + String resourceGroupName, String serverName, String databaseName, String advisorName, AdvisorInner parameters) { + return updateAsync(resourceGroupName, serverName, databaseName, advisorName, parameters).block(); + } + + /** + * Updates a database 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 the database. + * @param advisorName The name of the Database Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + AdvisorInner parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, advisorName, parameters, context) + .block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvisorsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvisorsImpl.java new file mode 100644 index 0000000000000..ffbb29667101b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvisorsImpl.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.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.DatabaseAdvisorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import com.azure.resourcemanager.sql.generated.models.Advisor; +import com.azure.resourcemanager.sql.generated.models.DatabaseAdvisors; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class DatabaseAdvisorsImpl implements DatabaseAdvisors { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseAdvisorsImpl.class); + + private final DatabaseAdvisorsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseAdvisorsImpl( + DatabaseAdvisorsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + List inner = this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + if (inner != null) { + return Collections + .unmodifiableList( + inner.stream().map(inner1 -> new AdvisorImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listByDatabaseWithResponse( + String resourceGroupName, String serverName, String databaseName, String expand, Context context) { + Response> inner = + this + .serviceClient() + .listByDatabaseWithResponse(resourceGroupName, serverName, databaseName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new AdvisorImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public Advisor get(String resourceGroupName, String serverName, String databaseName, String advisorName) { + AdvisorInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName, advisorName); + if (inner != null) { + return new AdvisorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, advisorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AdvisorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Advisor update( + String resourceGroupName, String serverName, String databaseName, String advisorName, AdvisorInner parameters) { + AdvisorInner inner = + this.serviceClient().update(resourceGroupName, serverName, databaseName, advisorName, parameters); + if (inner != null) { + return new AdvisorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + AdvisorInner parameters, + Context context) { + Response inner = + this + .serviceClient() + .updateWithResponse(resourceGroupName, serverName, databaseName, advisorName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AdvisorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private DatabaseAdvisorsClient 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/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..11ec38995e7b8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsClientImpl.java @@ -0,0 +1,456 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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'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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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'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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "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())); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "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); + } + + /** + * 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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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..4efdd10b40e21 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsImpl.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.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; + +public final class DatabaseAutomaticTuningsImpl implements DatabaseAutomaticTunings { + private static 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..bbf56848a8476 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesClientImpl.java @@ -0,0 +1,779 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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") + @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( + "/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("{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 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-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())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-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)); + } + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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(); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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..4afd8f80b6fb8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesImpl.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.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; + +public final class DatabaseBlobAuditingPoliciesImpl implements DatabaseBlobAuditingPolicies { + private static 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 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 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 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..95d8be3d39338 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPolicyImpl.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 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 Boolean isStorageSecondaryKeyInUse() { + return this.innerModel().isStorageSecondaryKeyInUse(); + } + + public Boolean isAzureMonitorTargetEnabled() { + return this.innerModel().isAzureMonitorTargetEnabled(); + } + + public Integer queueDelayMs() { + return this.innerModel().queueDelayMs(); + } + + public Boolean isManagedIdentityInUse() { + return this.innerModel().isManagedIdentityInUse(); + } + + 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 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 withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.innerModel().withAuditActionsAndGroups(auditActionsAndGroups); + 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; + } + + public DatabaseBlobAuditingPolicyImpl withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.innerModel().withIsManagedIdentityInUse(isManagedIdentityInUse); + 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 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/DatabaseColumnImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnImpl.java new file mode 100644 index 0000000000000..e42566439a41b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnImpl.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.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; +import com.azure.resourcemanager.sql.generated.models.ColumnDataType; +import com.azure.resourcemanager.sql.generated.models.DatabaseColumn; +import com.azure.resourcemanager.sql.generated.models.TableTemporalType; + +public final class DatabaseColumnImpl implements DatabaseColumn { + private DatabaseColumnInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DatabaseColumnImpl( + DatabaseColumnInner 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 ColumnDataType columnType() { + return this.innerModel().columnType(); + } + + public TableTemporalType temporalType() { + return this.innerModel().temporalType(); + } + + public Boolean memoryOptimized() { + return this.innerModel().memoryOptimized(); + } + + public Boolean isComputed() { + return this.innerModel().isComputed(); + } + + public DatabaseColumnInner 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/DatabaseColumnsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnsClientImpl.java new file mode 100644 index 0000000000000..57bc054247462 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnsClientImpl.java @@ -0,0 +1,1196 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.DatabaseColumnsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseColumnListResult; +import java.util.Collection; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseColumnsClient. */ +public final class DatabaseColumnsClientImpl implements DatabaseColumnsClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseColumnsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseColumnsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseColumnsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabaseColumnsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseColumns to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseColumnsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/columns") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam(value = "schema", multipleQueryParams = true) List schema, + @QueryParam(value = "table", multipleQueryParams = true) List table, + @QueryParam(value = "column", multipleQueryParams = true) List column, + @QueryParam(value = "orderBy", multipleQueryParams = true) List orderBy, + @QueryParam("$skiptoken") String skiptoken, + @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}/schemas/{schemaName}/tables/{tableName}/columns") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTable( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @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}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}") + @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("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> listByTableNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List database 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 schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point 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 database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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"; + List schemaConverted = + Optional + .ofNullable(schema) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + List tableConverted = + Optional + .ofNullable(table) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + List columnConverted = + Optional + .ofNullable(column) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + List orderByConverted = + Optional + .ofNullable(orderBy) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaConverted, + tableConverted, + columnConverted, + orderByConverted, + skiptoken, + 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())); + } + + /** + * List database 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 schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point 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 database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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"; + List schemaConverted = + Optional + .ofNullable(schema) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + List tableConverted = + Optional + .ofNullable(table) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + List columnConverted = + Optional + .ofNullable(column) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + List orderByConverted = + Optional + .ofNullable(orderBy) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaConverted, + tableConverted, + columnConverted, + orderByConverted, + skiptoken, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List database 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 schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point 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 database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + final List schema = null; + final List table = null; + final List column = null; + final List orderBy = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List database 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 schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point 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 database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * List database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + final List schema = null; + final List table = null; + final List column = null; + final List orderBy = null; + final String skiptoken = null; + return new PagedIterable<>( + listByDatabaseAsync( + resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken)); + } + + /** + * List database 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 schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point 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 database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + return new PagedIterable<>( + listByDatabaseAsync( + resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, context)); + } + + /** + * List database 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 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 database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + 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 (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 (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 + .listByTable( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + 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())); + } + + /** + * List database 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 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 database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + 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 (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 (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 + .listByTable( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List database 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 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 database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTableAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String filter) { + return new PagedFlux<>( + () -> + listByTableSinglePageAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, filter), + nextLink -> listByTableNextSinglePageAsync(nextLink)); + } + + /** + * List database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTableAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName) { + final String filter = null; + return new PagedFlux<>( + () -> + listByTableSinglePageAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, filter), + nextLink -> listByTableNextSinglePageAsync(nextLink)); + } + + /** + * List database 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 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 database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTableAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listByTableSinglePageAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, filter, context), + nextLink -> listByTableNextSinglePageAsync(nextLink, context)); + } + + /** + * List database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTable( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName) { + final String filter = null; + return new PagedIterable<>( + listByTableAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, filter)); + } + + /** + * List database 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 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 database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTable( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context) { + return new PagedIterable<>( + listByTableAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, filter, context)); + } + + /** + * Get database 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 database column along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get database 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 database column along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get database 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 database column on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get database 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 database column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseColumnInner get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return getAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).block(); + } + + /** + * Get database 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 database column along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return getWithResponseAsync( + 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 database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableNextSinglePageAsync(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.listByTableNext(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 columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableNextSinglePageAsync(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 + .listByTableNext(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/DatabaseColumnsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnsImpl.java new file mode 100644 index 0000000000000..3b7355acf8ee7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnsImpl.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.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.DatabaseColumnsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseColumn; +import com.azure.resourcemanager.sql.generated.models.DatabaseColumns; +import java.util.List; + +public final class DatabaseColumnsImpl implements DatabaseColumns { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseColumnsImpl.class); + + private final DatabaseColumnsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseColumnsImpl( + DatabaseColumnsClient 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 DatabaseColumnImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase( + resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, context); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public PagedIterable listByTable( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName) { + PagedIterable inner = + this.serviceClient().listByTable(resourceGroupName, serverName, databaseName, schemaName, tableName); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public PagedIterable listByTable( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByTable(resourceGroupName, serverName, databaseName, schemaName, tableName, filter, context); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public DatabaseColumn get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + DatabaseColumnInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + if (inner != null) { + return new DatabaseColumnImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseColumnImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private DatabaseColumnsClient 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/DatabaseExtensionsOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseExtensionsOperationsClientImpl.java new file mode 100644 index 0000000000000..04f4a7c2850fc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseExtensionsOperationsClientImpl.java @@ -0,0 +1,959 @@ +// Copyright (c) Microsoft Corporation. All rights 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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseExtensionsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportExtensionsOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseExtensions; +import com.azure.resourcemanager.sql.generated.models.ImportExportExtensionsOperationListResult; +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 DatabaseExtensionsOperationsClient. */ +public final class DatabaseExtensionsOperationsClientImpl implements DatabaseExtensionsOperationsClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseExtensionsOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseExtensionsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseExtensionsOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseExtensionsOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseExtensionsOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseExtensionsOperationsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/extensions/{extensionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("extensionName") String extensionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/extensions/{extensionName}") + @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("extensionName") String extensionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseExtensions parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/extensions") + @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 extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName 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 database extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String extensionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + extensionName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName 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 database extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String extensionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + extensionName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName 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 database extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String extensionName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, extensionName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName 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 get(String resourceGroupName, String serverName, String databaseName, String extensionName) { + getAsync(resourceGroupName, serverName, databaseName, extensionName).block(); + } + + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName 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 database extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String extensionName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, extensionName, context).block(); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @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 Extension operation result resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions 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 (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and 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 = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + extensionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @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 Extension operation result resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions 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 (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and 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 = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + extensionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @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 the {@link PollerFlux} for polling of an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ImportExportExtensionsOperationResultInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, extensionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportExtensionsOperationResultInner.class, + ImportExportExtensionsOperationResultInner.class, + this.client.getContext()); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @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 the {@link PollerFlux} for polling of an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ImportExportExtensionsOperationResultInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, extensionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportExtensionsOperationResultInner.class, + ImportExportExtensionsOperationResultInner.class, + context); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @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 the {@link SyncPoller} for polling of an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ImportExportExtensionsOperationResultInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters) + .getSyncPoller(); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @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 the {@link SyncPoller} for polling of an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ImportExportExtensionsOperationResultInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, context) + .getSyncPoller(); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @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 Extension operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @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 Extension operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @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 Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportExtensionsOperationResultInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters).block(); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @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 Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportExtensionsOperationResultInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, context) + .block(); + } + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 import export operation extensions list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-02-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())); + } + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 import export operation extensions list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-02-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)); + } + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 import export operation extensions list as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 import export operation extensions list as paginated response with {@link PagedFlux}. + */ + @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)); + } + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 import export operation extensions list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 import export operation extensions list as paginated response with {@link PagedIterable}. + */ + @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 import export operation extensions list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 import export operation extensions list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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/DatabaseExtensionsOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseExtensionsOperationsImpl.java new file mode 100644 index 0000000000000..2643018af9955 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseExtensionsOperationsImpl.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.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.DatabaseExtensionsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportExtensionsOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseExtensionsOperations; +import com.azure.resourcemanager.sql.generated.models.ImportExportExtensionsOperationResult; + +public final class DatabaseExtensionsOperationsImpl implements DatabaseExtensionsOperations { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseExtensionsOperationsImpl.class); + + private final DatabaseExtensionsOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseExtensionsOperationsImpl( + DatabaseExtensionsOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void get(String resourceGroupName, String serverName, String databaseName, String extensionName) { + this.serviceClient().get(resourceGroupName, serverName, databaseName, extensionName); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String extensionName, Context context) { + return this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, extensionName, context); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new ImportExportExtensionsOperationResultImpl(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 ImportExportExtensionsOperationResultImpl(inner1, this.manager())); + } + + private DatabaseExtensionsOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ImportExportExtensionsOperationResultImpl define(String name) { + return new ImportExportExtensionsOperationResultImpl(name, this.manager()); + } +} 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..47752650d0c4a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseImpl.java @@ -0,0 +1,627 @@ +// Copyright (c) Microsoft Corporation. All rights 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.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseInner; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.CreateMode; +import com.azure.resourcemanager.sql.generated.models.Database; +import com.azure.resourcemanager.sql.generated.models.DatabaseIdentity; +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.ExportDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ImportExistingDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ImportExportOperationResult; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; +import com.azure.resourcemanager.sql.generated.models.ResourceMoveDefinition; +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 DatabaseIdentity identity() { + return this.innerModel().identity(); + } + + 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 BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.innerModel().currentBackupStorageRedundancy(); + } + + public BackupStorageRedundancy 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 Boolean isLedgerOn() { + return this.innerModel().isLedgerOn(); + } + + public Boolean isInfraEncryptionEnabled() { + return this.innerModel().isInfraEncryptionEnabled(); + } + + public UUID federatedClientId() { + return this.innerModel().federatedClientId(); + } + + public String sourceResourceId() { + return this.innerModel().sourceResourceId(); + } + + 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 ImportExportOperationResult export(ExportDatabaseDefinition parameters) { + return serviceManager.databases().export(resourceGroupName, serverName, databaseName, parameters); + } + + public ImportExportOperationResult export(ExportDatabaseDefinition parameters, Context context) { + return serviceManager.databases().export(resourceGroupName, serverName, databaseName, parameters, context); + } + + public void failover(ReplicaType replicaType) { + serviceManager.databases().failover(resourceGroupName, serverName, databaseName, replicaType); + } + + public void failover() { + serviceManager.databases().failover(resourceGroupName, serverName, databaseName); + } + + public void failover(ReplicaType replicaType, Context context) { + serviceManager.databases().failover(resourceGroupName, serverName, databaseName, replicaType, context); + } + + public ImportExportOperationResult importMethod(ImportExistingDatabaseDefinition parameters) { + return serviceManager.databases().importMethod(resourceGroupName, serverName, databaseName, parameters); + } + + public ImportExportOperationResult importMethod(ImportExistingDatabaseDefinition parameters, Context context) { + return serviceManager + .databases() + .importMethod(resourceGroupName, serverName, databaseName, parameters, context); + } + + public void rename(ResourceMoveDefinition parameters) { + serviceManager.databases().rename(resourceGroupName, serverName, databaseName, parameters); + } + + public Response renameWithResponse(ResourceMoveDefinition parameters, Context context) { + return serviceManager + .databases() + .renameWithResponse(resourceGroupName, serverName, databaseName, parameters, context); + } + + public Database pause() { + return serviceManager.databases().pause(resourceGroupName, serverName, databaseName); + } + + public Database pause(Context context) { + return serviceManager.databases().pause(resourceGroupName, serverName, databaseName, context); + } + + public Database resume() { + return serviceManager.databases().resume(resourceGroupName, serverName, databaseName); + } + + public Database resume(Context context) { + return serviceManager.databases().resume(resourceGroupName, serverName, databaseName, context); + } + + public void upgradeDataWarehouse() { + serviceManager.databases().upgradeDataWarehouse(resourceGroupName, serverName, databaseName); + } + + public void upgradeDataWarehouse(Context context) { + serviceManager.databases().upgradeDataWarehouse(resourceGroupName, serverName, databaseName, context); + } + + 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 withIdentity(DatabaseIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public DatabaseImpl withCreateMode(CreateMode createMode) { + this.innerModel().withCreateMode(createMode); + return this; + } + + public DatabaseImpl withCollation(String collation) { + this.innerModel().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) { + this.innerModel().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) { + this.innerModel().withSourceDatabaseId(sourceDatabaseId); + return this; + } + + public DatabaseImpl withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.innerModel().withRestorePointInTime(restorePointInTime); + return this; + } + + public DatabaseImpl withSourceDatabaseDeletionDate(OffsetDateTime sourceDatabaseDeletionDate) { + this.innerModel().withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + return this; + } + + public DatabaseImpl withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.innerModel().withRecoveryServicesRecoveryPointId(recoveryServicesRecoveryPointId); + return this; + } + + public DatabaseImpl withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.innerModel().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + return this; + } + + public DatabaseImpl withRecoverableDatabaseId(String recoverableDatabaseId) { + this.innerModel().withRecoverableDatabaseId(recoverableDatabaseId); + return this; + } + + public DatabaseImpl withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.innerModel().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + return this; + } + + public DatabaseImpl withCatalogCollation(CatalogCollationType catalogCollation) { + this.innerModel().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 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(BackupStorageRedundancy requestedBackupStorageRedundancy) { + this.innerModel().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; + } + } + + public DatabaseImpl withIsLedgerOn(Boolean isLedgerOn) { + if (isInCreateMode()) { + this.innerModel().withIsLedgerOn(isLedgerOn); + return this; + } else { + this.updateParameters.withIsLedgerOn(isLedgerOn); + return this; + } + } + + public DatabaseImpl withFederatedClientId(UUID federatedClientId) { + if (isInCreateMode()) { + this.innerModel().withFederatedClientId(federatedClientId); + return this; + } else { + this.updateParameters.withFederatedClientId(federatedClientId); + return this; + } + } + + public DatabaseImpl withSourceResourceId(String sourceResourceId) { + this.innerModel().withSourceResourceId(sourceResourceId); + return this; + } + + public DatabaseImpl withReadScale(DatabaseReadScale readScale) { + this.updateParameters.withReadScale(readScale); + 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..9dcb594198d4d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsClientImpl.java @@ -0,0 +1,553 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 = "2021-02-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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 = "2021-02-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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..83f8b3a85fb1c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsImpl.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.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 java.util.UUID; + +public final class DatabaseOperationsImpl implements DatabaseOperations { + private static 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/DatabaseRecommendedActionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseRecommendedActionsClientImpl.java new file mode 100644 index 0000000000000..555a76775a5a8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseRecommendedActionsClientImpl.java @@ -0,0 +1,774 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.DatabaseRecommendedActionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseRecommendedActionsClient. */ +public final class DatabaseRecommendedActionsClientImpl implements DatabaseRecommendedActionsClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseRecommendedActionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseRecommendedActionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseRecommendedActionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseRecommendedActionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseRecommendedActions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseRecommendedActionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> listByDatabaseAdvisor( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("advisorName") String advisorName, + @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}/advisors/{advisorName}/recommendedActions" + + "/{recommendedActionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("advisorName") String advisorName, + @PathParam("recommendedActionName") String recommendedActionName, + @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}/advisors/{advisorName}/recommendedActions" + + "/{recommendedActionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("advisorName") String advisorName, + @PathParam("recommendedActionName") String recommendedActionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RecommendedActionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets list of Database Recommended Actions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database 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 list of Database Recommended Actions along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listByDatabaseAdvisorWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be 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 + .listByDatabaseAdvisor( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets list of Database Recommended Actions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database 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 list of Database Recommended Actions along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listByDatabaseAdvisorWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be 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 + .listByDatabaseAdvisor( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets list of Database Recommended Actions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database 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 list of Database Recommended Actions on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAdvisorAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName) { + return listByDatabaseAdvisorWithResponseAsync(resourceGroupName, serverName, databaseName, advisorName) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets list of Database Recommended Actions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database 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 list of Database Recommended Actions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listByDatabaseAdvisor( + String resourceGroupName, String serverName, String databaseName, String advisorName) { + return listByDatabaseAdvisorAsync(resourceGroupName, serverName, databaseName, advisorName).block(); + } + + /** + * Gets list of Database Recommended Actions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database 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 list of Database Recommended Actions along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listByDatabaseAdvisorWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context) { + return listByDatabaseAdvisorWithResponseAsync(resourceGroupName, serverName, databaseName, advisorName, context) + .block(); + } + + /** + * Gets a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (recommendedActionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendedActionName is required and cannot be 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, + advisorName, + recommendedActionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (recommendedActionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendedActionName is required and cannot be 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, + advisorName, + recommendedActionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecommendedActionInner get( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName) { + return getAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName).block(); + } + + /** + * Gets a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, context) + .block(); + } + + /** + * Updates a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param parameters The requested recommended action 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, Server or Elastic Pool Recommended Action along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (recommendedActionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendedActionName is required and 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, + advisorName, + recommendedActionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param parameters The requested recommended action 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, Server or Elastic Pool Recommended Action along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (recommendedActionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendedActionName is required and 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, + advisorName, + recommendedActionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param parameters The requested recommended action 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, Server or Elastic Pool Recommended Action on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters) { + return updateWithResponseAsync( + resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param parameters The requested recommended action 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, Server or Elastic Pool Recommended Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecommendedActionInner update( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters) { + return updateAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters) + .block(); + } + + /** + * Updates a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param parameters The requested recommended action 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, Server or Elastic Pool Recommended Action along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters, + Context context) { + return updateWithResponseAsync( + resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters, context) + .block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseRecommendedActionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseRecommendedActionsImpl.java new file mode 100644 index 0000000000000..543a54c44b66c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseRecommendedActionsImpl.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.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.DatabaseRecommendedActionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseRecommendedActions; +import com.azure.resourcemanager.sql.generated.models.RecommendedAction; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class DatabaseRecommendedActionsImpl implements DatabaseRecommendedActions { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseRecommendedActionsImpl.class); + + private final DatabaseRecommendedActionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseRecommendedActionsImpl( + DatabaseRecommendedActionsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public List listByDatabaseAdvisor( + String resourceGroupName, String serverName, String databaseName, String advisorName) { + List inner = + this.serviceClient().listByDatabaseAdvisor(resourceGroupName, serverName, databaseName, advisorName); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new RecommendedActionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listByDatabaseAdvisorWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context) { + Response> inner = + this + .serviceClient() + .listByDatabaseAdvisorWithResponse(resourceGroupName, serverName, databaseName, advisorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new RecommendedActionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public RecommendedAction get( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName) { + RecommendedActionInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName); + if (inner != null) { + return new RecommendedActionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecommendedActionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RecommendedAction update( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters) { + RecommendedActionInner inner = + this + .serviceClient() + .update(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters); + if (inner != null) { + return new RecommendedActionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters, + Context context) { + Response inner = + this + .serviceClient() + .updateWithResponse( + resourceGroupName, + serverName, + databaseName, + advisorName, + recommendedActionName, + parameters, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecommendedActionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private DatabaseRecommendedActionsClient 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/DatabaseSchemaImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemaImpl.java new file mode 100644 index 0000000000000..52d461391443a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemaImpl.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.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSchema; + +public final class DatabaseSchemaImpl implements DatabaseSchema { + private DatabaseSchemaInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DatabaseSchemaImpl( + DatabaseSchemaInner 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 DatabaseSchemaInner 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/DatabaseSchemasClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemasClientImpl.java new file mode 100644 index 0000000000000..4bd95bd16bd55 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemasClientImpl.java @@ -0,0 +1,592 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.DatabaseSchemasClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSchemaListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseSchemasClient. */ +public final class DatabaseSchemasClientImpl implements DatabaseSchemasClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseSchemasService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseSchemasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseSchemasClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabaseSchemasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseSchemas to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseSchemasService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @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}/schemas/{schemaName}") + @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("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); + } + + /** + * List 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. + * @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 database schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + 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 = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + 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())); + } + + /** + * List 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. + * @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 database schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + 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 = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + 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)); + } + + /** + * List 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. + * @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 database schemas as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, String filter) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 schemas as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + final String filter = null; + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List 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. + * @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 database schemas as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * List 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + final String filter = null; + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, filter)); + } + + /** + * List 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. + * @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 database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, filter, context)); + } + + /** + * Get 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. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 schema along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + schemaName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get 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. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 schema along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + schemaName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get 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. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 schema on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, schemaName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get 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. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 schema. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSchemaInner get( + String resourceGroupName, String serverName, String databaseName, String schemaName) { + return getAsync(resourceGroupName, serverName, databaseName, schemaName).block(); + } + + /** + * Get 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. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 schema along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String schemaName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, schemaName, 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 database schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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/DatabaseSchemasImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemasImpl.java new file mode 100644 index 0000000000000..e1776f2791233 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemasImpl.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.DatabaseSchemasClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSchema; +import com.azure.resourcemanager.sql.generated.models.DatabaseSchemas; + +public final class DatabaseSchemasImpl implements DatabaseSchemas { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseSchemasImpl.class); + + private final DatabaseSchemasClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseSchemasImpl( + DatabaseSchemasClient 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 DatabaseSchemaImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, filter, context); + return Utils.mapPage(inner, inner1 -> new DatabaseSchemaImpl(inner1, this.manager())); + } + + public DatabaseSchema get(String resourceGroupName, String serverName, String databaseName, String schemaName) { + DatabaseSchemaInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName, schemaName); + if (inner != null) { + return new DatabaseSchemaImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String schemaName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, schemaName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseSchemaImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private DatabaseSchemasClient 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/DatabaseSecurityAlertPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPoliciesClientImpl.java new file mode 100644 index 0000000000000..3daba695505f0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,844 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.DatabaseSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertListResult; +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 DatabaseSecurityAlertPoliciesClient. */ +public final class DatabaseSecurityAlertPoliciesClientImpl implements DatabaseSecurityAlertPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseSecurityAlertPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseSecurityAlertPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseSecurityAlertPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseSecurityAlertPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseSecurityAlertPolicies to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseSecurityAlertPoliciesService { + @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("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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/servers" + + "/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + @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("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseSecurityAlertPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/securityAlertPolicies") + @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 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 databaseName The name of the 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 database's security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the 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 database's security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the 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 database's security alert policy on successful completion of {@link Mono}. + */ + @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 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 databaseName The name of the 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 database's security alert 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 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 databaseName The name of the 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 database's security alert policy along with {@link Response}. + */ + @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 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 databaseName The name of the 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 database security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + 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 serverName The name of the server. + * @param databaseName The name of the 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 database security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + 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 serverName The name of the server. + * @param databaseName The name of the 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 database security alert policy on successful completion of {@link Mono}. + */ + @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 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 databaseName The name of the 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 database security alert 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 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 databaseName The name of the 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 database security alert policy along with {@link Response}. + */ + @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(); + } + + /** + * Gets a list of 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 serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy 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 database's security alert policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 list of 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 serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy 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 database's security alert policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 list of 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 serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy 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 database's security alert policies as paginated response with {@link PagedFlux}. + */ + @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 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 serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy 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 database's security alert policies as paginated response with {@link PagedFlux}. + */ + @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 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 serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy 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 database's security alert policies as paginated response with {@link PagedIterable}. + */ + @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'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 serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy 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 database's security alert policies as paginated response with {@link PagedIterable}. + */ + @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 security alert policies along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 security alert policies along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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/DatabaseSecurityAlertPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..aa6ce7e12a636 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPoliciesImpl.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.DatabaseSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +public final class DatabaseSecurityAlertPoliciesImpl implements DatabaseSecurityAlertPolicies { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseSecurityAlertPoliciesImpl.class); + + private final DatabaseSecurityAlertPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseSecurityAlertPoliciesImpl( + DatabaseSecurityAlertPoliciesClient 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 PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseSecurityAlertPolicyImpl(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 DatabaseSecurityAlertPolicyImpl(inner1, this.manager())); + } + + 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 DatabaseSecurityAlertPoliciesClient 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/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..3104d208c6579 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPolicyImpl.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.SystemData; +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.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public SecurityAlertsPolicyState 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 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() + .getDatabaseSecurityAlertPolicies() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + securityAlertPolicyName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseSecurityAlertPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSecurityAlertPolicies() + .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() + .getDatabaseSecurityAlertPolicies() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + securityAlertPolicyName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseSecurityAlertPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSecurityAlertPolicies() + .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() + .getDatabaseSecurityAlertPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, securityAlertPolicyName, Context.NONE) + .getValue(); + return this; + } + + public DatabaseSecurityAlertPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSecurityAlertPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, securityAlertPolicyName, context) + .getValue(); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withState(SecurityAlertsPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.innerModel().withDisabledAlerts(disabledAlerts); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.innerModel().withEmailAddresses(emailAddresses); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean 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; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTableImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTableImpl.java new file mode 100644 index 0000000000000..d2d15edb904b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTableImpl.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.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseTable; +import com.azure.resourcemanager.sql.generated.models.TableTemporalType; + +public final class DatabaseTableImpl implements DatabaseTable { + private DatabaseTableInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DatabaseTableImpl( + DatabaseTableInner 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 TableTemporalType temporalType() { + return this.innerModel().temporalType(); + } + + public Boolean memoryOptimized() { + return this.innerModel().memoryOptimized(); + } + + public DatabaseTableInner 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/DatabaseTablesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTablesClientImpl.java new file mode 100644 index 0000000000000..aa225e6f813d8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTablesClientImpl.java @@ -0,0 +1,648 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.DatabaseTablesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseTableListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseTablesClient. */ +public final class DatabaseTablesClientImpl implements DatabaseTablesClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseTablesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseTablesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseTablesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabaseTablesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseTables to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DatabaseTablesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySchema( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @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}/schemas/{schemaName}/tables/{tableName}") + @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("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> listBySchemaNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 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 database tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName, 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 (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be 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 + .listBySchema( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + 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())); + } + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 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 database tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + 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 (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be 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 + .listBySchema( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 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 database tables as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName, String filter) { + return new PagedFlux<>( + () -> listBySchemaSinglePageAsync(resourceGroupName, serverName, databaseName, schemaName, filter), + nextLink -> listBySchemaNextSinglePageAsync(nextLink)); + } + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 tables as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName) { + final String filter = null; + return new PagedFlux<>( + () -> listBySchemaSinglePageAsync(resourceGroupName, serverName, databaseName, schemaName, filter), + nextLink -> listBySchemaNextSinglePageAsync(nextLink)); + } + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 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 database tables as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String filter, + Context context) { + return new PagedFlux<>( + () -> listBySchemaSinglePageAsync(resourceGroupName, serverName, databaseName, schemaName, filter, context), + nextLink -> listBySchemaNextSinglePageAsync(nextLink, context)); + } + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySchema( + String resourceGroupName, String serverName, String databaseName, String schemaName) { + final String filter = null; + return new PagedIterable<>(listBySchemaAsync(resourceGroupName, serverName, databaseName, schemaName, filter)); + } + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 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 database tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySchema( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String filter, + Context context) { + return new PagedIterable<>( + listBySchemaAsync(resourceGroupName, serverName, databaseName, schemaName, filter, context)); + } + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 table along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + schemaName, + tableName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 table along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + schemaName, + tableName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 table on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseTableInner get( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName) { + return getAsync(resourceGroupName, serverName, databaseName, schemaName, tableName).block(); + } + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 table along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, 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 database tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaNextSinglePageAsync(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.listBySchemaNext(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 tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaNextSinglePageAsync(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 + .listBySchemaNext(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/DatabaseTablesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTablesImpl.java new file mode 100644 index 0000000000000..ac5d3ea293788 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTablesImpl.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.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.DatabaseTablesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseTable; +import com.azure.resourcemanager.sql.generated.models.DatabaseTables; + +public final class DatabaseTablesImpl implements DatabaseTables { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseTablesImpl.class); + + private final DatabaseTablesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseTablesImpl( + DatabaseTablesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySchema( + String resourceGroupName, String serverName, String databaseName, String schemaName) { + PagedIterable inner = + this.serviceClient().listBySchema(resourceGroupName, serverName, databaseName, schemaName); + return Utils.mapPage(inner, inner1 -> new DatabaseTableImpl(inner1, this.manager())); + } + + public PagedIterable listBySchema( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String filter, + Context context) { + PagedIterable inner = + this.serviceClient().listBySchema(resourceGroupName, serverName, databaseName, schemaName, filter, context); + return Utils.mapPage(inner, inner1 -> new DatabaseTableImpl(inner1, this.manager())); + } + + public DatabaseTable get( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName) { + DatabaseTableInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, schemaName, tableName); + if (inner != null) { + return new DatabaseTableImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, schemaName, tableName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseTableImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private DatabaseTablesClient 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/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..6ad5f555d48a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsageImpl.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.DatabaseUsageInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseUsage; + +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 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 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..782e5c2c69a48 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesClientImpl.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.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.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 { + /** 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, + @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 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 database usages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 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 database usages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 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 database usages as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets 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 database usages as paginated response with {@link PagedFlux}. + */ + @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 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 database usages as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets 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 database usages as paginated response with {@link PagedIterable}. + */ + @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 usage metrics along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 usage metrics along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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/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..acf64c3b3d7f5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesImpl.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.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; + +public final class DatabaseUsagesImpl implements DatabaseUsages { + private static 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..d93db4fb02cce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.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.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.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 { + /** 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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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..c1d620a2d3c79 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java @@ -0,0 +1,365 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + +public final class DatabaseVulnerabilityAssessmentRuleBaselinesImpl + implements DatabaseVulnerabilityAssessmentRuleBaselines { + private static 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); + } + + 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..d93082c53190d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansClientImpl.java @@ -0,0 +1,1301 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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({"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"}) + @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({"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); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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(); + } + + /** + * 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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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(); + } + + /** + * 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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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..529ae964b1129 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansImpl.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.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; + +public final class DatabaseVulnerabilityAssessmentScansImpl implements DatabaseVulnerabilityAssessmentScans { + private static 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 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 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 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..4ddfdcd5aebe4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsClientImpl.java @@ -0,0 +1,1067 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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())); + } + + /** + * 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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)); + } + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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..cb810be14056a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsImpl.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.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; + +public final class DatabaseVulnerabilityAssessmentsImpl implements DatabaseVulnerabilityAssessments { + private static 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); + } + + 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..e59661ea9357d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesClientImpl.java @@ -0,0 +1,4571 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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.ImportExistingDatabaseDefinition; +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 { + /** 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"}) + @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, + @QueryParam("$skipToken") String skipToken, + @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"}) + @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({"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"}) + @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); + + @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"}) + @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}/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({"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"}) + @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({"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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, serverName, databaseName, 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. + * @param skipToken The skipToken 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + skipToken, + 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 skipToken The skipToken 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + skipToken, + 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. + * @param skipToken The skipToken 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, String skipToken) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, skipToken), + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + final String skipToken = null; + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, skipToken), + 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 skipToken The skipToken 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, String skipToken, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, skipToken, 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + final String skipToken = null; + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, skipToken)); + } + + /** + * 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 skipToken The skipToken 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, String skipToken, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, skipToken, 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-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. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-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. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-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())); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-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); + } + + /** + * 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 the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-01-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-01-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 the {@link PollerFlux} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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(); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-01-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-01-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 the {@link PollerFlux} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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(); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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(); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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(); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-05-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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-05-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName, 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2021-05-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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2021-05-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listInaccessibleByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listInaccessibleByServerAsync(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 databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..c709385364a73 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesImpl.java @@ -0,0 +1,380 @@ +// Copyright (c) Microsoft Corporation. All rights 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.ImportExistingDatabaseDefinition; +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; + +public final class DatabasesImpl implements Databases { + private static 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 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, String skipToken, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, skipToken, 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 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 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 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; + } + } + + 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 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 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 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 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 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/DeletedServerImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServerImpl.java new file mode 100644 index 0000000000000..56765466fad1d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServerImpl.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.DeletedServerInner; +import com.azure.resourcemanager.sql.generated.models.DeletedServer; +import java.time.OffsetDateTime; + +public final class DeletedServerImpl implements DeletedServer { + private DeletedServerInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DeletedServerImpl( + DeletedServerInner 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 version() { + return this.innerModel().version(); + } + + public OffsetDateTime deletionTime() { + return this.innerModel().deletionTime(); + } + + public String originalId() { + return this.innerModel().originalId(); + } + + public String fullyQualifiedDomainName() { + return this.innerModel().fullyQualifiedDomainName(); + } + + public DeletedServerInner 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/DeletedServersClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServersClientImpl.java new file mode 100644 index 0000000000000..222b877e833f4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServersClientImpl.java @@ -0,0 +1,962 @@ +// Copyright (c) Microsoft Corporation. All rights 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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.DeletedServersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DeletedServerInner; +import com.azure.resourcemanager.sql.generated.models.DeletedServerListResult; +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 DeletedServersClient. */ +public final class DeletedServersClientImpl implements DeletedServersClient { + /** The proxy service used to perform REST calls. */ + private final DeletedServersService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DeletedServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DeletedServersClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DeletedServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDeletedServers to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DeletedServersService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers") + @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}/providers/Microsoft.Sql/locations/{locationName}/deletedServers" + + "/{deletedServerName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("deletedServerName") String deletedServerName, + @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}/deletedServers") + @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"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers" + + "/{deletedServerName}/recover") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> recover( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("deletedServerName") String deletedServerName, + @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> 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> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of all deleted servers in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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-11-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 deleted servers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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-11-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 deleted servers in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all deleted servers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all deleted servers in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of all deleted servers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String locationName, String deletedServerName) { + 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 (deletedServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deletedServerName is required and cannot be 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, + deletedServerName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String deletedServerName, 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 (deletedServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deletedServerName is required and cannot be 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, + deletedServerName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String locationName, String deletedServerName) { + return getWithResponseAsync(locationName, deletedServerName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeletedServerInner get(String locationName, String deletedServerName) { + return getAsync(locationName, deletedServerName).block(); + } + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String locationName, String deletedServerName, Context context) { + return getWithResponseAsync(locationName, deletedServerName, context).block(); + } + + /** + * Gets a list of deleted servers for a 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 a list of deleted servers for a location along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 a list of deleted servers for a 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 a list of deleted servers for a location along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 a list of deleted servers for a 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 a list of deleted servers for a location as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName), nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of deleted servers for a 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 a list of deleted servers for a location as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of deleted servers for a 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 a list of deleted servers for a location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName) { + return new PagedIterable<>(listByLocationAsync(locationName)); + } + + /** + * Gets a list of deleted servers for a 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 a list of deleted servers for a location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName, Context context) { + return new PagedIterable<>(listByLocationAsync(locationName, context)); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> recoverWithResponseAsync(String locationName, String deletedServerName) { + 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 (deletedServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deletedServerName is required and cannot be 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 + .recover( + this.client.getEndpoint(), + locationName, + deletedServerName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> recoverWithResponseAsync( + String locationName, String deletedServerName, 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 (deletedServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deletedServerName is required and cannot be 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 + .recover( + this.client.getEndpoint(), + locationName, + deletedServerName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 {@link PollerFlux} for polling of a deleted server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeletedServerInner> beginRecoverAsync( + String locationName, String deletedServerName) { + Mono>> mono = recoverWithResponseAsync(locationName, deletedServerName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeletedServerInner.class, + DeletedServerInner.class, + this.client.getContext()); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 {@link PollerFlux} for polling of a deleted server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeletedServerInner> beginRecoverAsync( + String locationName, String deletedServerName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = recoverWithResponseAsync(locationName, deletedServerName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DeletedServerInner.class, DeletedServerInner.class, context); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 {@link SyncPoller} for polling of a deleted server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeletedServerInner> beginRecover( + String locationName, String deletedServerName) { + return beginRecoverAsync(locationName, deletedServerName).getSyncPoller(); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 {@link SyncPoller} for polling of a deleted server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeletedServerInner> beginRecover( + String locationName, String deletedServerName, Context context) { + return beginRecoverAsync(locationName, deletedServerName, context).getSyncPoller(); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono recoverAsync(String locationName, String deletedServerName) { + return beginRecoverAsync(locationName, deletedServerName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono recoverAsync(String locationName, String deletedServerName, Context context) { + return beginRecoverAsync(locationName, deletedServerName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeletedServerInner recover(String locationName, String deletedServerName) { + return recoverAsync(locationName, deletedServerName).block(); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeletedServerInner recover(String locationName, String deletedServerName, Context context) { + return recoverAsync(locationName, deletedServerName, 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 deleted servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 deleted servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 deleted servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 deleted servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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/DeletedServersImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServersImpl.java new file mode 100644 index 0000000000000..1426ebac3f5d3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServersImpl.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.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.DeletedServersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DeletedServerInner; +import com.azure.resourcemanager.sql.generated.models.DeletedServer; +import com.azure.resourcemanager.sql.generated.models.DeletedServers; + +public final class DeletedServersImpl implements DeletedServers { + private static final ClientLogger LOGGER = new ClientLogger(DeletedServersImpl.class); + + private final DeletedServersClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DeletedServersImpl( + DeletedServersClient 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 DeletedServerImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new DeletedServerImpl(inner1, this.manager())); + } + + public DeletedServer get(String locationName, String deletedServerName) { + DeletedServerInner inner = this.serviceClient().get(locationName, deletedServerName); + if (inner != null) { + return new DeletedServerImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String locationName, String deletedServerName, Context context) { + Response inner = + this.serviceClient().getWithResponse(locationName, deletedServerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeletedServerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByLocation(String locationName) { + PagedIterable inner = this.serviceClient().listByLocation(locationName); + return Utils.mapPage(inner, inner1 -> new DeletedServerImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String locationName, Context context) { + PagedIterable inner = this.serviceClient().listByLocation(locationName, context); + return Utils.mapPage(inner, inner1 -> new DeletedServerImpl(inner1, this.manager())); + } + + public DeletedServer recover(String locationName, String deletedServerName) { + DeletedServerInner inner = this.serviceClient().recover(locationName, deletedServerName); + if (inner != null) { + return new DeletedServerImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeletedServer recover(String locationName, String deletedServerName, Context context) { + DeletedServerInner inner = this.serviceClient().recover(locationName, deletedServerName, context); + if (inner != null) { + return new DeletedServerImpl(inner, this.manager()); + } else { + return null; + } + } + + private DeletedServersClient 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/DistributedAvailabilityGroupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupImpl.java new file mode 100644 index 0000000000000..5081e1ec2d8b9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupImpl.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.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DistributedAvailabilityGroupInner; +import com.azure.resourcemanager.sql.generated.models.DistributedAvailabilityGroup; +import com.azure.resourcemanager.sql.generated.models.ReplicationMode; +import java.util.UUID; + +public final class DistributedAvailabilityGroupImpl + implements DistributedAvailabilityGroup, + DistributedAvailabilityGroup.Definition, + DistributedAvailabilityGroup.Update { + private DistributedAvailabilityGroupInner 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 targetDatabase() { + return this.innerModel().targetDatabase(); + } + + public String sourceEndpoint() { + return this.innerModel().sourceEndpoint(); + } + + public String primaryAvailabilityGroupName() { + return this.innerModel().primaryAvailabilityGroupName(); + } + + public String secondaryAvailabilityGroupName() { + return this.innerModel().secondaryAvailabilityGroupName(); + } + + public ReplicationMode replicationMode() { + return this.innerModel().replicationMode(); + } + + public UUID distributedAvailabilityGroupId() { + return this.innerModel().distributedAvailabilityGroupId(); + } + + public UUID sourceReplicaId() { + return this.innerModel().sourceReplicaId(); + } + + public UUID targetReplicaId() { + return this.innerModel().targetReplicaId(); + } + + public String linkState() { + return this.innerModel().linkState(); + } + + public String lastHardenedLsn() { + return this.innerModel().lastHardenedLsn(); + } + + public DistributedAvailabilityGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String distributedAvailabilityGroupName; + + public DistributedAvailabilityGroupImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public DistributedAvailabilityGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getDistributedAvailabilityGroups() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.innerModel(), + Context.NONE); + return this; + } + + public DistributedAvailabilityGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDistributedAvailabilityGroups() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.innerModel(), + context); + return this; + } + + DistributedAvailabilityGroupImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DistributedAvailabilityGroupInner(); + this.serviceManager = serviceManager; + this.distributedAvailabilityGroupName = name; + } + + public DistributedAvailabilityGroupImpl update() { + return this; + } + + public DistributedAvailabilityGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDistributedAvailabilityGroups() + .update( + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.innerModel(), + Context.NONE); + return this; + } + + public DistributedAvailabilityGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDistributedAvailabilityGroups() + .update( + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.innerModel(), + context); + return this; + } + + DistributedAvailabilityGroupImpl( + DistributedAvailabilityGroupInner 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.distributedAvailabilityGroupName = + Utils.getValueFromIdByName(innerObject.id(), "distributedAvailabilityGroups"); + } + + public DistributedAvailabilityGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDistributedAvailabilityGroups() + .getWithResponse(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, Context.NONE) + .getValue(); + return this; + } + + public DistributedAvailabilityGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDistributedAvailabilityGroups() + .getWithResponse(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context) + .getValue(); + return this; + } + + public DistributedAvailabilityGroupImpl withTargetDatabase(String targetDatabase) { + this.innerModel().withTargetDatabase(targetDatabase); + return this; + } + + public DistributedAvailabilityGroupImpl withSourceEndpoint(String sourceEndpoint) { + this.innerModel().withSourceEndpoint(sourceEndpoint); + return this; + } + + public DistributedAvailabilityGroupImpl withPrimaryAvailabilityGroupName(String primaryAvailabilityGroupName) { + this.innerModel().withPrimaryAvailabilityGroupName(primaryAvailabilityGroupName); + return this; + } + + public DistributedAvailabilityGroupImpl withSecondaryAvailabilityGroupName(String secondaryAvailabilityGroupName) { + this.innerModel().withSecondaryAvailabilityGroupName(secondaryAvailabilityGroupName); + return this; + } + + public DistributedAvailabilityGroupImpl withReplicationMode(ReplicationMode replicationMode) { + this.innerModel().withReplicationMode(replicationMode); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupsClientImpl.java new file mode 100644 index 0000000000000..4b7406e5aa117 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupsClientImpl.java @@ -0,0 +1,1640 @@ +// Copyright (c) Microsoft Corporation. All rights 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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.DistributedAvailabilityGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DistributedAvailabilityGroupInner; +import com.azure.resourcemanager.sql.generated.models.DistributedAvailabilityGroupsListResult; +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 DistributedAvailabilityGroupsClient. */ +public final class DistributedAvailabilityGroupsClientImpl implements DistributedAvailabilityGroupsClient { + /** The proxy service used to perform REST calls. */ + private final DistributedAvailabilityGroupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DistributedAvailabilityGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DistributedAvailabilityGroupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DistributedAvailabilityGroupsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDistributedAvailabilityGroups to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + private interface DistributedAvailabilityGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/distributedAvailabilityGroups") + @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}/distributedAvailabilityGroups" + + "/{distributedAvailabilityGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("distributedAvailabilityGroupName") String distributedAvailabilityGroupName, + @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}/distributedAvailabilityGroups" + + "/{distributedAvailabilityGroupName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("distributedAvailabilityGroupName") String distributedAvailabilityGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DistributedAvailabilityGroupInner 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}/distributedAvailabilityGroups" + + "/{distributedAvailabilityGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("distributedAvailabilityGroupName") String distributedAvailabilityGroupName, + @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}/distributedAvailabilityGroups" + + "/{distributedAvailabilityGroupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("distributedAvailabilityGroupName") String distributedAvailabilityGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DistributedAvailabilityGroupInner 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); + } + + /** + * Gets a list of a distributed availability groups in 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 a distributed availability groups in instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2021-11-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 a distributed availability groups in 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 a distributed availability groups in instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2021-11-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 a distributed availability groups in 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 a distributed availability groups in instance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of a distributed availability groups in 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 a distributed availability groups in instance as paginated response with {@link PagedFlux}. + */ + @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 a distributed availability groups in 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 a distributed availability groups in instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of a distributed availability groups in 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 a distributed availability groups in instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group 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 distributed availability group info along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group 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 distributed availability group info along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group 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 distributed availability group info on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group 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 distributed availability group info. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DistributedAvailabilityGroupInner get( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + return getAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName).block(); + } + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group 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 distributed availability group info along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context) + .block(); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner 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 (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and 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 = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner 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 (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and 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 = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 the {@link PollerFlux} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DistributedAvailabilityGroupInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DistributedAvailabilityGroupInner.class, + DistributedAvailabilityGroupInner.class, + this.client.getContext()); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 the {@link PollerFlux} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DistributedAvailabilityGroupInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DistributedAvailabilityGroupInner.class, + DistributedAvailabilityGroupInner.class, + context); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DistributedAvailabilityGroupInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters) + .getSyncPoller(); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DistributedAvailabilityGroupInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DistributedAvailabilityGroupInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters) + .block(); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DistributedAvailabilityGroupInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context) + .block(); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName) + .getSyncPoller(); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context) + .getSyncPoller(); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + deleteAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName).block(); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + deleteAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context).block(); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner 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 (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and 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 = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner 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 (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and 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 = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 the {@link PollerFlux} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DistributedAvailabilityGroupInner> + beginUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DistributedAvailabilityGroupInner.class, + DistributedAvailabilityGroupInner.class, + this.client.getContext()); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 the {@link PollerFlux} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DistributedAvailabilityGroupInner> + beginUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DistributedAvailabilityGroupInner.class, + DistributedAvailabilityGroupInner.class, + context); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DistributedAvailabilityGroupInner> beginUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters) + .getSyncPoller(); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DistributedAvailabilityGroupInner> beginUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DistributedAvailabilityGroupInner update( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + return updateAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters) + .block(); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group 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 distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DistributedAvailabilityGroupInner update( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + return updateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, 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 distributed availability groups in instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 distributed availability groups in instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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/DistributedAvailabilityGroupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupsImpl.java new file mode 100644 index 0000000000000..f405a0d057e3e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupsImpl.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.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.DistributedAvailabilityGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DistributedAvailabilityGroupInner; +import com.azure.resourcemanager.sql.generated.models.DistributedAvailabilityGroup; +import com.azure.resourcemanager.sql.generated.models.DistributedAvailabilityGroups; + +public final class DistributedAvailabilityGroupsImpl implements DistributedAvailabilityGroups { + private static final ClientLogger LOGGER = new ClientLogger(DistributedAvailabilityGroupsImpl.class); + + private final DistributedAvailabilityGroupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DistributedAvailabilityGroupsImpl( + DistributedAvailabilityGroupsClient 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 DistributedAvailabilityGroupImpl(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 DistributedAvailabilityGroupImpl(inner1, this.manager())); + } + + public DistributedAvailabilityGroup get( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + DistributedAvailabilityGroupInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName); + if (inner != null) { + return new DistributedAvailabilityGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DistributedAvailabilityGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName); + } + + public void delete( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context); + } + + public DistributedAvailabilityGroup 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 distributedAvailabilityGroupName = Utils.getValueFromIdByName(id, "distributedAvailabilityGroups"); + if (distributedAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'distributedAvailabilityGroups'.", + id))); + } + return this + .getWithResponse(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, 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 distributedAvailabilityGroupName = Utils.getValueFromIdByName(id, "distributedAvailabilityGroups"); + if (distributedAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'distributedAvailabilityGroups'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, 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 distributedAvailabilityGroupName = Utils.getValueFromIdByName(id, "distributedAvailabilityGroups"); + if (distributedAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'distributedAvailabilityGroups'.", + id))); + } + this.delete(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, 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 distributedAvailabilityGroupName = Utils.getValueFromIdByName(id, "distributedAvailabilityGroups"); + if (distributedAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'distributedAvailabilityGroups'.", + id))); + } + this.delete(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context); + } + + private DistributedAvailabilityGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DistributedAvailabilityGroupImpl define(String name) { + return new DistributedAvailabilityGroupImpl(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..63cd4746ae1ec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesClientImpl.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.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 { + /** 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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 as paginated response with {@link + * PagedFlux}. + */ + @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 as paginated response with {@link + * PagedFlux}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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..9b571cd263eb7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesImpl.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.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; + +public final class ElasticPoolActivitiesImpl implements ElasticPoolActivities { + private static 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..c7441fd9dc08d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesClientImpl.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.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.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 { + /** 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 along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedFlux}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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 as paginated response with + * {@link PagedIterable}. + */ + @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..e8ae12817bc1d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesImpl.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.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; + +public final class ElasticPoolDatabaseActivitiesImpl implements ElasticPoolDatabaseActivities { + private static 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..c5f81c22417fb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolImpl.java @@ -0,0 +1,296 @@ +// Copyright (c) Microsoft Corporation. All rights 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 Integer highAvailabilityReplicaCount() { + return this.innerModel().highAvailabilityReplicaCount(); + } + + 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 void failover() { + serviceManager.elasticPools().failover(resourceGroupName, serverName, elasticPoolName); + } + + public void failover(Context context) { + serviceManager.elasticPools().failover(resourceGroupName, serverName, elasticPoolName, context); + } + + 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; + } + } + + public ElasticPoolImpl withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + if (isInCreateMode()) { + this.innerModel().withHighAvailabilityReplicaCount(highAvailabilityReplicaCount); + return this; + } else { + this.updateParameters.withHighAvailabilityReplicaCount(highAvailabilityReplicaCount); + 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..64af5965c00f7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsClientImpl.java @@ -0,0 +1,559 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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..fd997fe405649 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsImpl.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.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 java.util.UUID; + +public final class ElasticPoolOperationsImpl implements ElasticPoolOperations { + private static 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..7fba1f5585c17 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsClientImpl.java @@ -0,0 +1,2244 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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") Long 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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Long 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 = "2021-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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Long 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 = "2021-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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Long 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + final Long 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Long 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + final Long 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Long 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-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 the {@link PollerFlux} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-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 the {@link PollerFlux} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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..3b24c40f273c6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsImpl.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.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; + +public final class ElasticPoolsImpl implements ElasticPools { + private static 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, Long 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..ab366776a591b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorImpl.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.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 Boolean autoRotationEnabled() { + return this.innerModel().autoRotationEnabled(); + } + + 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 void revalidate() { + serviceManager.encryptionProtectors().revalidate(resourceGroupName, serverName, encryptionProtectorName); + } + + public void revalidate(Context context) { + serviceManager + .encryptionProtectors() + .revalidate(resourceGroupName, serverName, encryptionProtectorName, context); + } + + public EncryptionProtectorImpl withServerKeyName(String serverKeyName) { + this.innerModel().withServerKeyName(serverKeyName); + return this; + } + + public EncryptionProtectorImpl withServerKeyType(ServerKeyType serverKeyType) { + this.innerModel().withServerKeyType(serverKeyType); + return this; + } + + public EncryptionProtectorImpl withAutoRotationEnabled(Boolean autoRotationEnabled) { + this.innerModel().withAutoRotationEnabled(autoRotationEnabled); + 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..7d8f9351959e7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsClientImpl.java @@ -0,0 +1,1192 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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({"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({"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("{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 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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(); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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(); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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..33881e2f38dc8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsImpl.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.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; + +public final class EncryptionProtectorsImpl implements EncryptionProtectors { + private static 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 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 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 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/EndpointCertificateImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificateImpl.java new file mode 100644 index 0000000000000..7fff0e680d644 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificateImpl.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.EndpointCertificateInner; +import com.azure.resourcemanager.sql.generated.models.EndpointCertificate; + +public final class EndpointCertificateImpl implements EndpointCertificate { + private EndpointCertificateInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + EndpointCertificateImpl( + EndpointCertificateInner 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 publicBlob() { + return this.innerModel().publicBlob(); + } + + public EndpointCertificateInner 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/EndpointCertificatesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificatesClientImpl.java new file mode 100644 index 0000000000000..b66aeda7a7c88 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificatesClientImpl.java @@ -0,0 +1,543 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.EndpointCertificatesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.EndpointCertificateInner; +import com.azure.resourcemanager.sql.generated.models.EndpointCertificateListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EndpointCertificatesClient. */ +public final class EndpointCertificatesClientImpl implements EndpointCertificatesClient { + /** The proxy service used to perform REST calls. */ + private final EndpointCertificatesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of EndpointCertificatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EndpointCertificatesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(EndpointCertificatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientEndpointCertificates to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + private interface EndpointCertificatesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/endpointCertificates") + @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}/endpointCertificates/{endpointType}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("endpointType") String endpointType, + @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); + } + + /** + * List certificates used on endpoints on the target 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 endpoint certificates on the target instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2021-11-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())); + } + + /** + * List certificates used on endpoints on the target 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 endpoint certificates on the target instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2021-11-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)); + } + + /** + * List certificates used on endpoints on the target 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 endpoint certificates on the target instance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * List certificates used on endpoints on the target 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 endpoint certificates on the target instance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * List certificates used on endpoints on the target 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 endpoint certificates on the target instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * List certificates used on endpoints on the target 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 endpoint certificates on the target instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking 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 a certificate used on the endpoint with the given id along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String endpointType) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (endpointType == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointType is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + endpointType, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking 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 a certificate used on the endpoint with the given id along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String endpointType, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (endpointType == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointType is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + endpointType, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking 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 a certificate used on the endpoint with the given id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String endpointType) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, endpointType) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking 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 a certificate used on the endpoint with the given id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EndpointCertificateInner get(String resourceGroupName, String managedInstanceName, String endpointType) { + return getAsync(resourceGroupName, managedInstanceName, endpointType).block(); + } + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking 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 a certificate used on the endpoint with the given id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String endpointType, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, endpointType, 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 endpoint certificates on the target instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 endpoint certificates on the target instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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/EndpointCertificatesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificatesImpl.java new file mode 100644 index 0000000000000..b26245d31f6cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificatesImpl.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.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.EndpointCertificatesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.EndpointCertificateInner; +import com.azure.resourcemanager.sql.generated.models.EndpointCertificate; +import com.azure.resourcemanager.sql.generated.models.EndpointCertificates; + +public final class EndpointCertificatesImpl implements EndpointCertificates { + private static final ClientLogger LOGGER = new ClientLogger(EndpointCertificatesImpl.class); + + private final EndpointCertificatesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public EndpointCertificatesImpl( + EndpointCertificatesClient 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 EndpointCertificateImpl(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 EndpointCertificateImpl(inner1, this.manager())); + } + + public EndpointCertificate get(String resourceGroupName, String managedInstanceName, String endpointType) { + EndpointCertificateInner inner = this.serviceClient().get(resourceGroupName, managedInstanceName, endpointType); + if (inner != null) { + return new EndpointCertificateImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String endpointType, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, endpointType, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EndpointCertificateImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private EndpointCertificatesClient 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/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..ec20b71e3ec99 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesClientImpl.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.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.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 { + /** 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") + @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( + "/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("{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 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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 = "2021-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())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 = "2021-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)); + } + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2021-11-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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2021-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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(); + } + + /** + * 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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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..f15ac7659a6a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.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.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; + +public final class ExtendedDatabaseBlobAuditingPoliciesImpl implements ExtendedDatabaseBlobAuditingPolicies { + private static 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 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 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 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..04163996d63ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.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.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 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 Boolean isStorageSecondaryKeyInUse() { + return this.innerModel().isStorageSecondaryKeyInUse(); + } + + public Boolean isAzureMonitorTargetEnabled() { + return this.innerModel().isAzureMonitorTargetEnabled(); + } + + public Integer queueDelayMs() { + return this.innerModel().queueDelayMs(); + } + + public Boolean isManagedIdentityInUse() { + return this.innerModel().isManagedIdentityInUse(); + } + + 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 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 withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.innerModel().withAuditActionsAndGroups(auditActionsAndGroups); + 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; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.innerModel().withIsManagedIdentityInUse(isManagedIdentityInUse); + 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 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/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..afe2ec65ddbe8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesClientImpl.java @@ -0,0 +1,867 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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") + @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}/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("{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); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-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())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-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)); + } + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-11-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 the {@link PollerFlux} for polling of an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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(); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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..aaaebadba33c6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesImpl.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.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; + +public final class ExtendedServerBlobAuditingPoliciesImpl implements ExtendedServerBlobAuditingPolicies { + private static 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 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 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 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..774ea437ef55e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPolicyImpl.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.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 Boolean isDevopsAuditEnabled() { + return this.innerModel().isDevopsAuditEnabled(); + } + + public String predicateExpression() { + return this.innerModel().predicateExpression(); + } + + 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 Boolean isStorageSecondaryKeyInUse() { + return this.innerModel().isStorageSecondaryKeyInUse(); + } + + public Boolean isAzureMonitorTargetEnabled() { + return this.innerModel().isAzureMonitorTargetEnabled(); + } + + public Integer queueDelayMs() { + return this.innerModel().queueDelayMs(); + } + + public Boolean isManagedIdentityInUse() { + return this.innerModel().isManagedIdentityInUse(); + } + + 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 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 withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled) { + this.innerModel().withIsDevopsAuditEnabled(isDevopsAuditEnabled); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withPredicateExpression(String predicateExpression) { + this.innerModel().withPredicateExpression(predicateExpression); + 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 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; + } + + public ExtendedServerBlobAuditingPolicyImpl withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.innerModel().withIsManagedIdentityInUse(isManagedIdentityInUse); + 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 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/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..47908a6219a4c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupImpl.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights 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 FailoverGroup failover() { + return serviceManager.failoverGroups().failover(resourceGroupName, serverName, failoverGroupName); + } + + public FailoverGroup failover(Context context) { + return serviceManager.failoverGroups().failover(resourceGroupName, serverName, failoverGroupName, context); + } + + public FailoverGroup forceFailoverAllowDataLoss() { + return serviceManager + .failoverGroups() + .forceFailoverAllowDataLoss(resourceGroupName, serverName, failoverGroupName); + } + + public FailoverGroup forceFailoverAllowDataLoss(Context context) { + return serviceManager + .failoverGroups() + .forceFailoverAllowDataLoss(resourceGroupName, serverName, failoverGroupName, context); + } + + 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..c44aa0d136132 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsClientImpl.java @@ -0,0 +1,2078 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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)); + } + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..6af1ec7647736 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsImpl.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +public final class FailoverGroupsImpl implements FailoverGroups { + private static 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..383a7e2589d8b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRuleImpl.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.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 type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public String startIpAddress() { + return this.innerModel().startIpAddress(); + } + + public String endIpAddress() { + return this.innerModel().endIpAddress(); + } + + 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 withName(String name) { + this.innerModel().withName(name); + 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..aece2437b165e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesClientImpl.java @@ -0,0 +1,1115 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.FirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.FirewallRuleList; +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 { + /** 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"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @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}/firewallRules/{firewallRuleName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @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}/firewallRules") + @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"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/firewallRules") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> replace( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FirewallRuleList 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 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + 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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, firewallRuleName, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + 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 a server firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + 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 a server firewall rule on successful completion of {@link Mono}. + */ + @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 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 a server firewall rule along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 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 a list of firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 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 a list of firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 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 a list of firewall rules as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets 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 a list of firewall rules as paginated response with {@link PagedFlux}. + */ + @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 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 a list of firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets 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 a list of firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Replaces all firewall rules on the server. + * + * @param resourceGroupName The name of the resource group that contains 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 A list of server firewall rules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> replaceWithResponseAsync( + String resourceGroupName, String serverName, FirewallRuleList 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-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .replace( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Replaces all firewall rules on the server. + * + * @param resourceGroupName The name of the resource group that contains 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 A list of server firewall rules. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> replaceWithResponseAsync( + String resourceGroupName, String serverName, FirewallRuleList 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-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .replace( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Replaces all firewall rules on the server. + * + * @param resourceGroupName The name of the resource group that contains 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 A list of server firewall rules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono replaceAsync( + String resourceGroupName, String serverName, FirewallRuleList parameters) { + return replaceWithResponseAsync(resourceGroupName, serverName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Replaces all firewall rules on the server. + * + * @param resourceGroupName The name of the resource group that contains 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 A list of server firewall rules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner replace(String resourceGroupName, String serverName, FirewallRuleList parameters) { + return replaceAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * Replaces all firewall rules on the server. + * + * @param resourceGroupName The name of the resource group that contains 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 A list of server firewall rules. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response replaceWithResponse( + String resourceGroupName, String serverName, FirewallRuleList parameters, Context context) { + return replaceWithResponseAsync(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 the response to a list firewall rules request along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 response to a list firewall rules request along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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/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..f12b37823d4e2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesImpl.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.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.FirewallRuleList; +import com.azure.resourcemanager.sql.generated.models.FirewallRules; + +public final class FirewallRulesImpl implements FirewallRules { + private static 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 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 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 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 replace(String resourceGroupName, String serverName, FirewallRuleList parameters) { + FirewallRuleInner inner = this.serviceClient().replace(resourceGroupName, serverName, parameters); + if (inner != null) { + return new FirewallRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response replaceWithResponse( + String resourceGroupName, String serverName, FirewallRuleList parameters, Context context) { + Response inner = + this.serviceClient().replaceWithResponse(resourceGroupName, serverName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FirewallRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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); + } + + 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..cb3b2a0ae5dbd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesClientImpl.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.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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..097fad6c3bb5a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesImpl.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.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; + +public final class GeoBackupPoliciesImpl implements GeoBackupPolicies { + private static 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/IPv6FirewallRuleImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRuleImpl.java new file mode 100644 index 0000000000000..f8adfa0e334ff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRuleImpl.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.IPv6FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.IPv6FirewallRule; + +public final class IPv6FirewallRuleImpl + implements IPv6FirewallRule, IPv6FirewallRule.Definition, IPv6FirewallRule.Update { + private IPv6FirewallRuleInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public String startIPv6Address() { + return this.innerModel().startIPv6Address(); + } + + public String endIPv6Address() { + return this.innerModel().endIPv6Address(); + } + + public IPv6FirewallRuleInner 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 IPv6FirewallRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public IPv6FirewallRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getIPv6FirewallRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, firewallRuleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public IPv6FirewallRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIPv6FirewallRules() + .createOrUpdateWithResponse(resourceGroupName, serverName, firewallRuleName, this.innerModel(), context) + .getValue(); + return this; + } + + IPv6FirewallRuleImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new IPv6FirewallRuleInner(); + this.serviceManager = serviceManager; + this.firewallRuleName = name; + } + + public IPv6FirewallRuleImpl update() { + return this; + } + + public IPv6FirewallRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getIPv6FirewallRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, firewallRuleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public IPv6FirewallRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIPv6FirewallRules() + .createOrUpdateWithResponse(resourceGroupName, serverName, firewallRuleName, this.innerModel(), context) + .getValue(); + return this; + } + + IPv6FirewallRuleImpl( + IPv6FirewallRuleInner 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(), "ipv6FirewallRules"); + } + + public IPv6FirewallRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getIPv6FirewallRules() + .getWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE) + .getValue(); + return this; + } + + public IPv6FirewallRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIPv6FirewallRules() + .getWithResponse(resourceGroupName, serverName, firewallRuleName, context) + .getValue(); + return this; + } + + public IPv6FirewallRuleImpl withName(String name) { + this.innerModel().withName(name); + return this; + } + + public IPv6FirewallRuleImpl withStartIPv6Address(String startIPv6Address) { + this.innerModel().withStartIPv6Address(startIPv6Address); + return this; + } + + public IPv6FirewallRuleImpl withEndIPv6Address(String endIPv6Address) { + this.innerModel().withEndIPv6Address(endIPv6Address); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRulesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRulesClientImpl.java new file mode 100644 index 0000000000000..22982490f81b9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRulesClientImpl.java @@ -0,0 +1,926 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.IPv6FirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.IPv6FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.IPv6FirewallRuleListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IPv6FirewallRulesClient. */ +public final class IPv6FirewallRulesClientImpl implements IPv6FirewallRulesClient { + /** The proxy service used to perform REST calls. */ + private final IPv6FirewallRulesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of IPv6FirewallRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IPv6FirewallRulesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(IPv6FirewallRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientIPv6FirewallRules to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientI") + private interface IPv6FirewallRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/ipv6FirewallRules") + @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}/ipv6FirewallRules/{firewallRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @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}/ipv6FirewallRules/{firewallRuleName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") IPv6FirewallRuleInner 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}/ipv6FirewallRules/{firewallRuleName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @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 IPv6 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 a list of IPv6 firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2021-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 IPv6 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 a list of IPv6 firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2021-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 IPv6 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 a list of IPv6 firewall rules as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of IPv6 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 a list of IPv6 firewall rules as paginated response with {@link PagedFlux}. + */ + @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 IPv6 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 a list of IPv6 firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of IPv6 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 a list of IPv6 firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets an IPv6 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 an IPv6 firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an IPv6 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 an IPv6 firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets an IPv6 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 an IPv6 firewall rule on successful completion of {@link Mono}. + */ + @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 an IPv6 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 an IPv6 firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IPv6FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName) { + return getAsync(resourceGroupName, serverName, firewallRuleName).block(); + } + + /** + * Gets an IPv6 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 an IPv6 firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, firewallRuleName, context).block(); + } + + /** + * Creates or updates an IPv6 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 an IPv6 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 an IPv6 server firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, IPv6FirewallRuleInner 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 (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and 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 = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an IPv6 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 an IPv6 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 an IPv6 server firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String firewallRuleName, + IPv6FirewallRuleInner 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 (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and 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 = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates an IPv6 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 an IPv6 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 an IPv6 server firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String firewallRuleName, IPv6FirewallRuleInner 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 an IPv6 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 an IPv6 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 an IPv6 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IPv6FirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, IPv6FirewallRuleInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters).block(); + } + + /** + * Creates or updates an IPv6 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 an IPv6 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 an IPv6 server firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String firewallRuleName, + IPv6FirewallRuleInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters, context) + .block(); + } + + /** + * Deletes an IPv6 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an IPv6 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes an IPv6 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return deleteWithResponseAsync(resourceGroupName, serverName, firewallRuleName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an IPv6 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 an IPv6 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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, firewallRuleName, 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 IPv6 firewall rules request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 response to a list IPv6 firewall rules request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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/IPv6FirewallRulesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRulesImpl.java new file mode 100644 index 0000000000000..abcf04bda2716 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRulesImpl.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.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.IPv6FirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.IPv6FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.IPv6FirewallRule; +import com.azure.resourcemanager.sql.generated.models.IPv6FirewallRules; + +public final class IPv6FirewallRulesImpl implements IPv6FirewallRules { + private static final ClientLogger LOGGER = new ClientLogger(IPv6FirewallRulesImpl.class); + + private final IPv6FirewallRulesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public IPv6FirewallRulesImpl( + IPv6FirewallRulesClient 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 IPv6FirewallRuleImpl(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 IPv6FirewallRuleImpl(inner1, this.manager())); + } + + public IPv6FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName) { + IPv6FirewallRuleInner inner = this.serviceClient().get(resourceGroupName, serverName, firewallRuleName); + if (inner != null) { + return new IPv6FirewallRuleImpl(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 IPv6FirewallRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 IPv6FirewallRule 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, "ipv6FirewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ipv6FirewallRules'.", 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, "ipv6FirewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ipv6FirewallRules'.", 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, "ipv6FirewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ipv6FirewallRules'.", id))); + } + this.deleteWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String 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, "ipv6FirewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ipv6FirewallRules'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, firewallRuleName, context); + } + + private IPv6FirewallRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public IPv6FirewallRuleImpl define(String name) { + return new IPv6FirewallRuleImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportExtensionsOperationResultImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportExtensionsOperationResultImpl.java new file mode 100644 index 0000000000000..4bb59c0b8dcff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportExtensionsOperationResultImpl.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.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportExtensionsOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseExtensions; +import com.azure.resourcemanager.sql.generated.models.ImportExportExtensionsOperationResult; +import com.azure.resourcemanager.sql.generated.models.OperationMode; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; +import java.util.UUID; + +public final class ImportExportExtensionsOperationResultImpl + implements ImportExportExtensionsOperationResult, + ImportExportExtensionsOperationResult.Definition, + ImportExportExtensionsOperationResult.Update { + private ImportExportExtensionsOperationResultInner 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 UUID requestId() { + return this.innerModel().requestId(); + } + + public String requestType() { + return this.innerModel().requestType(); + } + + public String lastModifiedTime() { + return this.innerModel().lastModifiedTime(); + } + + 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 ImportExportExtensionsOperationResultInner 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 extensionName; + + private DatabaseExtensions createParameters; + + private DatabaseExtensions updateParameters; + + public ImportExportExtensionsOperationResultImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public ImportExportExtensionsOperationResult create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseExtensionsOperations() + .createOrUpdate( + resourceGroupName, serverName, databaseName, extensionName, createParameters, Context.NONE); + return this; + } + + public ImportExportExtensionsOperationResult create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseExtensionsOperations() + .createOrUpdate(resourceGroupName, serverName, databaseName, extensionName, createParameters, context); + return this; + } + + ImportExportExtensionsOperationResultImpl( + String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ImportExportExtensionsOperationResultInner(); + this.serviceManager = serviceManager; + this.extensionName = name; + this.createParameters = new DatabaseExtensions(); + } + + public ImportExportExtensionsOperationResultImpl update() { + this.updateParameters = new DatabaseExtensions(); + return this; + } + + public ImportExportExtensionsOperationResult apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseExtensionsOperations() + .createOrUpdate( + resourceGroupName, serverName, databaseName, extensionName, updateParameters, Context.NONE); + return this; + } + + public ImportExportExtensionsOperationResult apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseExtensionsOperations() + .createOrUpdate(resourceGroupName, serverName, databaseName, extensionName, updateParameters, context); + return this; + } + + ImportExportExtensionsOperationResultImpl( + ImportExportExtensionsOperationResultInner 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.extensionName = Utils.getValueFromIdByName(innerObject.id(), "extensions"); + } + + public ImportExportExtensionsOperationResultImpl withOperationMode(OperationMode operationMode) { + this.createParameters.withOperationMode(operationMode); + return this; + } + + public ImportExportExtensionsOperationResultImpl withStorageKeyType(StorageKeyType storageKeyType) { + this.createParameters.withStorageKeyType(storageKeyType); + return this; + } + + public ImportExportExtensionsOperationResultImpl withStorageKey(String storageKey) { + this.createParameters.withStorageKey(storageKey); + return this; + } + + public ImportExportExtensionsOperationResultImpl withStorageUri(String storageUri) { + this.createParameters.withStorageUri(storageUri); + 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/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..69e029cb0ac0c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupImpl.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 InstanceFailoverGroup failover() { + return serviceManager.instanceFailoverGroups().failover(resourceGroupName, locationName, failoverGroupName); + } + + public InstanceFailoverGroup failover(Context context) { + return serviceManager + .instanceFailoverGroups() + .failover(resourceGroupName, locationName, failoverGroupName, context); + } + + public InstanceFailoverGroup forceFailoverAllowDataLoss() { + return serviceManager + .instanceFailoverGroups() + .forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName); + } + + public InstanceFailoverGroup forceFailoverAllowDataLoss(Context context) { + return serviceManager + .instanceFailoverGroups() + .forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, context); + } + + 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..7c00c0a74e2d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsClientImpl.java @@ -0,0 +1,1787 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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-11-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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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..53a5c7d4567d1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsImpl.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.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; + +public final class InstanceFailoverGroupsImpl implements InstanceFailoverGroups { + private static 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..553c35f15028c --- /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 int 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(int 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..7d567d805f90b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsClientImpl.java @@ -0,0 +1,1587 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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-11-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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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-11-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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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..fbe12b649932d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsImpl.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.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; + +public final class InstancePoolsImpl implements InstancePools { + private static 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..78c2acd386191 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsClientImpl.java @@ -0,0 +1,1441 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..4ed99b679d33e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsImpl.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.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; + +public final class JobAgentsImpl implements JobAgents { + private static 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..9ef2933a78d6e --- /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.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 { + /** 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} + * on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} + * on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of + * {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..131b224a60c8e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsImpl.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.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; + +public final class JobCredentialsImpl implements JobCredentials { + private static 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); + } + + 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..a450e17eee812 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsClientImpl.java @@ -0,0 +1,2192 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..9ffa17167cde0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsImpl.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 java.time.OffsetDateTime; +import java.util.UUID; + +public final class JobExecutionsImpl implements JobExecutions { + private static 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..e6fedc1e6df67 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsClientImpl.java @@ -0,0 +1,869 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..468071db5abed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsImpl.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights 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 java.time.OffsetDateTime; +import java.util.UUID; + +public final class JobStepExecutionsImpl implements JobStepExecutions { + private static 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..badf369c51c5d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsClientImpl.java @@ -0,0 +1,1678 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..0306ab072bc79 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsImpl.java @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + +public final class JobStepsImpl implements JobSteps { + private static 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); + } + + 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..676ed89b05651 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsClientImpl.java @@ -0,0 +1,1476 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..244df326f6201 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsImpl.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.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 java.time.OffsetDateTime; +import java.util.UUID; + +public final class JobTargetExecutionsImpl implements JobTargetExecutions { + private static 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..c1347fd3b53ca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsClientImpl.java @@ -0,0 +1,1000 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..4a364251e2db8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsImpl.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.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; + +public final class JobTargetGroupsImpl implements JobTargetGroups { + private static 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); + } + + 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..91870edc33372 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsClientImpl.java @@ -0,0 +1,594 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..ce4c942694b75 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsImpl.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.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; + +public final class JobVersionsImpl implements JobVersions { + private static 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..923d364610335 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsClientImpl.java @@ -0,0 +1,976 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..9221fadb82e5e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsImpl.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.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; + +public final class JobsImpl implements Jobs { + private static 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); + } + + 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/LedgerDigestUploadsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsImpl.java new file mode 100644 index 0000000000000..5cc12604ffb45 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsImpl.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.LedgerDigestUploadsInner; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploads; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsState; + +public final class LedgerDigestUploadsImpl + implements LedgerDigestUploads, LedgerDigestUploads.Definition, LedgerDigestUploads.Update { + private LedgerDigestUploadsInner 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 digestStorageEndpoint() { + return this.innerModel().digestStorageEndpoint(); + } + + public LedgerDigestUploadsState state() { + return this.innerModel().state(); + } + + public LedgerDigestUploadsInner 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 LedgerDigestUploadsName ledgerDigestUploads; + + public LedgerDigestUploadsImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public LedgerDigestUploads create() { + this.innerObject = + serviceManager + .serviceClient() + .getLedgerDigestUploadsOperations() + .createOrUpdate( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, this.innerModel(), Context.NONE); + return this; + } + + public LedgerDigestUploads create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLedgerDigestUploadsOperations() + .createOrUpdate( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, this.innerModel(), context); + return this; + } + + LedgerDigestUploadsImpl( + LedgerDigestUploadsName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new LedgerDigestUploadsInner(); + this.serviceManager = serviceManager; + this.ledgerDigestUploads = name; + } + + public LedgerDigestUploadsImpl update() { + return this; + } + + public LedgerDigestUploads apply() { + this.innerObject = + serviceManager + .serviceClient() + .getLedgerDigestUploadsOperations() + .createOrUpdate( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, this.innerModel(), Context.NONE); + return this; + } + + public LedgerDigestUploads apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLedgerDigestUploadsOperations() + .createOrUpdate( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, this.innerModel(), context); + return this; + } + + LedgerDigestUploadsImpl( + LedgerDigestUploadsInner 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.ledgerDigestUploads = + LedgerDigestUploadsName.fromString(Utils.getValueFromIdByName(innerObject.id(), "ledgerDigestUploads")); + } + + public LedgerDigestUploads refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getLedgerDigestUploadsOperations() + .getWithResponse(resourceGroupName, serverName, databaseName, ledgerDigestUploads, Context.NONE) + .getValue(); + return this; + } + + public LedgerDigestUploads refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLedgerDigestUploadsOperations() + .getWithResponse(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context) + .getValue(); + return this; + } + + public LedgerDigestUploads disable() { + return serviceManager + .ledgerDigestUploadsOperations() + .disable(resourceGroupName, serverName, databaseName, ledgerDigestUploads); + } + + public LedgerDigestUploads disable(Context context) { + return serviceManager + .ledgerDigestUploadsOperations() + .disable(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context); + } + + public LedgerDigestUploadsImpl withDigestStorageEndpoint(String digestStorageEndpoint) { + this.innerModel().withDigestStorageEndpoint(digestStorageEndpoint); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsOperationsClientImpl.java new file mode 100644 index 0000000000000..7aad074623e09 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsOperationsClientImpl.java @@ -0,0 +1,1325 @@ +// Copyright (c) Microsoft Corporation. All rights 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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.LedgerDigestUploadsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LedgerDigestUploadsInner; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsListResult; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; +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 LedgerDigestUploadsOperationsClient. */ +public final class LedgerDigestUploadsOperationsClientImpl implements LedgerDigestUploadsOperationsClient { + /** The proxy service used to perform REST calls. */ + private final LedgerDigestUploadsOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of LedgerDigestUploadsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LedgerDigestUploadsOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + LedgerDigestUploadsOperationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientLedgerDigestUploadsOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientL") + private interface LedgerDigestUploadsOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("ledgerDigestUploads") LedgerDigestUploadsName ledgerDigestUploads, + @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}/ledgerDigestUploads/{ledgerDigestUploads}") + @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("ledgerDigestUploads") LedgerDigestUploadsName ledgerDigestUploads, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LedgerDigestUploadsInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/ledgerDigestUploads") + @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}/ledgerDigestUploads/{ledgerDigestUploads}/disable") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> disable( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("ledgerDigestUploads") LedgerDigestUploadsName ledgerDigestUploads, + @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 current ledger digest upload configuration 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 current ledger digest upload configuration for a database along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (ledgerDigestUploads == null) { + return Mono + .error(new IllegalArgumentException("Parameter ledgerDigestUploads is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + ledgerDigestUploads, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the current ledger digest upload configuration 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 current ledger digest upload configuration for a database along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (ledgerDigestUploads == null) { + return Mono + .error(new IllegalArgumentException("Parameter ledgerDigestUploads is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + ledgerDigestUploads, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets the current ledger digest upload configuration 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 current ledger digest upload configuration for a database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the current ledger digest upload configuration 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 current ledger digest upload configuration for a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LedgerDigestUploadsInner get( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + return getAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads).block(); + } + + /** + * Gets the current ledger digest upload configuration 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 current ledger digest upload configuration for a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context).block(); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload 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 azure SQL Database ledger digest upload settings along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner 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 (ledgerDigestUploads == null) { + return Mono + .error(new IllegalArgumentException("Parameter ledgerDigestUploads is required and 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 = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + ledgerDigestUploads, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload 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 azure SQL Database ledger digest upload settings along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner 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 (ledgerDigestUploads == null) { + return Mono + .error(new IllegalArgumentException("Parameter ledgerDigestUploads is required and 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 = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + ledgerDigestUploads, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload 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 the {@link PollerFlux} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LedgerDigestUploadsInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LedgerDigestUploadsInner.class, + LedgerDigestUploadsInner.class, + this.client.getContext()); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload 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 the {@link PollerFlux} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LedgerDigestUploadsInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LedgerDigestUploadsInner.class, + LedgerDigestUploadsInner.class, + context); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload 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 the {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LedgerDigestUploadsInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters) + .getSyncPoller(); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload 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 the {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LedgerDigestUploadsInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters, context) + .getSyncPoller(); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload 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 azure SQL Database ledger digest upload settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload 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 azure SQL Database ledger digest upload settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload 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 azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LedgerDigestUploadsInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters) + .block(); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload 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 azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LedgerDigestUploadsInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters, context) + .block(); + } + + /** + * Gets all ledger digest upload settings on 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 all ledger digest upload settings on a database along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 = "2021-02-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 all ledger digest upload settings on 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 all ledger digest upload settings on a database along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 = "2021-02-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 all ledger digest upload settings on 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 all ledger digest upload settings on a database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets all ledger digest upload settings on 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 all ledger digest upload settings on a database as paginated response with {@link PagedFlux}. + */ + @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 all ledger digest upload settings on 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 all ledger digest upload settings on a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets all ledger digest upload settings on 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 all ledger digest upload settings on a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 azure SQL Database ledger digest upload settings along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> disableWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (ledgerDigestUploads == null) { + return Mono + .error(new IllegalArgumentException("Parameter ledgerDigestUploads is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .disable( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + ledgerDigestUploads, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 azure SQL Database ledger digest upload settings along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> disableWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (ledgerDigestUploads == null) { + return Mono + .error(new IllegalArgumentException("Parameter ledgerDigestUploads is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .disable( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + ledgerDigestUploads, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 {@link PollerFlux} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LedgerDigestUploadsInner> beginDisableAsync( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + Mono>> mono = + disableWithResponseAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LedgerDigestUploadsInner.class, + LedgerDigestUploadsInner.class, + this.client.getContext()); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 {@link PollerFlux} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LedgerDigestUploadsInner> beginDisableAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + disableWithResponseAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LedgerDigestUploadsInner.class, + LedgerDigestUploadsInner.class, + context); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LedgerDigestUploadsInner> beginDisable( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + return beginDisableAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads).getSyncPoller(); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LedgerDigestUploadsInner> beginDisable( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + return beginDisableAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context) + .getSyncPoller(); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 azure SQL Database ledger digest upload settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono disableAsync( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + return beginDisableAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 azure SQL Database ledger digest upload settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono disableAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + return beginDisableAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LedgerDigestUploadsInner disable( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + return disableAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads).block(); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LedgerDigestUploadsInner disable( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + return disableAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, 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 ledger digest upload settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 ledger digest upload settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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/LedgerDigestUploadsOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsOperationsImpl.java new file mode 100644 index 0000000000000..1389aefbd2686 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsOperationsImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights 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.LedgerDigestUploadsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LedgerDigestUploadsInner; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploads; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsOperations; + +public final class LedgerDigestUploadsOperationsImpl implements LedgerDigestUploadsOperations { + private static final ClientLogger LOGGER = new ClientLogger(LedgerDigestUploadsOperationsImpl.class); + + private final LedgerDigestUploadsOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public LedgerDigestUploadsOperationsImpl( + LedgerDigestUploadsOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public LedgerDigestUploads get( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + LedgerDigestUploadsInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, ledgerDigestUploads); + if (inner != null) { + return new LedgerDigestUploadsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LedgerDigestUploadsImpl(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 LedgerDigestUploadsImpl(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 LedgerDigestUploadsImpl(inner1, this.manager())); + } + + public LedgerDigestUploads disable( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + LedgerDigestUploadsInner inner = + this.serviceClient().disable(resourceGroupName, serverName, databaseName, ledgerDigestUploads); + if (inner != null) { + return new LedgerDigestUploadsImpl(inner, this.manager()); + } else { + return null; + } + } + + public LedgerDigestUploads disable( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + LedgerDigestUploadsInner inner = + this.serviceClient().disable(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context); + if (inner != null) { + return new LedgerDigestUploadsImpl(inner, this.manager()); + } else { + return null; + } + } + + public LedgerDigestUploads 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))); + } + LedgerDigestUploadsName ledgerDigestUploads = + LedgerDigestUploadsName.fromString(Utils.getValueFromIdByName(id, "ledgerDigestUploads")); + if (ledgerDigestUploads == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ledgerDigestUploads'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, databaseName, ledgerDigestUploads, 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))); + } + LedgerDigestUploadsName ledgerDigestUploads = + LedgerDigestUploadsName.fromString(Utils.getValueFromIdByName(id, "ledgerDigestUploads")); + if (ledgerDigestUploads == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ledgerDigestUploads'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context); + } + + private LedgerDigestUploadsOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public LedgerDigestUploadsImpl define(LedgerDigestUploadsName name) { + return new LedgerDigestUploadsImpl(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/LogicalDatabaseTransparentDataEncryptionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LogicalDatabaseTransparentDataEncryptionImpl.java new file mode 100644 index 0000000000000..1416291ec304a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LogicalDatabaseTransparentDataEncryptionImpl.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.LogicalDatabaseTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.LogicalDatabaseTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; + +public final class LogicalDatabaseTransparentDataEncryptionImpl + implements LogicalDatabaseTransparentDataEncryption, + LogicalDatabaseTransparentDataEncryption.Definition, + LogicalDatabaseTransparentDataEncryption.Update { + private LogicalDatabaseTransparentDataEncryptionInner 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 TransparentDataEncryptionState state() { + return this.innerModel().state(); + } + + public LogicalDatabaseTransparentDataEncryptionInner 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 tdeName; + + public LogicalDatabaseTransparentDataEncryptionImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public LogicalDatabaseTransparentDataEncryption create() { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, tdeName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public LogicalDatabaseTransparentDataEncryption create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, tdeName, this.innerModel(), context) + .getValue(); + return this; + } + + LogicalDatabaseTransparentDataEncryptionImpl( + TransparentDataEncryptionName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new LogicalDatabaseTransparentDataEncryptionInner(); + this.serviceManager = serviceManager; + this.tdeName = name; + } + + public LogicalDatabaseTransparentDataEncryptionImpl update() { + return this; + } + + public LogicalDatabaseTransparentDataEncryption apply() { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, tdeName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public LogicalDatabaseTransparentDataEncryption apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, tdeName, this.innerModel(), context) + .getValue(); + return this; + } + + LogicalDatabaseTransparentDataEncryptionImpl( + LogicalDatabaseTransparentDataEncryptionInner 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.tdeName = + TransparentDataEncryptionName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "transparentDataEncryption")); + } + + public LogicalDatabaseTransparentDataEncryption refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .getWithResponse(resourceGroupName, serverName, databaseName, tdeName, Context.NONE) + .getValue(); + return this; + } + + public LogicalDatabaseTransparentDataEncryption refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .getWithResponse(resourceGroupName, serverName, databaseName, tdeName, context) + .getValue(); + return this; + } + + public LogicalDatabaseTransparentDataEncryptionImpl withState(TransparentDataEncryptionState 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/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..6b47aedd28e2e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsClientImpl.java @@ -0,0 +1,5402 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2021-05-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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2021-05-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 the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2021-05-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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2021-05-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 the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2021-05-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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2021-05-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 the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2021-05-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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2021-05-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 the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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..e5da4a1d07d84 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsImpl.java @@ -0,0 +1,514 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + +public final class LongTermRetentionBackupsImpl implements LongTermRetentionBackups { + private static 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..8d9c7c3b47d28 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsClientImpl.java @@ -0,0 +1,3409 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2021-05-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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2021-05-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 = "2021-05-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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 = "2021-05-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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 = "2021-05-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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 = "2021-05-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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 = "2021-05-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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 = "2021-05-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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2021-05-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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2021-05-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 = "2021-05-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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 = "2021-05-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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 = "2021-05-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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 = "2021-05-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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 = "2021-05-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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 = "2021-05-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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedFlux}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) as paginated response with {@link + * PagedIterable}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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..c543ed8cb15ab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsImpl.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.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; + +public final class LongTermRetentionManagedInstanceBackupsImpl implements LongTermRetentionManagedInstanceBackups { + private static 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..659470a8a1d7e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesClientImpl.java @@ -0,0 +1,972 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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..540a5733a9b7d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesImpl.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.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; + +public final class LongTermRetentionPoliciesImpl implements LongTermRetentionPolicies { + private static 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/MaintenanceWindowOptionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsImpl.java new file mode 100644 index 0000000000000..572dd71555098 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsImpl.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.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowOptionsInner; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowOptions; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import java.util.Collections; +import java.util.List; + +public final class MaintenanceWindowOptionsImpl implements MaintenanceWindowOptions { + private MaintenanceWindowOptionsInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + MaintenanceWindowOptionsImpl( + MaintenanceWindowOptionsInner 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 Boolean isEnabled() { + return this.innerModel().isEnabled(); + } + + public List maintenanceWindowCycles() { + List inner = this.innerModel().maintenanceWindowCycles(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Integer minDurationInMinutes() { + return this.innerModel().minDurationInMinutes(); + } + + public Integer defaultDurationInMinutes() { + return this.innerModel().defaultDurationInMinutes(); + } + + public Integer minCycles() { + return this.innerModel().minCycles(); + } + + public Integer timeGranularityInMinutes() { + return this.innerModel().timeGranularityInMinutes(); + } + + public Boolean allowMultipleMaintenanceWindowsPerCycle() { + return this.innerModel().allowMultipleMaintenanceWindowsPerCycle(); + } + + public MaintenanceWindowOptionsInner 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/MaintenanceWindowOptionsOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsOperationsClientImpl.java new file mode 100644 index 0000000000000..201443b9c4c16 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsOperationsClientImpl.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.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.resourcemanager.sql.generated.fluent.MaintenanceWindowOptionsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowOptionsInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MaintenanceWindowOptionsOperationsClient. + */ +public final class MaintenanceWindowOptionsOperationsClientImpl implements MaintenanceWindowOptionsOperationsClient { + /** The proxy service used to perform REST calls. */ + private final MaintenanceWindowOptionsOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of MaintenanceWindowOptionsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MaintenanceWindowOptionsOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + MaintenanceWindowOptionsOperationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientMaintenanceWindowOptionsOperations to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface MaintenanceWindowOptionsOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/maintenanceWindowOptions/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("maintenanceWindowOptionsName") String maintenanceWindowOptionsName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options 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 available maintenance windows along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowOptionsName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (maintenanceWindowOptionsName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter maintenanceWindowOptionsName is required and cannot be 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, + maintenanceWindowOptionsName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options 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 available maintenance windows along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowOptionsName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (maintenanceWindowOptionsName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter maintenanceWindowOptionsName is required and cannot be 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, + maintenanceWindowOptionsName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options 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 available maintenance windows on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowOptionsName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options 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 available maintenance windows. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MaintenanceWindowOptionsInner get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowOptionsName) { + return getAsync(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName).block(); + } + + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options 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 available maintenance windows along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowOptionsName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName, context) + .block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsOperationsImpl.java new file mode 100644 index 0000000000000..83c4e1c6a8a72 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsOperationsImpl.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.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.MaintenanceWindowOptionsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowOptionsInner; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowOptions; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowOptionsOperations; + +public final class MaintenanceWindowOptionsOperationsImpl implements MaintenanceWindowOptionsOperations { + private static final ClientLogger LOGGER = new ClientLogger(MaintenanceWindowOptionsOperationsImpl.class); + + private final MaintenanceWindowOptionsOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public MaintenanceWindowOptionsOperationsImpl( + MaintenanceWindowOptionsOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public MaintenanceWindowOptions get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowOptionsName) { + MaintenanceWindowOptionsInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName); + if (inner != null) { + return new MaintenanceWindowOptionsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowOptionsName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MaintenanceWindowOptionsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private MaintenanceWindowOptionsOperationsClient 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/MaintenanceWindowsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsImpl.java new file mode 100644 index 0000000000000..d42224fb1c7b0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsImpl.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.MaintenanceWindowsInner; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindows; +import java.util.Collections; +import java.util.List; + +public final class MaintenanceWindowsImpl implements MaintenanceWindows { + private MaintenanceWindowsInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + MaintenanceWindowsImpl( + MaintenanceWindowsInner 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 List timeRanges() { + List inner = this.innerModel().timeRanges(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MaintenanceWindowsInner 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/MaintenanceWindowsOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsOperationsClientImpl.java new file mode 100644 index 0000000000000..da76d5d7677d7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsOperationsClientImpl.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.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.resourcemanager.sql.generated.fluent.MaintenanceWindowsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MaintenanceWindowsOperationsClient. */ +public final class MaintenanceWindowsOperationsClientImpl implements MaintenanceWindowsOperationsClient { + /** The proxy service used to perform REST calls. */ + private final MaintenanceWindowsOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of MaintenanceWindowsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MaintenanceWindowsOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + MaintenanceWindowsOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientMaintenanceWindowsOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface MaintenanceWindowsOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/maintenanceWindows/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("maintenanceWindowName") String maintenanceWindowName, + @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"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/maintenanceWindows/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("maintenanceWindowName") String maintenanceWindowName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MaintenanceWindowsInner parameters, + Context context); + } + + /** + * Gets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to get maintenance windows for. + * @param maintenanceWindowName Maintenance window 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 maintenance windows settings for a database along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (maintenanceWindowName == null) { + return Mono + .error(new IllegalArgumentException("Parameter maintenanceWindowName is required and cannot be 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, + maintenanceWindowName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to get maintenance windows for. + * @param maintenanceWindowName Maintenance window 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 maintenance windows settings for a database along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (maintenanceWindowName == null) { + return Mono + .error(new IllegalArgumentException("Parameter maintenanceWindowName is required and cannot be 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, + maintenanceWindowName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to get maintenance windows for. + * @param maintenanceWindowName Maintenance window 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 maintenance windows settings for a database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to get maintenance windows for. + * @param maintenanceWindowName Maintenance window 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 maintenance windows settings for a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MaintenanceWindowsInner get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowName) { + return getAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName).block(); + } + + /** + * Gets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to get maintenance windows for. + * @param maintenanceWindowName Maintenance window 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 maintenance windows settings for a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName, context) + .block(); + } + + /** + * Sets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner 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 (maintenanceWindowName == null) { + return Mono + .error(new IllegalArgumentException("Parameter maintenanceWindowName is required and 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 + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + maintenanceWindowName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner 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 (maintenanceWindowName == null) { + return Mono + .error(new IllegalArgumentException("Parameter maintenanceWindowName is required and 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 + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + maintenanceWindowName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Sets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Sets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters) { + createOrUpdateAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters).block(); + } + + /** + * Sets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters, context) + .block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsOperationsImpl.java new file mode 100644 index 0000000000000..c078b1f81f66e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsOperationsImpl.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.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.MaintenanceWindowsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindows; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowsOperations; + +public final class MaintenanceWindowsOperationsImpl implements MaintenanceWindowsOperations { + private static final ClientLogger LOGGER = new ClientLogger(MaintenanceWindowsOperationsImpl.class); + + private final MaintenanceWindowsOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public MaintenanceWindowsOperationsImpl( + MaintenanceWindowsOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public MaintenanceWindows get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowName) { + MaintenanceWindowsInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, maintenanceWindowName); + if (inner != null) { + return new MaintenanceWindowsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, maintenanceWindowName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MaintenanceWindowsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters) { + this + .serviceClient() + .createOrUpdate(resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters); + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters, + Context context) { + return this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters, context); + } + + private MaintenanceWindowsOperationsClient 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/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..2f2d275b25a70 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesClientImpl.java @@ -0,0 +1,1407 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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..56192b3882c2f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesImpl.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.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; + +public final class ManagedBackupShortTermRetentionPoliciesImpl implements ManagedBackupShortTermRetentionPolicies { + private static 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/ManagedDatabaseColumnsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseColumnsClientImpl.java new file mode 100644 index 0000000000000..3670369c16f00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseColumnsClientImpl.java @@ -0,0 +1,1234 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.ManagedDatabaseColumnsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseColumnListResult; +import java.util.Collection; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseColumnsClient. */ +public final class ManagedDatabaseColumnsClientImpl implements ManagedDatabaseColumnsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseColumnsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseColumnsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseColumnsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ManagedDatabaseColumnsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseColumns to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedDatabaseColumnsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/columns") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @QueryParam(value = "schema", multipleQueryParams = true) List schema, + @QueryParam(value = "table", multipleQueryParams = true) List table, + @QueryParam(value = "column", multipleQueryParams = true) List column, + @QueryParam(value = "orderBy", multipleQueryParams = true) List orderBy, + @QueryParam("$skiptoken") String skiptoken, + @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}/schemas/{schemaName}/tables" + + "/{tableName}/columns") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTable( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @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}/schemas/{schemaName}/tables" + + "/{tableName}/columns/{columnName}") + @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("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> listByTableNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List managed database 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 schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point 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 database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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-11-01-preview"; + final String accept = "application/json"; + List schemaConverted = + Optional + .ofNullable(schema) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + List tableConverted = + Optional + .ofNullable(table) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + List columnConverted = + Optional + .ofNullable(column) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + List orderByConverted = + Optional + .ofNullable(orderBy) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaConverted, + tableConverted, + columnConverted, + orderByConverted, + skiptoken, + 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())); + } + + /** + * List managed database 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 schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point 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 database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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-11-01-preview"; + final String accept = "application/json"; + List schemaConverted = + Optional + .ofNullable(schema) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + List tableConverted = + Optional + .ofNullable(table) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + List columnConverted = + Optional + .ofNullable(column) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + List orderByConverted = + Optional + .ofNullable(orderBy) + .map(Collection::stream) + .orElseGet(Stream::empty) + .map((item) -> Objects.toString(item, "")) + .collect(Collectors.toList()); + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaConverted, + tableConverted, + columnConverted, + orderByConverted, + skiptoken, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List managed database 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 schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point 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 database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List managed database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + final List schema = null; + final List table = null; + final List column = null; + final List orderBy = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List managed database 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 schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point 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 database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, + managedInstanceName, + databaseName, + schema, + table, + column, + orderBy, + skiptoken, + context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * List managed database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + final List schema = null; + final List table = null; + final List column = null; + final List orderBy = null; + final String skiptoken = null; + return new PagedIterable<>( + listByDatabaseAsync( + resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken)); + } + + /** + * List managed database 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 schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point 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 database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + return new PagedIterable<>( + listByDatabaseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + schema, + table, + column, + orderBy, + skiptoken, + context)); + } + + /** + * List managed database 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 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 database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + 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 (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 (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 + .listByTable( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + 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())); + } + + /** + * List managed database 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 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 database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + 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 (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 (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 + .listByTable( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List managed database 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 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 database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTableAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String filter) { + return new PagedFlux<>( + () -> + listByTableSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter), + nextLink -> listByTableNextSinglePageAsync(nextLink)); + } + + /** + * List managed database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTableAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName) { + final String filter = null; + return new PagedFlux<>( + () -> + listByTableSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter), + nextLink -> listByTableNextSinglePageAsync(nextLink)); + } + + /** + * List managed database 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 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 database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTableAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listByTableSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter, context), + nextLink -> listByTableNextSinglePageAsync(nextLink, context)); + } + + /** + * List managed database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTable( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName) { + final String filter = null; + return new PagedIterable<>( + listByTableAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter)); + } + + /** + * List managed database 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 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 database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTable( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context) { + return new PagedIterable<>( + listByTableAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter, context)); + } + + /** + * Get managed database 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 managed database column along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get managed database 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 managed database column along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get managed database 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 managed database column on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get managed database 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 managed database column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseColumnInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return getAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName) + .block(); + } + + /** + * Get managed database 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 managed database column along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, 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 database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableNextSinglePageAsync(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.listByTableNext(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 columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableNextSinglePageAsync(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 + .listByTableNext(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/ManagedDatabaseColumnsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseColumnsImpl.java new file mode 100644 index 0000000000000..72bb7ed0b5d49 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseColumnsImpl.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.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.ManagedDatabaseColumnsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseColumn; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseColumns; +import java.util.List; + +public final class ManagedDatabaseColumnsImpl implements ManagedDatabaseColumns { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseColumnsImpl.class); + + private final ManagedDatabaseColumnsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseColumnsImpl( + ManagedDatabaseColumnsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase( + resourceGroupName, + managedInstanceName, + databaseName, + schema, + table, + column, + orderBy, + skiptoken, + context); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public PagedIterable listByTable( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName) { + PagedIterable inner = + this + .serviceClient() + .listByTable(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public PagedIterable listByTable( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByTable( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter, context); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public DatabaseColumn get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + DatabaseColumnInner inner = + this + .serviceClient() + .get(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + if (inner != null) { + return new DatabaseColumnImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseColumnImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ManagedDatabaseColumnsClient 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/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..1725d1561d5c5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseImpl.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.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.CompleteDatabaseRestoreDefinition; +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 void completeRestore(CompleteDatabaseRestoreDefinition parameters) { + serviceManager + .managedDatabases() + .completeRestore(resourceGroupName, managedInstanceName, databaseName, parameters); + } + + public void completeRestore(CompleteDatabaseRestoreDefinition parameters, Context context) { + serviceManager + .managedDatabases() + .completeRestore(resourceGroupName, managedInstanceName, databaseName, parameters, context); + } + + 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) { + this.innerModel().withCollation(collation); + return this; + } + + public ManagedDatabaseImpl withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.innerModel().withRestorePointInTime(restorePointInTime); + return this; + } + + public ManagedDatabaseImpl withCatalogCollation(CatalogCollationType catalogCollation) { + this.innerModel().withCatalogCollation(catalogCollation); + return this; + } + + public ManagedDatabaseImpl withCreateMode(ManagedDatabaseCreateMode createMode) { + this.innerModel().withCreateMode(createMode); + return this; + } + + public ManagedDatabaseImpl withStorageContainerUri(String storageContainerUri) { + this.innerModel().withStorageContainerUri(storageContainerUri); + return this; + } + + public ManagedDatabaseImpl withSourceDatabaseId(String sourceDatabaseId) { + this.innerModel().withSourceDatabaseId(sourceDatabaseId); + return this; + } + + public ManagedDatabaseImpl withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.innerModel().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + return this; + } + + public ManagedDatabaseImpl withStorageContainerSasToken(String storageContainerSasToken) { + this.innerModel().withStorageContainerSasToken(storageContainerSasToken); + return this; + } + + public ManagedDatabaseImpl withRecoverableDatabaseId(String recoverableDatabaseId) { + this.innerModel().withRecoverableDatabaseId(recoverableDatabaseId); + return this; + } + + public ManagedDatabaseImpl withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.innerModel().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + return this; + } + + public ManagedDatabaseImpl withAutoCompleteRestore(Boolean autoCompleteRestore) { + this.innerModel().withAutoCompleteRestore(autoCompleteRestore); + return this; + } + + public ManagedDatabaseImpl withLastBackupName(String lastBackupName) { + this.innerModel().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/ManagedDatabaseQueriesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseQueriesClientImpl.java new file mode 100644 index 0000000000000..cfd3179dba4f4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseQueriesClientImpl.java @@ -0,0 +1,688 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.ManagedDatabaseQueriesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceQueryInner; +import com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceQueryStatistics; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseQueriesClient. */ +public final class ManagedDatabaseQueriesClientImpl implements ManagedDatabaseQueriesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseQueriesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseQueriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseQueriesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ManagedDatabaseQueriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseQueries to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedDatabaseQueriesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/queries/{queryId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("queryId") String queryId, + @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}/queries/{queryId}/statistics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByQuery( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("queryId") String queryId, + @QueryParam("startTime") String startTime, + @QueryParam("endTime") String endTime, + @QueryParam("interval") QueryTimeGrainType interval, + @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> listByQueryNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId 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 query by query id along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (queryId == null) { + return Mono.error(new IllegalArgumentException("Parameter queryId is required and cannot be 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, + managedInstanceName, + databaseName, + queryId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId 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 query by query id along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (queryId == null) { + return Mono.error(new IllegalArgumentException("Parameter queryId is required and cannot be 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, + managedInstanceName, + databaseName, + queryId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId 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 query by query id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, queryId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId 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 query by query id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceQueryInner get( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId) { + return getAsync(resourceGroupName, managedInstanceName, databaseName, queryId).block(); + } + + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId 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 query by query id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, queryId, context).block(); + } + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByQuerySinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (queryId == null) { + return Mono.error(new IllegalArgumentException("Parameter queryId is required and cannot be 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 + .listByQuery( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + queryId, + startTime, + endTime, + interval, + 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 query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByQuerySinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (queryId == null) { + return Mono.error(new IllegalArgumentException("Parameter queryId is required and cannot be 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 + .listByQuery( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + queryId, + startTime, + endTime, + interval, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByQueryAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval) { + return new PagedFlux<>( + () -> + listByQuerySinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval), + nextLink -> listByQueryNextSinglePageAsync(nextLink)); + } + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId 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 query execution statistics by query id as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByQueryAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId) { + final String startTime = null; + final String endTime = null; + final QueryTimeGrainType interval = null; + return new PagedFlux<>( + () -> + listByQuerySinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval), + nextLink -> listByQueryNextSinglePageAsync(nextLink)); + } + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByQueryAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval, + Context context) { + return new PagedFlux<>( + () -> + listByQuerySinglePageAsync( + resourceGroupName, + managedInstanceName, + databaseName, + queryId, + startTime, + endTime, + interval, + context), + nextLink -> listByQueryNextSinglePageAsync(nextLink, context)); + } + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId 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 query execution statistics by query id as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByQuery( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId) { + final String startTime = null; + final String endTime = null; + final QueryTimeGrainType interval = null; + return new PagedIterable<>( + listByQueryAsync( + resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval)); + } + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByQuery( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval, + Context context) { + return new PagedIterable<>( + listByQueryAsync( + resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval, 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 execution statistics for one particular query along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByQueryNextSinglePageAsync(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.listByQueryNext(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 execution statistics for one particular query along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByQueryNextSinglePageAsync(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 + .listByQueryNext(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/ManagedDatabaseQueriesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseQueriesImpl.java new file mode 100644 index 0000000000000..a026f4ec8f704 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseQueriesImpl.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.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.ManagedDatabaseQueriesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceQueryInner; +import com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseQueries; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceQuery; +import com.azure.resourcemanager.sql.generated.models.QueryStatistics; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; + +public final class ManagedDatabaseQueriesImpl implements ManagedDatabaseQueries { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseQueriesImpl.class); + + private final ManagedDatabaseQueriesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseQueriesImpl( + ManagedDatabaseQueriesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedInstanceQuery get( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId) { + ManagedInstanceQueryInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, queryId); + if (inner != null) { + return new ManagedInstanceQueryImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, queryId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceQueryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByQuery( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId) { + PagedIterable inner = + this.serviceClient().listByQuery(resourceGroupName, managedInstanceName, databaseName, queryId); + return Utils.mapPage(inner, inner1 -> new QueryStatisticsImpl(inner1, this.manager())); + } + + public PagedIterable listByQuery( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByQuery( + resourceGroupName, + managedInstanceName, + databaseName, + queryId, + startTime, + endTime, + interval, + context); + return Utils.mapPage(inner, inner1 -> new QueryStatisticsImpl(inner1, this.manager())); + } + + private ManagedDatabaseQueriesClient 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/ManagedDatabaseRecommendedSensitivityLabelsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRecommendedSensitivityLabelsClientImpl.java new file mode 100644 index 0000000000000..09c7acd34a6fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRecommendedSensitivityLabelsClientImpl.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.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.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.resourcemanager.sql.generated.fluent.ManagedDatabaseRecommendedSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseRecommendedSensitivityLabelsClient. + */ +public final class ManagedDatabaseRecommendedSensitivityLabelsClientImpl + implements ManagedDatabaseRecommendedSensitivityLabelsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseRecommendedSensitivityLabelsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseRecommendedSensitivityLabelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseRecommendedSensitivityLabelsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseRecommendedSensitivityLabelsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseRecommendedSensitivityLabels to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedDatabaseRecommendedSensitivityLabelsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/recommendedSensitivityLabels") + @ExpectedResponses({200}) + @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") RecommendedSensitivityLabelUpdateList parameters, + Context context); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList 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-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList 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-11-01-preview"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters) { + return updateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters) { + updateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).block(); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRecommendedSensitivityLabelsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRecommendedSensitivityLabelsImpl.java new file mode 100644 index 0000000000000..2a7eb070d275c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRecommendedSensitivityLabelsImpl.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.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseRecommendedSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRecommendedSensitivityLabels; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; + +public final class ManagedDatabaseRecommendedSensitivityLabelsImpl + implements ManagedDatabaseRecommendedSensitivityLabels { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseRecommendedSensitivityLabelsImpl.class); + + private final ManagedDatabaseRecommendedSensitivityLabelsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseRecommendedSensitivityLabelsImpl( + ManagedDatabaseRecommendedSensitivityLabelsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters) { + this.serviceClient().update(resourceGroupName, managedInstanceName, databaseName, parameters); + } + + public Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context) { + return this + .serviceClient() + .updateWithResponse(resourceGroupName, managedInstanceName, databaseName, parameters, context); + } + + private ManagedDatabaseRecommendedSensitivityLabelsClient 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/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..437d12c4593e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsClientImpl.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.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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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..984a0134b195d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsImpl.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.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; + +public final class ManagedDatabaseRestoreDetailsImpl implements ManagedDatabaseRestoreDetails { + private static 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/ManagedDatabaseSchemasClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSchemasClientImpl.java new file mode 100644 index 0000000000000..331899628f8a0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSchemasClientImpl.java @@ -0,0 +1,598 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.ManagedDatabaseSchemasClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSchemaListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseSchemasClient. */ +public final class ManagedDatabaseSchemasClientImpl implements ManagedDatabaseSchemasClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseSchemasService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseSchemasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseSchemasClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ManagedDatabaseSchemasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseSchemas to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedDatabaseSchemasService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @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}/schemas/{schemaName}") + @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("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); + } + + /** + * List managed 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 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 a list of database schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + 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 = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + 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())); + } + + /** + * List managed 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 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 a list of database schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + 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 = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + 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)); + } + + /** + * List managed 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 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 a list of database schemas as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String filter) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, filter), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List managed 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 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 list of database schemas as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String filter = null; + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, filter), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List managed 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 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 a list of database schemas as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, filter, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * List managed 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 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 list of database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String filter = null; + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, filter)); + } + + /** + * List managed 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 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 a list of database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context) { + return new PagedIterable<>( + listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, filter, context)); + } + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 schema along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (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, + managedInstanceName, + databaseName, + schemaName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 schema along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (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, + managedInstanceName, + databaseName, + schemaName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 schema on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 schema. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSchemaInner get( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName) { + return getAsync(resourceGroupName, managedInstanceName, databaseName, schemaName).block(); + } + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 schema along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, 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 database schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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/ManagedDatabaseSchemasImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSchemasImpl.java new file mode 100644 index 0000000000000..8b40669741cee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSchemasImpl.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.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.ManagedDatabaseSchemasClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSchema; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSchemas; + +public final class ManagedDatabaseSchemasImpl implements ManagedDatabaseSchemas { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseSchemasImpl.class); + + private final ManagedDatabaseSchemasClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseSchemasImpl( + ManagedDatabaseSchemasClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseSchemaImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName, filter, context); + return Utils.mapPage(inner, inner1 -> new DatabaseSchemaImpl(inner1, this.manager())); + } + + public DatabaseSchema get( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName) { + DatabaseSchemaInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, schemaName); + if (inner != null) { + return new DatabaseSchemaImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, schemaName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseSchemaImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ManagedDatabaseSchemasClient 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/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..3e121228b3bff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,863 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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..d2cda1088ba95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.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.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; + +public final class ManagedDatabaseSecurityAlertPoliciesImpl implements ManagedDatabaseSecurityAlertPolicies { + private static 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/ManagedDatabaseSecurityEventsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityEventsClientImpl.java new file mode 100644 index 0000000000000..caa737da89dcb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityEventsClientImpl.java @@ -0,0 +1,469 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.ManagedDatabaseSecurityEventsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SecurityEventInner; +import com.azure.resourcemanager.sql.generated.models.SecurityEventCollection; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseSecurityEventsClient. */ +public final class ManagedDatabaseSecurityEventsClientImpl implements ManagedDatabaseSecurityEventsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseSecurityEventsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseSecurityEventsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseSecurityEventsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseSecurityEventsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseSecurityEvents to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedDatabaseSecurityEventsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/securityEvents") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @QueryParam("$filter") String filter, + @QueryParam("$skip") Integer skip, + @QueryParam("$top") Integer top, + @QueryParam("$skiptoken") String skiptoken, + @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 list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @param filter An OData filter expression that filters elements in the collection. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point 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 security events along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + filter, + skip, + top, + skiptoken, + 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 security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @param filter An OData filter expression that filters elements in the collection. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point 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 security events along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + filter, + skip, + top, + skiptoken, + 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 security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @param filter An OData filter expression that filters elements in the collection. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point 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 security events as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events 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 a list of security events as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String filter = null; + final Integer skip = null; + final Integer top = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @param filter An OData filter expression that filters elements in the collection. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point 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 security events as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken, + Context context) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events 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 a list of security events as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String filter = null; + final Integer skip = null; + final Integer top = null; + final String skiptoken = null; + return new PagedIterable<>( + listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken)); + } + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @param filter An OData filter expression that filters elements in the collection. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point 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 security events as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken, + Context context) { + return new PagedIterable<>( + listByDatabaseAsync( + resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken, 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 security events along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 security events along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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/ManagedDatabaseSecurityEventsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityEventsImpl.java new file mode 100644 index 0000000000000..fc68ef703a88f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityEventsImpl.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.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSecurityEventsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SecurityEventInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityEvents; +import com.azure.resourcemanager.sql.generated.models.SecurityEvent; + +public final class ManagedDatabaseSecurityEventsImpl implements ManagedDatabaseSecurityEvents { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseSecurityEventsImpl.class); + + private final ManagedDatabaseSecurityEventsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseSecurityEventsImpl( + ManagedDatabaseSecurityEventsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new SecurityEventImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase( + resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken, context); + return Utils.mapPage(inner, inner1 -> new SecurityEventImpl(inner1, this.manager())); + } + + private ManagedDatabaseSecurityEventsClient 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/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..e0ead2dec613a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsClientImpl.java @@ -0,0 +1,2473 @@ +// Copyright (c) Microsoft Corporation. All rights 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.util.Context; +import com.azure.core.util.FluxUtil; +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 com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; +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 { + /** 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("$skipToken") String skipToken, + @QueryParam("$count") Boolean count, + @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"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/currentSensitivityLabels") + @ExpectedResponses({200}) + @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") SensitivityLabelUpdateList parameters, + 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("$skipToken") String skipToken, + @QueryParam("includeDisabledRecommendations") Boolean includeDisabledRecommendations, + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 skipToken The skipToken parameter. + * @param count The count 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + 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 = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCurrentByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + count, + 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 skipToken The skipToken parameter. + * @param count The count 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + 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 = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCurrentByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + count, + 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 skipToken The skipToken parameter. + * @param count The count 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + String filter) { + return new PagedFlux<>( + () -> + listCurrentByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, skipToken, count, 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String skipToken = null; + final Boolean count = null; + final String filter = null; + return new PagedFlux<>( + () -> + listCurrentByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, skipToken, count, 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 skipToken The skipToken parameter. + * @param count The count 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listCurrentByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, skipToken, count, 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCurrentByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String skipToken = null; + final Boolean count = null; + final String filter = null; + return new PagedIterable<>( + listCurrentByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, skipToken, count, 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 skipToken The skipToken parameter. + * @param count The count 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCurrentByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context) { + return new PagedIterable<>( + listCurrentByDatabaseAsync( + resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter, context)); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList 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-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList 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-11-01-preview"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters) { + return updateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters) { + updateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).block(); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters, 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 skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + 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 = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listRecommendedByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + 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 skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + 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 = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRecommendedByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + 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 skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter) { + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String skipToken = null; + final Boolean includeDisabledRecommendations = null; + final String filter = null; + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + 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 skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String skipToken = null; + final Boolean includeDisabledRecommendations = null; + final String filter = null; + return new PagedIterable<>( + listRecommendedByDatabaseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + 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 skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context) { + return new PagedIterable<>( + listRecommendedByDatabaseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..04f820f01d0d6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsImpl.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.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.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; + +public final class ManagedDatabaseSensitivityLabelsImpl implements ManagedDatabaseSensitivityLabels { + private static 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 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 skipToken, + Boolean count, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listCurrentByDatabase( + resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter, context); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public void update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters) { + this.serviceClient().update(resourceGroupName, managedInstanceName, databaseName, parameters); + } + + public Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters, + Context context) { + return this + .serviceClient() + .updateWithResponse(resourceGroupName, managedInstanceName, databaseName, parameters, context); + } + + 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, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listRecommendedByDatabase( + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + filter, + context); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + 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))); + } + 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, managedInstanceName, databaseName, schemaName, tableName, columnName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String 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))); + } + 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, managedInstanceName, databaseName, schemaName, tableName, columnName, context); + } + + private ManagedDatabaseSensitivityLabelsClient 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/ManagedDatabaseTablesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTablesClientImpl.java new file mode 100644 index 0000000000000..6bdace873e5c9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTablesClientImpl.java @@ -0,0 +1,670 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.ManagedDatabaseTablesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseTableListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseTablesClient. */ +public final class ManagedDatabaseTablesClientImpl implements ManagedDatabaseTablesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseTablesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseTablesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseTablesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ManagedDatabaseTablesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseTables to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedDatabaseTablesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySchema( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @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}/schemas/{schemaName}/tables" + + "/{tableName}") + @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("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> listBySchemaNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 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 database tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, 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 (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be 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 + .listBySchema( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + 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())); + } + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 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 database tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + 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 (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be 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 + .listBySchema( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 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 database tables as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String filter) { + return new PagedFlux<>( + () -> listBySchemaSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, filter), + nextLink -> listBySchemaNextSinglePageAsync(nextLink)); + } + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 tables as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName) { + final String filter = null; + return new PagedFlux<>( + () -> listBySchemaSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, filter), + nextLink -> listBySchemaNextSinglePageAsync(nextLink)); + } + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 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 database tables as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listBySchemaSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, filter, context), + nextLink -> listBySchemaNextSinglePageAsync(nextLink, context)); + } + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySchema( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName) { + final String filter = null; + return new PagedIterable<>( + listBySchemaAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, filter)); + } + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 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 database tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySchema( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String filter, + Context context) { + return new PagedIterable<>( + listBySchemaAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, filter, context)); + } + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 table along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (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, + managedInstanceName, + databaseName, + schemaName, + tableName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 table along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (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, + managedInstanceName, + databaseName, + schemaName, + tableName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 table on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseTableInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName) { + return getAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName).block(); + } + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 table along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + Context context) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, 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 database tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaNextSinglePageAsync(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.listBySchemaNext(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 tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaNextSinglePageAsync(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 + .listBySchemaNext(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/ManagedDatabaseTablesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTablesImpl.java new file mode 100644 index 0000000000000..4d8b936a76e05 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTablesImpl.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.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.ManagedDatabaseTablesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseTable; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseTables; + +public final class ManagedDatabaseTablesImpl implements ManagedDatabaseTables { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseTablesImpl.class); + + private final ManagedDatabaseTablesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseTablesImpl( + ManagedDatabaseTablesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySchema( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName) { + PagedIterable inner = + this.serviceClient().listBySchema(resourceGroupName, managedInstanceName, databaseName, schemaName); + return Utils.mapPage(inner, inner1 -> new DatabaseTableImpl(inner1, this.manager())); + } + + public PagedIterable listBySchema( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listBySchema(resourceGroupName, managedInstanceName, databaseName, schemaName, filter, context); + return Utils.mapPage(inner, inner1 -> new DatabaseTableImpl(inner1, this.manager())); + } + + public DatabaseTable get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName) { + DatabaseTableInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName); + if (inner != null) { + return new DatabaseTableImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseTableImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ManagedDatabaseTablesClient 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/ManagedDatabaseTransparentDataEncryptionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTransparentDataEncryptionsClientImpl.java new file mode 100644 index 0000000000000..1af234bda46b9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTransparentDataEncryptionsClientImpl.java @@ -0,0 +1,853 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.ManagedDatabaseTransparentDataEncryptionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.ManagedTransparentDataEncryptionListResult; +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 + * ManagedDatabaseTransparentDataEncryptionsClient. + */ +public final class ManagedDatabaseTransparentDataEncryptionsClientImpl + implements ManagedDatabaseTransparentDataEncryptionsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseTransparentDataEncryptionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseTransparentDataEncryptionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseTransparentDataEncryptionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseTransparentDataEncryptionsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseTransparentDataEncryptions to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedDatabaseTransparentDataEncryptionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/transparentDataEncryption" + + "/{tdeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("tdeName") TransparentDataEncryptionName tdeName, + @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}/transparentDataEncryption" + + "/{tdeName}") + @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("tdeName") TransparentDataEncryptionName tdeName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedTransparentDataEncryptionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/transparentDataEncryption") + @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 transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName 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 managed database's transparent data encryption along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and cannot be 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, + managedInstanceName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName 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 managed database's transparent data encryption along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and cannot be 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, + managedInstanceName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName 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 managed database's transparent data encryption on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, tdeName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName 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 managed database's transparent data encryption. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedTransparentDataEncryptionInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName) { + return getAsync(resourceGroupName, managedInstanceName, databaseName, tdeName).block(); + } + + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName 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 managed database's transparent data encryption along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, tdeName, context).block(); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database 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 a managed database transparent data encryption state along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + ManagedTransparentDataEncryptionInner 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 (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and 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, + managedInstanceName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database 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 a managed database transparent data encryption state along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + ManagedTransparentDataEncryptionInner 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 (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and 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, + managedInstanceName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database 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 a managed database transparent data encryption state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + ManagedTransparentDataEncryptionInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, tdeName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database 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 a managed database transparent data encryption state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedTransparentDataEncryptionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + ManagedTransparentDataEncryptionInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, tdeName, parameters).block(); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database 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 a managed database transparent data encryption state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + ManagedTransparentDataEncryptionInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, tdeName, parameters, context) + .block(); + } + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption 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 managed database's transparent data encryptions along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption 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 managed database's transparent data encryptions along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption 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 managed database's transparent data encryptions as paginated response with {@link PagedFlux}. + */ + @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 transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption 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 managed database's transparent data encryptions as paginated response with {@link PagedFlux}. + */ + @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 transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption 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 managed database's transparent data encryptions as paginated response with {@link + * PagedIterable}. + */ + @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 transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption 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 managed database's transparent data encryptions as paginated response with {@link + * PagedIterable}. + */ + @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 managed transparent data encryptions along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 managed transparent data encryptions along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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/ManagedDatabaseTransparentDataEncryptionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTransparentDataEncryptionsImpl.java new file mode 100644 index 0000000000000..febff1c08849c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTransparentDataEncryptionsImpl.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.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.ManagedDatabaseTransparentDataEncryptionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseTransparentDataEncryptions; +import com.azure.resourcemanager.sql.generated.models.ManagedTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +public final class ManagedDatabaseTransparentDataEncryptionsImpl implements ManagedDatabaseTransparentDataEncryptions { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseTransparentDataEncryptionsImpl.class); + + private final ManagedDatabaseTransparentDataEncryptionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseTransparentDataEncryptionsImpl( + ManagedDatabaseTransparentDataEncryptionsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedTransparentDataEncryption get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName) { + ManagedTransparentDataEncryptionInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, tdeName); + if (inner != null) { + return new ManagedTransparentDataEncryptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, tdeName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedTransparentDataEncryptionImpl(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 ManagedTransparentDataEncryptionImpl(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 ManagedTransparentDataEncryptionImpl(inner1, this.manager())); + } + + public ManagedTransparentDataEncryption 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))); + } + TransparentDataEncryptionName tdeName = + TransparentDataEncryptionName.fromString(Utils.getValueFromIdByName(id, "transparentDataEncryption")); + if (tdeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'transparentDataEncryption'.", + id))); + } + return this + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, tdeName, 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))); + } + TransparentDataEncryptionName tdeName = + TransparentDataEncryptionName.fromString(Utils.getValueFromIdByName(id, "transparentDataEncryption")); + if (tdeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'transparentDataEncryption'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, databaseName, tdeName, context); + } + + private ManagedDatabaseTransparentDataEncryptionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedTransparentDataEncryptionImpl define(TransparentDataEncryptionName name) { + return new ManagedTransparentDataEncryptionImpl(name, this.manager()); + } +} 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..3653499c3624a --- /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.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 { + /** 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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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..20d6c56386cc7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.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.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; + +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl + implements ManagedDatabaseVulnerabilityAssessmentRuleBaselines { + private static 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..04dc09e97d079 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansClientImpl.java @@ -0,0 +1,1320 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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({"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( + "/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({"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); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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(); + } + + /** + * 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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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(); + } + + /** + * 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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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..7f0aa784d8184 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.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.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; + +public final class ManagedDatabaseVulnerabilityAssessmentScansImpl + implements ManagedDatabaseVulnerabilityAssessmentScans { + private static 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 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; + } + } + + 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; + } + } + + 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..3a5c6577e9fc0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsClientImpl.java @@ -0,0 +1,1083 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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..6912a37ab7fc7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.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.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; + +public final class ManagedDatabaseVulnerabilityAssessmentsImpl implements ManagedDatabaseVulnerabilityAssessments { + private static 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..060d41b4cf64a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesClientImpl.java @@ -0,0 +1,2136 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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-11-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 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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-11-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 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 the {@link PollerFlux} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 the {@link PollerFlux} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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-11-01-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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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-11-01-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 as paginated response with {@link + * PagedFlux}. + */ + @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 as paginated response with {@link + * PagedFlux}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..075a8e4f5e089 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesImpl.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.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; + +public final class ManagedDatabasesImpl implements ManagedDatabases { + private static 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..1a56aa9f29d12 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorImpl.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.ManagedInstanceAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +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; + + private AdministratorName administratorName; + + 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, administratorName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceAdministrator create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .createOrUpdate(resourceGroupName, managedInstanceName, administratorName, this.innerModel(), context); + return this; + } + + ManagedInstanceAdministratorImpl( + AdministratorName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceAdministratorInner(); + this.serviceManager = serviceManager; + this.administratorName = name; + } + + public ManagedInstanceAdministratorImpl update() { + return this; + } + + public ManagedInstanceAdministrator apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .createOrUpdate( + resourceGroupName, managedInstanceName, administratorName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceAdministrator apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .createOrUpdate(resourceGroupName, managedInstanceName, administratorName, 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"); + this.administratorName = + AdministratorName.fromString(Utils.getValueFromIdByName(innerObject.id(), "administrators")); + } + + public ManagedInstanceAdministrator refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .getWithResponse(resourceGroupName, managedInstanceName, administratorName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceAdministrator refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .getWithResponse(resourceGroupName, managedInstanceName, administratorName, 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..a9d59f539c6d7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsClientImpl.java @@ -0,0 +1,1205 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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.AdministratorName; +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 { + /** 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") AdministratorName 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") AdministratorName 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") AdministratorName 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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-11-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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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. + * @param administratorName The administratorName 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 managed instance administrator along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be 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, + 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 administratorName The administratorName 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 managed instance administrator along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, 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 (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 (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be 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, + 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. + * @param administratorName The administratorName 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 managed instance administrator on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, administratorName) + .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. + * @param administratorName The administratorName 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 managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAdministratorInner get( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + return getAsync(resourceGroupName, managedInstanceName, administratorName).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 administratorName The administratorName 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 managed instance administrator along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, administratorName, 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 administratorName The administratorName parameter. + * @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + 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 (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and 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, + 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 administratorName The administratorName parameter. + * @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + 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 (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and 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, + 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 administratorName The administratorName parameter. + * @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 the {@link PollerFlux} for polling of an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedInstanceAdministratorInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, administratorName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceAdministratorInner.class, + ManagedInstanceAdministratorInner.class, + this.client.getContext()); + } + + /** + * 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 administratorName The administratorName parameter. + * @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 the {@link PollerFlux} for polling of an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedInstanceAdministratorInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, administratorName, 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 administratorName The administratorName parameter. + * @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 the {@link SyncPoller} for polling of an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedInstanceAdministratorInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, 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 administratorName The administratorName parameter. + * @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 the {@link SyncPoller} for polling of an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedInstanceAdministratorInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, 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 administratorName The administratorName parameter. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, 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 administratorName The administratorName parameter. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, 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 administratorName The administratorName parameter. + * @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, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, 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 administratorName The administratorName parameter. + * @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, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, 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. + * @param administratorName The administratorName 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be 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, + 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 administratorName The administratorName 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, 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 (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 (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be 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, + 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. + * @param administratorName The administratorName 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, administratorName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 administratorName The administratorName 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, administratorName, 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. + * @param administratorName The administratorName 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, administratorName).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 administratorName The administratorName 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, administratorName, 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. + * @param administratorName The administratorName 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, administratorName) + .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 administratorName The administratorName 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, administratorName, 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. + * @param administratorName The administratorName 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 managedInstanceName, AdministratorName administratorName) { + deleteAsync(resourceGroupName, managedInstanceName, administratorName).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 administratorName The administratorName 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 managedInstanceName, AdministratorName administratorName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, administratorName, 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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..20e016f1a5fd5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsImpl.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.ManagedInstanceAdministratorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministrators; + +public final class ManagedInstanceAdministratorsImpl implements ManagedInstanceAdministrators { + private static 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, AdministratorName administratorName) { + ManagedInstanceAdministratorInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, administratorName); + if (inner != null) { + return new ManagedInstanceAdministratorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, administratorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceAdministratorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, administratorName); + } + + public void delete( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, administratorName, 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))); + } + 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, managedInstanceName, 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 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))); + } + 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, managedInstanceName, 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 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))); + } + 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, managedInstanceName, 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 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))); + } + 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, managedInstanceName, administratorName, context); + } + + private ManagedInstanceAdministratorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceAdministratorImpl define(AdministratorName name) { + return new ManagedInstanceAdministratorImpl(name, 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..19070a05ba2f5 --- /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..6be4fd96da16b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsClientImpl.java @@ -0,0 +1,1240 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @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-11-01-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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @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-11-01-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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-11-01-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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-11-01-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 the {@link PollerFlux} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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-11-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 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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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-11-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 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 as paginated response with {@link + * PagedFlux}. + */ + @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 as paginated response with {@link + * PagedFlux}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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..e755268caffb0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + +public final class ManagedInstanceAzureADOnlyAuthenticationsImpl implements ManagedInstanceAzureADOnlyAuthentications { + private static 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..dd667c80bf4e0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorImpl.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.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 Boolean autoRotationEnabled() { + return this.innerModel().autoRotationEnabled(); + } + + 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 void revalidate() { + serviceManager + .managedInstanceEncryptionProtectors() + .revalidate(resourceGroupName, managedInstanceName, encryptionProtectorName); + } + + public void revalidate(Context context) { + serviceManager + .managedInstanceEncryptionProtectors() + .revalidate(resourceGroupName, managedInstanceName, encryptionProtectorName, context); + } + + public ManagedInstanceEncryptionProtectorImpl withServerKeyName(String serverKeyName) { + this.innerModel().withServerKeyName(serverKeyName); + return this; + } + + public ManagedInstanceEncryptionProtectorImpl withServerKeyType(ServerKeyType serverKeyType) { + this.innerModel().withServerKeyType(serverKeyType); + return this; + } + + public ManagedInstanceEncryptionProtectorImpl withAutoRotationEnabled(Boolean autoRotationEnabled) { + this.innerModel().withAutoRotationEnabled(autoRotationEnabled); + 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..3905325288e47 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsClientImpl.java @@ -0,0 +1,1242 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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-11-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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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..af25f43498b76 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsImpl.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.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; + +public final class ManagedInstanceEncryptionProtectorsImpl implements ManagedInstanceEncryptionProtectors { + private static 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..5fdcad576c2a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceImpl.java @@ -0,0 +1,527 @@ +// Copyright (c) Microsoft Corporation. All rights 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.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstance; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceExternalAdministrator; +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.ReplicaType; +import com.azure.resourcemanager.sql.generated.models.ResourceIdentity; +import com.azure.resourcemanager.sql.generated.models.ServicePrincipal; +import com.azure.resourcemanager.sql.generated.models.Sku; +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 BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.innerModel().currentBackupStorageRedundancy(); + } + + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerModel().requestedBackupStorageRedundancy(); + } + + public Boolean zoneRedundant() { + return this.innerModel().zoneRedundant(); + } + + public String primaryUserAssignedIdentityId() { + return this.innerModel().primaryUserAssignedIdentityId(); + } + + public String keyId() { + return this.innerModel().keyId(); + } + + public ManagedInstanceExternalAdministrator administrators() { + return this.innerModel().administrators(); + } + + public ServicePrincipal servicePrincipal() { + return this.innerModel().servicePrincipal(); + } + + 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() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstances() + .getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstance refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstances() + .getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, localExpand, context) + .getValue(); + return this; + } + + public void failover(ReplicaType replicaType) { + serviceManager.managedInstances().failover(resourceGroupName, managedInstanceName, replicaType); + } + + public void failover() { + serviceManager.managedInstances().failover(resourceGroupName, managedInstanceName); + } + + public void failover(ReplicaType replicaType, Context context) { + serviceManager.managedInstances().failover(resourceGroupName, managedInstanceName, replicaType, context); + } + + 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) { + this.innerModel().withManagedInstanceCreateMode(managedInstanceCreateMode); + return this; + } + + public ManagedInstanceImpl withAdministratorLogin(String administratorLogin) { + this.innerModel().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) { + this.innerModel().withCollation(collation); + return this; + } + + public ManagedInstanceImpl withDnsZonePartner(String dnsZonePartner) { + this.innerModel().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) { + this.innerModel().withSourceManagedInstanceId(sourceManagedInstanceId); + return this; + } + + public ManagedInstanceImpl withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.innerModel().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) { + this.innerModel().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 withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + this.innerModel().withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } + + public ManagedInstanceImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.innerModel().withZoneRedundant(zoneRedundant); + return this; + } else { + this.updateParameters.withZoneRedundant(zoneRedundant); + return this; + } + } + + public ManagedInstanceImpl withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + if (isInCreateMode()) { + this.innerModel().withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } else { + this.updateParameters.withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } + } + + public ManagedInstanceImpl withKeyId(String keyId) { + this.innerModel().withKeyId(keyId); + return this; + } + + public ManagedInstanceImpl withAdministrators(ManagedInstanceExternalAdministrator administrators) { + this.innerModel().withAdministrators(administrators); + return this; + } + + public ManagedInstanceImpl withServicePrincipal(ServicePrincipal servicePrincipal) { + if (isInCreateMode()) { + this.innerModel().withServicePrincipal(servicePrincipal); + return this; + } else { + this.updateParameters.withServicePrincipal(servicePrincipal); + 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..92941af1a1dd3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeyImpl.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.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 Boolean autoRotationEnabled() { + return this.innerModel().autoRotationEnabled(); + } + + 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..b697603b07bf6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysClientImpl.java @@ -0,0 +1,1195 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of a managed instance key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a managed instance key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a managed instance key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a managed instance key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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..4d9fa2bbf27a5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysImpl.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.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; + +public final class ManagedInstanceKeysImpl implements ManagedInstanceKeys { + private static 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..d816953177ef9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionBackupImpl.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.ManagedInstanceLongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +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 BackupStorageRedundancy backupStorageRedundancy() { + return this.innerModel().backupStorageRedundancy(); + } + + 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..99a901a41cf23 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesClientImpl.java @@ -0,0 +1,1009 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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..4578b62fb22db --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesImpl.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.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; + +public final class ManagedInstanceLongTermRetentionPoliciesImpl implements ManagedInstanceLongTermRetentionPolicies { + private static 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..300992127c948 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsClientImpl.java @@ -0,0 +1,722 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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({"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({"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("{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); + } + + /** + * 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, operationId, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context) { + return cancelWithResponseAsync(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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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..26cc5622a947c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsImpl.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.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 java.util.UUID; + +public final class ManagedInstanceOperationsImpl implements ManagedInstanceOperations { + private static 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 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; + } + } + + 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); + } + + 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/ManagedInstancePrivateEndpointConnectionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..c549ec93fb81e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionImpl.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.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointProperty; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkServiceConnectionStateProperty; + +public final class ManagedInstancePrivateEndpointConnectionImpl + implements ManagedInstancePrivateEndpointConnection, + ManagedInstancePrivateEndpointConnection.Definition, + ManagedInstancePrivateEndpointConnection.Update { + private ManagedInstancePrivateEndpointConnectionInner 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 ManagedInstancePrivateEndpointProperty privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public ManagedInstancePrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String privateEndpointConnectionName; + + public ManagedInstancePrivateEndpointConnectionImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedInstancePrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstancePrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + privateEndpointConnectionName, + this.innerModel(), + Context.NONE); + return this; + } + + public ManagedInstancePrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstancePrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, managedInstanceName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + ManagedInstancePrivateEndpointConnectionImpl( + String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstancePrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public ManagedInstancePrivateEndpointConnectionImpl update() { + return this; + } + + public ManagedInstancePrivateEndpointConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstancePrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + privateEndpointConnectionName, + this.innerModel(), + Context.NONE); + return this; + } + + public ManagedInstancePrivateEndpointConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstancePrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, managedInstanceName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + ManagedInstancePrivateEndpointConnectionImpl( + ManagedInstancePrivateEndpointConnectionInner 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.privateEndpointConnectionName = Utils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public ManagedInstancePrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstancePrivateEndpointConnections() + .getWithResponse(resourceGroupName, managedInstanceName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstancePrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstancePrivateEndpointConnections() + .getWithResponse(resourceGroupName, managedInstanceName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public ManagedInstancePrivateEndpointConnectionImpl withPrivateEndpoint( + ManagedInstancePrivateEndpointProperty privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public ManagedInstancePrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState( + ManagedInstancePrivateLinkServiceConnectionStateProperty 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/ManagedInstancePrivateEndpointConnectionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..6e57d2a30444c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1233 @@ +// Copyright (c) Microsoft Corporation. All rights 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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstancePrivateEndpointConnectionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointConnectionListResult; +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 + * ManagedInstancePrivateEndpointConnectionsClient. + */ +public final class ManagedInstancePrivateEndpointConnectionsClientImpl + implements ManagedInstancePrivateEndpointConnectionsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstancePrivateEndpointConnectionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstancePrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstancePrivateEndpointConnectionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstancePrivateEndpointConnectionsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstancePrivateEndpointConnections to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedInstancePrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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" + + "/managedInstances/{managedInstanceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstancePrivateEndpointConnectionInner 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}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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" + + "/managedInstances/{managedInstanceName}/privateEndpointConnections") + @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("{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); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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, + managedInstanceName, + 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 managedInstanceName The name of the managed instance. + * @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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, + managedInstanceName, + 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 managedInstanceName The name of the managed instance. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 ManagedInstancePrivateEndpointConnectionInner get( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + return getAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner 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 (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, + managedInstanceName, + 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 managedInstanceName The name of the managed instance. + * @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner 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 (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, + managedInstanceName, + 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 managedInstanceName The name of the managed instance. + * @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 the {@link PollerFlux} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedInstancePrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstancePrivateEndpointConnectionInner.class, + ManagedInstancePrivateEndpointConnectionInner.class, + this.client.getContext()); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @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 the {@link PollerFlux} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedInstancePrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstancePrivateEndpointConnectionInner.class, + ManagedInstancePrivateEndpointConnectionInner.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 managedInstanceName The name of the managed instance. + * @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 the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedInstancePrivateEndpointConnectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedInstancePrivateEndpointConnectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 ManagedInstancePrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 ManagedInstancePrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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, + managedInstanceName, + 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 managedInstanceName The name of the managed instance. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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, + managedInstanceName, + 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 managedInstanceName The name of the managed instance. + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 managedInstanceName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 managedInstanceName, String privateEndpointConnectionName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, 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 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 all private endpoint connections on a server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 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 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 all private endpoint connections on a server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 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 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 all private endpoint connections on a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByManagedInstanceNextSinglePageAsync(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 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 all private endpoint connections on a server as paginated response with {@link PagedFlux}. + */ + @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 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 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 all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * 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 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 all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByManagedInstanceAsync(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 private endpoint connections along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 private endpoint connections along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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/ManagedInstancePrivateEndpointConnectionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..86547ef8b5e5c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionsImpl.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.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.ManagedInstancePrivateEndpointConnectionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointConnections; + +public final class ManagedInstancePrivateEndpointConnectionsImpl implements ManagedInstancePrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstancePrivateEndpointConnectionsImpl.class); + + private final ManagedInstancePrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstancePrivateEndpointConnectionsImpl( + ManagedInstancePrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ManagedInstancePrivateEndpointConnection get( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + ManagedInstancePrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, privateEndpointConnectionName); + if (inner != null) { + return new ManagedInstancePrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstancePrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, privateEndpointConnectionName); + } + + public void delete( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, privateEndpointConnectionName, context); + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstancePrivateEndpointConnectionImpl(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 ManagedInstancePrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public ManagedInstancePrivateEndpointConnection 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 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, managedInstanceName, 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 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 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, managedInstanceName, 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 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 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, managedInstanceName, 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 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 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, managedInstanceName, privateEndpointConnectionName, context); + } + + private ManagedInstancePrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstancePrivateEndpointConnectionImpl define(String name) { + return new ManagedInstancePrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkImpl.java new file mode 100644 index 0000000000000..cf99abd95d416 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkImpl.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.ManagedInstancePrivateLinkInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLink; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkProperties; + +public final class ManagedInstancePrivateLinkImpl implements ManagedInstancePrivateLink { + private ManagedInstancePrivateLinkInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ManagedInstancePrivateLinkImpl( + ManagedInstancePrivateLinkInner 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 ManagedInstancePrivateLinkProperties properties() { + return this.innerModel().properties(); + } + + public ManagedInstancePrivateLinkInner 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/ManagedInstancePrivateLinkResourcesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkResourcesClientImpl.java new file mode 100644 index 0000000000000..ab02e514d472c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkResourcesClientImpl.java @@ -0,0 +1,550 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.ManagedInstancePrivateLinkResourcesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateLinkInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ManagedInstancePrivateLinkResourcesClient. + */ +public final class ManagedInstancePrivateLinkResourcesClientImpl implements ManagedInstancePrivateLinkResourcesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstancePrivateLinkResourcesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstancePrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstancePrivateLinkResourcesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstancePrivateLinkResourcesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstancePrivateLinkResources to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + private interface ManagedInstancePrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/privateLinkResources") + @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}/privateLinkResources/{groupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @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> listByManagedInstanceNext( + @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 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 private link resources for SQL server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 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 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 private link resources for SQL server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 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 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 private link resources for SQL server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByManagedInstanceNextSinglePageAsync(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 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 private link resources for SQL server as paginated response with {@link PagedFlux}. + */ + @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 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 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 private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * 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 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 private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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 = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + 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 managedInstanceName The name of the managed instance. + * @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, 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 (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName 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 = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + 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 managedInstanceName The name of the managed instance. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String groupName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 ManagedInstancePrivateLinkInner get(String resourceGroupName, String managedInstanceName, String groupName) { + return getAsync(resourceGroupName, managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String groupName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 private link resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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/ManagedInstancePrivateLinkResourcesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..86c71810fae57 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkResourcesImpl.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.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.ManagedInstancePrivateLinkResourcesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateLinkInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLink; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkResources; + +public final class ManagedInstancePrivateLinkResourcesImpl implements ManagedInstancePrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstancePrivateLinkResourcesImpl.class); + + private final ManagedInstancePrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstancePrivateLinkResourcesImpl( + ManagedInstancePrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstancePrivateLinkImpl(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 ManagedInstancePrivateLinkImpl(inner1, this.manager())); + } + + public ManagedInstancePrivateLink get(String resourceGroupName, String managedInstanceName, String groupName) { + ManagedInstancePrivateLinkInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, groupName); + if (inner != null) { + return new ManagedInstancePrivateLinkImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String groupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, groupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstancePrivateLinkImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ManagedInstancePrivateLinkResourcesClient 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/ManagedInstanceQueryImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceQueryImpl.java new file mode 100644 index 0000000000000..76740a7f1403b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceQueryImpl.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.ManagedInstanceQueryInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceQuery; + +public final class ManagedInstanceQueryImpl implements ManagedInstanceQuery { + private ManagedInstanceQueryInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ManagedInstanceQueryImpl( + ManagedInstanceQueryInner 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 queryText() { + return this.innerModel().queryText(); + } + + public ManagedInstanceQueryInner 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/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..885dcda301ba8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesClientImpl.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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..a0c7e3fb9c191 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesImpl.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.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; + +public final class ManagedInstanceTdeCertificatesImpl implements ManagedInstanceTdeCertificates { + private static 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..9bf8ae4ecca58 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsClientImpl.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.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.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 { + /** 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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. Learn more about setting SQL vulnerability + * assessment with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that contains 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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. Learn more about setting SQL vulnerability + * assessment with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that contains 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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. Learn more about setting SQL vulnerability + * assessment with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that contains 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 on successful completion of {@link Mono}. + */ + @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. Learn more about setting SQL vulnerability + * assessment with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that contains 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. Learn more about setting SQL vulnerability + * assessment with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that contains 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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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-11-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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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..7c8afc8a7a0e2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +public final class ManagedInstanceVulnerabilityAssessmentsImpl implements ManagedInstanceVulnerabilityAssessments { + private static 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); + } + + 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..5c16ec15e0d08 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesClientImpl.java @@ -0,0 +1,2795 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/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, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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("{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> 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); + + @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); + } + + /** + * 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 expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolSinglePageAsync( + String resourceGroupName, String instancePoolName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (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 = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstancePool( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + expand, + 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolSinglePageAsync( + String resourceGroupName, String instancePoolName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (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 = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstancePool( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + expand, + 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. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstancePoolAsync( + String resourceGroupName, String instancePoolName, String expand) { + return new PagedFlux<>( + () -> listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expand), + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstancePoolAsync(String resourceGroupName, String instancePoolName) { + final String expand = null; + return new PagedFlux<>( + () -> listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expand), + 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstancePoolAsync( + String resourceGroupName, String instancePoolName, String expand, Context context) { + return new PagedFlux<>( + () -> listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expand, 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName) { + final String expand = null; + return new PagedIterable<>(listByInstancePoolAsync(resourceGroupName, instancePoolName, expand)); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, String expand, Context context) { + return new PagedIterable<>(listByInstancePoolAsync(resourceGroupName, instancePoolName, expand, context)); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String expand) { + 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 = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + expand, + 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), expand, 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. + * + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand) { + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String expand = null; + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand, 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String expand = null; + return new PagedIterable<>(listAsync(expand)); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String expand, Context context) { + return new PagedIterable<>(listAsync(expand, 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. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + expand, + 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + expand, + 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. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String expand) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand), + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String expand = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand), + 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String expand, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand, 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String expand = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, expand)); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String expand, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, expand, 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. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String managedInstanceName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (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 = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + expand, + 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String managedInstanceName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (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 = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + expand, + 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. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String managedInstanceName, String expand) { + return getByResourceGroupWithResponseAsync(resourceGroupName, managedInstanceName, expand) + .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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String managedInstanceName) { + final String expand = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, managedInstanceName, expand) + .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) { + final String expand = null; + return getByResourceGroupAsync(resourceGroupName, managedInstanceName, expand).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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String managedInstanceName, String expand, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, managedInstanceName, expand, 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-01-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-01-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 the {@link PollerFlux} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-01-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-01-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-01-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-01-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 the {@link PollerFlux} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2021-05-01-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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2021-05-01-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-01-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-05-01-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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(); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 managed instances along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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/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..dfa17634bdb14 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesImpl.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.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; + +public final class ManagedInstancesImpl implements ManagedInstances { + private static 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, String expand, Context context) { + PagedIterable inner = + this.serviceClient().listByInstancePool(resourceGroupName, instancePoolName, expand, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list(String expand, Context context) { + PagedIterable inner = this.serviceClient().list(expand, 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, String expand, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, expand, 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, String expand, Context context) { + Response inner = + this + .serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, expand, 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 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))); + } + String localExpand = null; + return this + .getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String 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, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String 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..b09d15bb95c16 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl.java @@ -0,0 +1,1456 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 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. 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 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. 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 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. 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 the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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 the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 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. 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 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. 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 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. 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 on successful completion of {@link Mono}. + */ + @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 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. 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 on successful completion of {@link Mono}. + */ + @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 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. 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 restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters) + .block(); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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 restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context) + .block(); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 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. 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 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. 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 the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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 the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 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. 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 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. 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 the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 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. 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 on successful completion of {@link Mono}. + */ + @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 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. 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 on successful completion of {@link Mono}. + */ + @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 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. 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 restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return updateAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters) + .block(); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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..2ce44262992ab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.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.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; + +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl + implements ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { + private static 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..40a52e65c6229 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,940 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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.SecurityAlertPolicyName; +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 { + /** 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") 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}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, 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 (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 = "2020-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + 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 (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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, SecurityAlertPolicyName 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, SecurityAlertPolicyName 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName 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 = "2020-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName 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 = "2020-11-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 the {@link PollerFlux} for polling of a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedServerSecurityAlertPolicyInner.class, + ManagedServerSecurityAlertPolicyInner.class, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName 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 the {@link SyncPoller} for polling of a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName 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 the {@link SyncPoller} for polling of a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName 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, + SecurityAlertPolicyName 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, + SecurityAlertPolicyName 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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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-11-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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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..0b8d6d999fb11 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesImpl.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.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.SecurityAlertPolicyName; + +public final class ManagedServerSecurityAlertPoliciesImpl implements ManagedServerSecurityAlertPolicies { + private static 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, SecurityAlertPolicyName 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, + SecurityAlertPolicyName 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))); + } + 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, 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))); + } + 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, securityAlertPolicyName, context); + } + + private ManagedServerSecurityAlertPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedServerSecurityAlertPolicyImpl define(SecurityAlertPolicyName 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..8b3e88c803ed6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPolicyImpl.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.implementation; + +import com.azure.core.management.SystemData; +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.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public SecurityAlertsPolicyState 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 SecurityAlertPolicyName 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( + SecurityAlertPolicyName 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 = + SecurityAlertPolicyName.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(SecurityAlertsPolicyState 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/ManagedTransparentDataEncryptionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedTransparentDataEncryptionImpl.java new file mode 100644 index 0000000000000..6ed1646486a38 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedTransparentDataEncryptionImpl.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.ManagedTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.ManagedTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; + +public final class ManagedTransparentDataEncryptionImpl + implements ManagedTransparentDataEncryption, + ManagedTransparentDataEncryption.Definition, + ManagedTransparentDataEncryption.Update { + private ManagedTransparentDataEncryptionInner 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 TransparentDataEncryptionState state() { + return this.innerModel().state(); + } + + public ManagedTransparentDataEncryptionInner 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 TransparentDataEncryptionName tdeName; + + public ManagedTransparentDataEncryptionImpl withExistingDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + public ManagedTransparentDataEncryption create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, databaseName, tdeName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ManagedTransparentDataEncryption create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, databaseName, tdeName, this.innerModel(), context) + .getValue(); + return this; + } + + ManagedTransparentDataEncryptionImpl( + TransparentDataEncryptionName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedTransparentDataEncryptionInner(); + this.serviceManager = serviceManager; + this.tdeName = name; + } + + public ManagedTransparentDataEncryptionImpl update() { + return this; + } + + public ManagedTransparentDataEncryption apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, databaseName, tdeName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ManagedTransparentDataEncryption apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, databaseName, tdeName, this.innerModel(), context) + .getValue(); + return this; + } + + ManagedTransparentDataEncryptionImpl( + ManagedTransparentDataEncryptionInner 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.tdeName = + TransparentDataEncryptionName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "transparentDataEncryption")); + } + + public ManagedTransparentDataEncryption refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseTransparentDataEncryptions() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, tdeName, Context.NONE) + .getValue(); + return this; + } + + public ManagedTransparentDataEncryption refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseTransparentDataEncryptions() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, tdeName, context) + .getValue(); + return this; + } + + public ManagedTransparentDataEncryptionImpl withState(TransparentDataEncryptionState 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/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..2248873334f49 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsClientImpl.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.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.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 { + /** 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2020-11-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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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..672183343200d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsImpl.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.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; + +public final class OperationsImpl implements Operations { + private static 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/OutboundFirewallRuleImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRuleImpl.java new file mode 100644 index 0000000000000..9b82c7783d09e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRuleImpl.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.OutboundFirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.OutboundFirewallRule; + +public final class OutboundFirewallRuleImpl + implements OutboundFirewallRule, OutboundFirewallRule.Definition, OutboundFirewallRule.Update { + private OutboundFirewallRuleInner 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 provisioningState() { + return this.innerModel().provisioningState(); + } + + public OutboundFirewallRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String outboundRuleFqdn; + + public OutboundFirewallRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public OutboundFirewallRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getOutboundFirewallRules() + .createOrUpdate(resourceGroupName, serverName, outboundRuleFqdn, this.innerModel(), Context.NONE); + return this; + } + + public OutboundFirewallRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getOutboundFirewallRules() + .createOrUpdate(resourceGroupName, serverName, outboundRuleFqdn, this.innerModel(), context); + return this; + } + + OutboundFirewallRuleImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new OutboundFirewallRuleInner(); + this.serviceManager = serviceManager; + this.outboundRuleFqdn = name; + } + + public OutboundFirewallRuleImpl update() { + return this; + } + + public OutboundFirewallRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getOutboundFirewallRules() + .createOrUpdate(resourceGroupName, serverName, outboundRuleFqdn, this.innerModel(), Context.NONE); + return this; + } + + public OutboundFirewallRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getOutboundFirewallRules() + .createOrUpdate(resourceGroupName, serverName, outboundRuleFqdn, this.innerModel(), context); + return this; + } + + OutboundFirewallRuleImpl( + OutboundFirewallRuleInner 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.outboundRuleFqdn = Utils.getValueFromIdByName(innerObject.id(), "outboundFirewallRules"); + } + + public OutboundFirewallRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getOutboundFirewallRules() + .getWithResponse(resourceGroupName, serverName, outboundRuleFqdn, Context.NONE) + .getValue(); + return this; + } + + public OutboundFirewallRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getOutboundFirewallRules() + .getWithResponse(resourceGroupName, serverName, outboundRuleFqdn, context) + .getValue(); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRulesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRulesClientImpl.java new file mode 100644 index 0000000000000..552ea46a831fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRulesClientImpl.java @@ -0,0 +1,1164 @@ +// Copyright (c) Microsoft Corporation. All rights 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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.OutboundFirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.OutboundFirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.OutboundFirewallRuleListResult; +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 OutboundFirewallRulesClient. */ +public final class OutboundFirewallRulesClientImpl implements OutboundFirewallRulesClient { + /** The proxy service used to perform REST calls. */ + private final OutboundFirewallRulesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of OutboundFirewallRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OutboundFirewallRulesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(OutboundFirewallRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientOutboundFirewallRules to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientO") + private interface OutboundFirewallRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/outboundFirewallRules/{outboundRuleFqdn}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("outboundRuleFqdn") String outboundRuleFqdn, + @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}/outboundFirewallRules/{outboundRuleFqdn}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("outboundRuleFqdn") String outboundRuleFqdn, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") OutboundFirewallRuleInner 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}/outboundFirewallRules/{outboundRuleFqdn}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("outboundRuleFqdn") String outboundRuleFqdn, + @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}/outboundFirewallRules") + @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 outbound 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 outboundRuleFqdn The outboundRuleFqdn 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 an outbound firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (outboundRuleFqdn == null) { + return Mono + .error(new IllegalArgumentException("Parameter outboundRuleFqdn is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + outboundRuleFqdn, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn 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 an outbound firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (outboundRuleFqdn == null) { + return Mono + .error(new IllegalArgumentException("Parameter outboundRuleFqdn is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + outboundRuleFqdn, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn 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 an outbound firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn) { + return getWithResponseAsync(resourceGroupName, serverName, outboundRuleFqdn) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn 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 an outbound firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OutboundFirewallRuleInner get(String resourceGroupName, String serverName, String outboundRuleFqdn) { + return getAsync(resourceGroupName, serverName, outboundRuleFqdn).block(); + } + + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn 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 an outbound firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, outboundRuleFqdn, context).block(); + } + + /** + * Create a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound 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 an Azure SQL DB Server Outbound Firewall Rule along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn, OutboundFirewallRuleInner 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 (outboundRuleFqdn == null) { + return Mono + .error(new IllegalArgumentException("Parameter outboundRuleFqdn is required and 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 = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + outboundRuleFqdn, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound 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 an Azure SQL DB Server Outbound Firewall Rule along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String outboundRuleFqdn, + OutboundFirewallRuleInner 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 (outboundRuleFqdn == null) { + return Mono + .error(new IllegalArgumentException("Parameter outboundRuleFqdn is required and 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 = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + outboundRuleFqdn, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Create a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound 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 {@link PollerFlux} for polling of an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OutboundFirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn, OutboundFirewallRuleInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OutboundFirewallRuleInner.class, + OutboundFirewallRuleInner.class, + this.client.getContext()); + } + + /** + * Create a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound 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 {@link PollerFlux} for polling of an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OutboundFirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String outboundRuleFqdn, + OutboundFirewallRuleInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OutboundFirewallRuleInner.class, + OutboundFirewallRuleInner.class, + context); + } + + /** + * Create a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound 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 {@link SyncPoller} for polling of an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OutboundFirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String outboundRuleFqdn, OutboundFirewallRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters).getSyncPoller(); + } + + /** + * Create a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound 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 {@link SyncPoller} for polling of an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OutboundFirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String outboundRuleFqdn, + OutboundFirewallRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters, context) + .getSyncPoller(); + } + + /** + * Create a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound 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 an Azure SQL DB Server Outbound Firewall Rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn, OutboundFirewallRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound 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 an Azure SQL DB Server Outbound Firewall Rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String outboundRuleFqdn, + OutboundFirewallRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound 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 an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OutboundFirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String outboundRuleFqdn, OutboundFirewallRuleInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters).block(); + } + + /** + * Create a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound 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 an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OutboundFirewallRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String outboundRuleFqdn, + OutboundFirewallRuleInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters, context).block(); + } + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (outboundRuleFqdn == null) { + return Mono + .error(new IllegalArgumentException("Parameter outboundRuleFqdn is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + outboundRuleFqdn, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (outboundRuleFqdn == null) { + return Mono + .error(new IllegalArgumentException("Parameter outboundRuleFqdn is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + outboundRuleFqdn, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, outboundRuleFqdn); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, outboundRuleFqdn, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String outboundRuleFqdn) { + return beginDeleteAsync(resourceGroupName, serverName, outboundRuleFqdn).getSyncPoller(); + } + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, outboundRuleFqdn, context).getSyncPoller(); + } + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String outboundRuleFqdn) { + return beginDeleteAsync(resourceGroupName, serverName, outboundRuleFqdn) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, outboundRuleFqdn, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 outboundRuleFqdn) { + deleteAsync(resourceGroupName, serverName, outboundRuleFqdn).block(); + } + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 outboundRuleFqdn, Context context) { + deleteAsync(resourceGroupName, serverName, outboundRuleFqdn, context).block(); + } + + /** + * Gets all outbound firewall rules 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 outbound firewall rules on a server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-02-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 outbound firewall rules 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 outbound firewall rules on a server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-02-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 outbound firewall rules 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 outbound firewall rules on a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets all outbound firewall rules 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 outbound firewall rules on a server as paginated response with {@link PagedFlux}. + */ + @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 outbound firewall rules 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 outbound firewall rules on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets all outbound firewall rules 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 outbound firewall rules on a server as paginated response with {@link PagedIterable}. + */ + @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 outbound rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 outbound rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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/OutboundFirewallRulesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRulesImpl.java new file mode 100644 index 0000000000000..f9896b6010ca5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRulesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.OutboundFirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.OutboundFirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.OutboundFirewallRule; +import com.azure.resourcemanager.sql.generated.models.OutboundFirewallRules; + +public final class OutboundFirewallRulesImpl implements OutboundFirewallRules { + private static final ClientLogger LOGGER = new ClientLogger(OutboundFirewallRulesImpl.class); + + private final OutboundFirewallRulesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public OutboundFirewallRulesImpl( + OutboundFirewallRulesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OutboundFirewallRule get(String resourceGroupName, String serverName, String outboundRuleFqdn) { + OutboundFirewallRuleInner inner = this.serviceClient().get(resourceGroupName, serverName, outboundRuleFqdn); + if (inner != null) { + return new OutboundFirewallRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, outboundRuleFqdn, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OutboundFirewallRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String outboundRuleFqdn) { + this.serviceClient().delete(resourceGroupName, serverName, outboundRuleFqdn); + } + + public void delete(String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, outboundRuleFqdn, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new OutboundFirewallRuleImpl(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 OutboundFirewallRuleImpl(inner1, this.manager())); + } + + public OutboundFirewallRule 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 outboundRuleFqdn = Utils.getValueFromIdByName(id, "outboundFirewallRules"); + if (outboundRuleFqdn == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'outboundFirewallRules'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, outboundRuleFqdn, 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 outboundRuleFqdn = Utils.getValueFromIdByName(id, "outboundFirewallRules"); + if (outboundRuleFqdn == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'outboundFirewallRules'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, outboundRuleFqdn, 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 outboundRuleFqdn = Utils.getValueFromIdByName(id, "outboundFirewallRules"); + if (outboundRuleFqdn == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'outboundFirewallRules'.", + id))); + } + this.delete(resourceGroupName, serverName, outboundRuleFqdn, 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 outboundRuleFqdn = Utils.getValueFromIdByName(id, "outboundFirewallRules"); + if (outboundRuleFqdn == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'outboundFirewallRules'.", + id))); + } + this.delete(resourceGroupName, serverName, outboundRuleFqdn, context); + } + + private OutboundFirewallRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public OutboundFirewallRuleImpl define(String name) { + return new OutboundFirewallRuleImpl(name, this.manager()); + } +} 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..d3d8d0177cbfb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1201 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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..dc2f1a984688c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + private static 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..55dc8c923549c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesClientImpl.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.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.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 { + /** 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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..27b4fefaeee4d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesImpl.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.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; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + private static 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/QueryStatisticsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/QueryStatisticsImpl.java new file mode 100644 index 0000000000000..a41301ab42df2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/QueryStatisticsImpl.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsInner; +import com.azure.resourcemanager.sql.generated.models.QueryMetricInterval; +import com.azure.resourcemanager.sql.generated.models.QueryStatistics; +import java.util.Collections; +import java.util.List; + +public final class QueryStatisticsImpl implements QueryStatistics { + private QueryStatisticsInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + QueryStatisticsImpl( + QueryStatisticsInner 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 queryId() { + return this.innerModel().queryId(); + } + + public String startTime() { + return this.innerModel().startTime(); + } + + public String endTime() { + return this.innerModel().endTime(); + } + + public List intervals() { + List inner = this.innerModel().intervals(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public QueryStatisticsInner 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/RecommendedActionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedActionImpl.java new file mode 100644 index 0000000000000..7211c07df1192 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedActionImpl.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.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import com.azure.resourcemanager.sql.generated.models.RecommendedAction; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionErrorInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionImpactRecord; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionImplementationInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionInitiatedBy; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionMetricInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionStateInfo; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class RecommendedActionImpl implements RecommendedAction { + private RecommendedActionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + RecommendedActionImpl( + RecommendedActionInner 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 kind() { + return this.innerModel().kind(); + } + + public String location() { + return this.innerModel().location(); + } + + public String recommendationReason() { + return this.innerModel().recommendationReason(); + } + + public OffsetDateTime validSince() { + return this.innerModel().validSince(); + } + + public OffsetDateTime lastRefresh() { + return this.innerModel().lastRefresh(); + } + + public RecommendedActionStateInfo state() { + return this.innerModel().state(); + } + + public Boolean isExecutableAction() { + return this.innerModel().isExecutableAction(); + } + + public Boolean isRevertableAction() { + return this.innerModel().isRevertableAction(); + } + + public Boolean isArchivedAction() { + return this.innerModel().isArchivedAction(); + } + + public OffsetDateTime executeActionStartTime() { + return this.innerModel().executeActionStartTime(); + } + + public String executeActionDuration() { + return this.innerModel().executeActionDuration(); + } + + public OffsetDateTime revertActionStartTime() { + return this.innerModel().revertActionStartTime(); + } + + public String revertActionDuration() { + return this.innerModel().revertActionDuration(); + } + + public RecommendedActionInitiatedBy executeActionInitiatedBy() { + return this.innerModel().executeActionInitiatedBy(); + } + + public OffsetDateTime executeActionInitiatedTime() { + return this.innerModel().executeActionInitiatedTime(); + } + + public RecommendedActionInitiatedBy revertActionInitiatedBy() { + return this.innerModel().revertActionInitiatedBy(); + } + + public OffsetDateTime revertActionInitiatedTime() { + return this.innerModel().revertActionInitiatedTime(); + } + + public Integer score() { + return this.innerModel().score(); + } + + public RecommendedActionImplementationInfo implementationDetails() { + return this.innerModel().implementationDetails(); + } + + public RecommendedActionErrorInfo errorDetails() { + return this.innerModel().errorDetails(); + } + + public List estimatedImpact() { + List inner = this.innerModel().estimatedImpact(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List observedImpact() { + List inner = this.innerModel().observedImpact(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List timeSeries() { + List inner = this.innerModel().timeSeries(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List linkedObjects() { + List inner = this.innerModel().linkedObjects(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Map details() { + Map inner = this.innerModel().details(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public RecommendedActionInner 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/RecommendedSensitivityLabelsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedSensitivityLabelsClientImpl.java new file mode 100644 index 0000000000000..08df03de1859c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedSensitivityLabelsClientImpl.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.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.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.resourcemanager.sql.generated.fluent.RecommendedSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RecommendedSensitivityLabelsClient. */ +public final class RecommendedSensitivityLabelsClientImpl implements RecommendedSensitivityLabelsClient { + /** The proxy service used to perform REST calls. */ + private final RecommendedSensitivityLabelsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of RecommendedSensitivityLabelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecommendedSensitivityLabelsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + RecommendedSensitivityLabelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientRecommendedSensitivityLabels to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + private interface RecommendedSensitivityLabelsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/recommendedSensitivityLabels") + @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") RecommendedSensitivityLabelUpdateList parameters, + Context context); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList 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 + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList 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 + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 update( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters) { + updateAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList 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/RecommendedSensitivityLabelsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedSensitivityLabelsImpl.java new file mode 100644 index 0000000000000..903031f54807d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedSensitivityLabelsImpl.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.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.RecommendedSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabels; + +public final class RecommendedSensitivityLabelsImpl implements RecommendedSensitivityLabels { + private static final ClientLogger LOGGER = new ClientLogger(RecommendedSensitivityLabelsImpl.class); + + private final RecommendedSensitivityLabelsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public RecommendedSensitivityLabelsImpl( + RecommendedSensitivityLabelsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void update( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters) { + this.serviceClient().update(resourceGroupName, serverName, databaseName, parameters); + } + + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context) { + return this + .serviceClient() + .updateWithResponse(resourceGroupName, serverName, databaseName, parameters, context); + } + + private RecommendedSensitivityLabelsClient 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..ee55e061880fd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesClientImpl.java @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link + * Response} on successful completion of {@link Mono}. + */ + @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 along with {@link + * Response} on successful completion of {@link Mono}. + */ + @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 on successful completion + * of {@link Mono}. + */ + @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 along with {@link + * Response}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..4d10dbffdb587 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesImpl.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.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; + +public final class RecoverableDatabasesImpl implements RecoverableDatabases { + private static 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..4dcd3c392e908 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesClientImpl.java @@ -0,0 +1,547 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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-11-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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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..189bb88e7103a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesImpl.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.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; + +public final class RecoverableManagedDatabasesImpl implements RecoverableManagedDatabases { + private static 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..438bc31bba8d6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinkImpl.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.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner; +import com.azure.resourcemanager.sql.generated.models.ReplicationLink; +import com.azure.resourcemanager.sql.generated.models.ReplicationLinkType; +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 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 String replicationMode() { + return this.innerModel().replicationMode(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public Integer percentComplete() { + return this.innerModel().percentComplete(); + } + + public ReplicationState replicationState() { + return this.innerModel().replicationState(); + } + + public Boolean isTerminationAllowed() { + return this.innerModel().isTerminationAllowed(); + } + + public ReplicationLinkType linkType() { + return this.innerModel().linkType(); + } + + 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..94346dfca432f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksClientImpl.java @@ -0,0 +1,1994 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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({"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, + @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( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/replicationLinks/{linkId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("linkId") String linkId, + @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}/replicationLinks") + @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> 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> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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(); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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(); + } + + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 replication links on database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-02-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 replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 replication links on database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-02-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 replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 replication links on database as paginated response with {@link PagedFlux}. + */ + @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 replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 replication links on database as paginated response with {@link PagedFlux}. + */ + @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 replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 replication links on database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 replication links on database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Gets a 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. + * @param linkId The name of the 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 a replication link along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + linkId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a 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. + * @param linkId The name of the 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 a replication link along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + linkId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a 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. + * @param linkId The name of the 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 a replication link on successful completion of {@link Mono}. + */ + @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 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. + * @param linkId The name of the 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 a 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 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. + * @param linkId The name of the 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 a replication link along with {@link Response}. + */ + @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(); + } + + /** + * Gets a list of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedFlux}. + */ + @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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedIterable}. + */ + @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 replication links along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 replication links along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 replication links along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 replication links along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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/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..e289cb2cfa8fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksImpl.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.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; + +public final class ReplicationLinksImpl implements ReplicationLinks { + private static 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 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())); + } + + 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 PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ReplicationLinkImpl(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 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..6bebf1ea47eab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabaseImpl.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.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedDatabase; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +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 Sku sku() { + return this.innerModel().sku(); + } + + 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 Long maxSizeBytes() { + return this.innerModel().maxSizeBytes(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public OffsetDateTime deletionDate() { + return this.innerModel().deletionDate(); + } + + public OffsetDateTime earliestRestoreDate() { + return this.innerModel().earliestRestoreDate(); + } + + public BackupStorageRedundancy backupStorageRedundancy() { + return this.innerModel().backupStorageRedundancy(); + } + + 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..3d62400bfe0e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesClientImpl.java @@ -0,0 +1,543 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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") + @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}/restorableDroppedDatabases/{restorableDroppedDatabaseId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of restorable dropped 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 restorable dropped databases along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-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 restorable dropped 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 restorable dropped databases along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-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 restorable dropped 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 restorable dropped databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of restorable dropped 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 restorable dropped databases as paginated response with {@link PagedFlux}. + */ + @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 restorable dropped 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 restorable dropped databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of restorable dropped 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 restorable dropped databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @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 database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + restorableDroppedDatabaseId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @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 database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + restorableDroppedDatabaseId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @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 database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId) { + return getWithResponseAsync(resourceGroupName, serverName, restorableDroppedDatabaseId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @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 database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorableDroppedDatabaseInner get( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId) { + return getAsync(resourceGroupName, serverName, restorableDroppedDatabaseId).block(); + } + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @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 database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, 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 databases along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 restorable dropped databases along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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/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..ca6e6af36c8ca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesImpl.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.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; + +public final class RestorableDroppedDatabasesImpl implements RestorableDroppedDatabases { + private static 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 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())); + } + + public RestorableDroppedDatabase get( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId) { + RestorableDroppedDatabaseInner inner = + this.serviceClient().get(resourceGroupName, serverName, restorableDroppedDatabaseId); + if (inner != null) { + return new RestorableDroppedDatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, restorableDroppedDatabaseId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RestorableDroppedDatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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..25d0428e8d4be --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesClientImpl.java @@ -0,0 +1,557 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 = "2021-05-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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 = "2021-05-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-05-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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..04ec1538e787a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesImpl.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.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; + +public final class RestorableDroppedManagedDatabasesImpl implements RestorableDroppedManagedDatabases { + private static 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..286dd477bde02 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsClientImpl.java @@ -0,0 +1,1114 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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); + + @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 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 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 as paginated response with {@link PagedFlux}. + */ + @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 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 as paginated response with {@link PagedFlux}. + */ + @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 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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of database restore points. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of database restore points. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of database restore points. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of database restore points. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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(); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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/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..0f690de55bf3f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsImpl.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.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; + +public final class RestorePointsImpl implements RestorePoints { + private static 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/SecurityEventImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SecurityEventImpl.java new file mode 100644 index 0000000000000..0fe155aa34043 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SecurityEventImpl.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.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SecurityEventInner; +import com.azure.resourcemanager.sql.generated.models.SecurityEvent; +import com.azure.resourcemanager.sql.generated.models.SecurityEventSqlInjectionAdditionalProperties; +import com.azure.resourcemanager.sql.generated.models.SecurityEventType; +import java.time.OffsetDateTime; + +public final class SecurityEventImpl implements SecurityEvent { + private SecurityEventInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SecurityEventImpl( + SecurityEventInner 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 eventTime() { + return this.innerModel().eventTime(); + } + + public SecurityEventType securityEventType() { + return this.innerModel().securityEventType(); + } + + public String subscription() { + return this.innerModel().subscription(); + } + + public String server() { + return this.innerModel().server(); + } + + public String database() { + return this.innerModel().database(); + } + + public String clientIp() { + return this.innerModel().clientIp(); + } + + public String applicationName() { + return this.innerModel().applicationName(); + } + + public String principalName() { + return this.innerModel().principalName(); + } + + public SecurityEventSqlInjectionAdditionalProperties securityEventSqlInjectionAdditionalProperties() { + return this.innerModel().securityEventSqlInjectionAdditionalProperties(); + } + + public SecurityEventInner 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/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..fe66f760cd65a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelImpl.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 managedBy() { + return this.innerModel().managedBy(); + } + + public String schemaName() { + return this.innerModel().schemaName(); + } + + public String tableName() { + return this.innerModel().tableName(); + } + + public String columnName() { + return this.innerModel().columnName(); + } + + 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 managedInstanceName; + + private String databaseName; + + private String schemaName; + + private String tableName; + + private String columnName; + + public SensitivityLabelImpl withExistingColumn( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + this.schemaName = schemaName; + this.tableName = tableName; + this.columnName = columnName; + return this; + } + + public SensitivityLabel create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSensitivityLabels() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public SensitivityLabel create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSensitivityLabels() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + 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() + .getManagedDatabaseSensitivityLabels() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public SensitivityLabel apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSensitivityLabels() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + 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.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + 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 void disableRecommendation() { + serviceManager + .managedDatabaseSensitivityLabels() + .disableRecommendation( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + } + + public Response disableRecommendationWithResponse(Context context) { + return serviceManager + .managedDatabaseSensitivityLabels() + .disableRecommendationWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context); + } + + public void enableRecommendation() { + serviceManager + .managedDatabaseSensitivityLabels() + .enableRecommendation( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + } + + public Response enableRecommendationWithResponse(Context context) { + return serviceManager + .managedDatabaseSensitivityLabels() + .enableRecommendationWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context); + } + + 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/SensitivityLabelUpdateImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelUpdateImpl.java new file mode 100644 index 0000000000000..7474d96fdca01 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelUpdateImpl.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabel; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdate; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; + +public final class SensitivityLabelUpdateImpl implements SensitivityLabelUpdate { + private SensitivityLabelUpdateInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SensitivityLabelUpdateImpl( + SensitivityLabelUpdateInner 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 SensitivityLabelUpdateKind op() { + return this.innerModel().op(); + } + + public String schema() { + return this.innerModel().schema(); + } + + public String table() { + return this.innerModel().table(); + } + + public String column() { + return this.innerModel().column(); + } + + public SensitivityLabel sensitivityLabel() { + SensitivityLabelInner inner = this.innerModel().sensitivityLabel(); + if (inner != null) { + return new SensitivityLabelImpl(inner, this.manager()); + } else { + return null; + } + } + + public SensitivityLabelUpdateInner 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/SensitivityLabelUpdatePropertiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelUpdatePropertiesImpl.java new file mode 100644 index 0000000000000..3372999c4a71e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelUpdatePropertiesImpl.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.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdatePropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabel; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateProperties; + +public final class SensitivityLabelUpdatePropertiesImpl implements SensitivityLabelUpdateProperties { + private SensitivityLabelUpdatePropertiesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SensitivityLabelUpdatePropertiesImpl( + SensitivityLabelUpdatePropertiesInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public SensitivityLabelUpdateKind op() { + return this.innerModel().op(); + } + + public String schema() { + return this.innerModel().schema(); + } + + public String table() { + return this.innerModel().table(); + } + + public String column() { + return this.innerModel().column(); + } + + public SensitivityLabel sensitivityLabel() { + SensitivityLabelInner inner = this.innerModel().sensitivityLabel(); + if (inner != null) { + return new SensitivityLabelImpl(inner, this.manager()); + } else { + return null; + } + } + + public SensitivityLabelUpdatePropertiesInner 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/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..868330b0dcfc0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsClientImpl.java @@ -0,0 +1,2403 @@ +// Copyright (c) Microsoft Corporation. All rights 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.util.Context; +import com.azure.core.util.FluxUtil; +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 com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; +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 { + /** 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("$skipToken") String skipToken, + @QueryParam("$count") Boolean count, + @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"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/currentSensitivityLabels") + @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") SensitivityLabelUpdateList parameters, + 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("$skipToken") String skipToken, + @QueryParam("includeDisabledRecommendations") Boolean includeDisabledRecommendations, + @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 skipToken The skipToken parameter. + * @param count The count 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + 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 = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCurrentByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + skipToken, + count, + 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 skipToken The skipToken parameter. + * @param count The count 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + 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 = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCurrentByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + skipToken, + count, + 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 skipToken The skipToken parameter. + * @param count The count 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + String filter) { + return new PagedFlux<>( + () -> + listCurrentByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, skipToken, count, 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + final String skipToken = null; + final Boolean count = null; + final String filter = null; + return new PagedFlux<>( + () -> + listCurrentByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, skipToken, count, 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 skipToken The skipToken parameter. + * @param count The count 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listCurrentByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, skipToken, count, 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCurrentByDatabase( + String resourceGroupName, String serverName, String databaseName) { + final String skipToken = null; + final Boolean count = null; + final String filter = null; + return new PagedIterable<>( + listCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName, skipToken, count, 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 skipToken The skipToken parameter. + * @param count The count 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCurrentByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context) { + return new PagedIterable<>( + listCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName, skipToken, count, filter, context)); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, SensitivityLabelUpdateList 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 + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update 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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + SensitivityLabelUpdateList 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 + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String databaseName, SensitivityLabelUpdateList parameters) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 update( + String resourceGroupName, String serverName, String databaseName, SensitivityLabelUpdateList parameters) { + updateAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update 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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SensitivityLabelUpdateList parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + 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 = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listRecommendedByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + skipToken, + includeDisabledRecommendations, + 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 skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + 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 = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRecommendedByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + skipToken, + includeDisabledRecommendations, + 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 skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter) { + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, skipToken, includeDisabledRecommendations, 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + final String skipToken = null; + final Boolean includeDisabledRecommendations = null; + final String filter = null; + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, skipToken, includeDisabledRecommendations, 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 skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, + serverName, + databaseName, + skipToken, + includeDisabledRecommendations, + 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, String serverName, String databaseName) { + final String skipToken = null; + final Boolean includeDisabledRecommendations = null; + final String filter = null; + return new PagedIterable<>( + listRecommendedByDatabaseAsync( + resourceGroupName, serverName, databaseName, skipToken, includeDisabledRecommendations, 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 skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context) { + return new PagedIterable<>( + listRecommendedByDatabaseAsync( + resourceGroupName, + serverName, + databaseName, + skipToken, + includeDisabledRecommendations, + 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..54563c76c4dd6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsImpl.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.SensitivityLabelUpdateList; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabels; + +public final class SensitivityLabelsImpl implements SensitivityLabels { + private static 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 skipToken, + Boolean count, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listCurrentByDatabase(resourceGroupName, serverName, databaseName, skipToken, count, filter, context); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public void update( + String resourceGroupName, String serverName, String databaseName, SensitivityLabelUpdateList parameters) { + this.serviceClient().update(resourceGroupName, serverName, databaseName, parameters); + } + + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SensitivityLabelUpdateList parameters, + Context context) { + return this + .serviceClient() + .updateWithResponse(resourceGroupName, serverName, databaseName, parameters, context); + } + + 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, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listRecommendedByDatabase( + resourceGroupName, + serverName, + databaseName, + skipToken, + includeDisabledRecommendations, + 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 SensitivityLabel createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters) { + SensitivityLabelInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters); + if (inner != null) { + return new SensitivityLabelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + 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 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); + } + + private SensitivityLabelsClient 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/ServerAdvisorsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvisorsClientImpl.java new file mode 100644 index 0000000000000..ca62bdf053b1d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvisorsClientImpl.java @@ -0,0 +1,653 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.ServerAdvisorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerAdvisorsClient. */ +public final class ServerAdvisorsClientImpl implements ServerAdvisorsClient { + /** The proxy service used to perform REST calls. */ + private final ServerAdvisorsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAdvisorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerAdvisorsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerAdvisorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerAdvisors to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerAdvisorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/advisors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/advisors/{advisorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("advisorName") String advisorName, + @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}/advisors/{advisorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("advisorName") String advisorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AdvisorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listByServerWithResponseAsync( + String resourceGroupName, String serverName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (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, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listByServerWithResponseAsync( + String resourceGroupName, String serverName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (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, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerAsync(String resourceGroupName, String serverName, String expand) { + return listByServerWithResponseAsync(resourceGroupName, serverName, expand) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The name of the resource group that 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 advisors on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerAsync(String resourceGroupName, String serverName) { + final String expand = null; + return listByServerWithResponseAsync(resourceGroupName, serverName, expand) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The name of the resource group that 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 advisors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listByServer(String resourceGroupName, String serverName) { + final String expand = null; + return listByServerAsync(resourceGroupName, serverName, expand).block(); + } + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listByServerWithResponse( + String resourceGroupName, String serverName, String expand, Context context) { + return listByServerWithResponseAsync(resourceGroupName, serverName, expand, context).block(); + } + + /** + * Gets a server 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 advisorName The name of the Server 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 server advisor along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String advisorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be 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, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server 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 advisorName The name of the Server 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 server advisor along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String advisorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be 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, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a server 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 advisorName The name of the Server 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 server advisor on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String advisorName) { + return getWithResponseAsync(resourceGroupName, serverName, advisorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a server 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 advisorName The name of the Server 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 server advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdvisorInner get(String resourceGroupName, String serverName, String advisorName) { + return getAsync(resourceGroupName, serverName, advisorName).block(); + } + + /** + * Gets a server 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 advisorName The name of the Server 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 server advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, advisorName, context).block(); + } + + /** + * Updates a server 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 advisorName The name of the Server Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String serverName, String advisorName, AdvisorInner 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and 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, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a server 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 advisorName The name of the Server Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String serverName, String advisorName, AdvisorInner 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 (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and 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, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a server 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 advisorName The name of the Server Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters) { + return updateWithResponseAsync(resourceGroupName, serverName, advisorName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a server 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 advisorName The name of the Server Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdvisorInner update( + String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters) { + return updateAsync(resourceGroupName, serverName, advisorName, parameters).block(); + } + + /** + * Updates a server 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 advisorName The name of the Server Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, serverName, advisorName, parameters, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvisorsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvisorsImpl.java new file mode 100644 index 0000000000000..3b5a54c622715 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvisorsImpl.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.ServerAdvisorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import com.azure.resourcemanager.sql.generated.models.Advisor; +import com.azure.resourcemanager.sql.generated.models.ServerAdvisors; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ServerAdvisorsImpl implements ServerAdvisors { + private static final ClientLogger LOGGER = new ClientLogger(ServerAdvisorsImpl.class); + + private final ServerAdvisorsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerAdvisorsImpl( + ServerAdvisorsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public List listByServer(String resourceGroupName, String serverName) { + List inner = this.serviceClient().listByServer(resourceGroupName, serverName); + if (inner != null) { + return Collections + .unmodifiableList( + inner.stream().map(inner1 -> new AdvisorImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listByServerWithResponse( + String resourceGroupName, String serverName, String expand, Context context) { + Response> inner = + this.serviceClient().listByServerWithResponse(resourceGroupName, serverName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new AdvisorImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public Advisor get(String resourceGroupName, String serverName, String advisorName) { + AdvisorInner inner = this.serviceClient().get(resourceGroupName, serverName, advisorName); + if (inner != null) { + return new AdvisorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, advisorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AdvisorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Advisor update(String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters) { + AdvisorInner inner = this.serviceClient().update(resourceGroupName, serverName, advisorName, parameters); + if (inner != null) { + return new AdvisorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters, Context context) { + Response inner = + this.serviceClient().updateWithResponse(resourceGroupName, serverName, advisorName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AdvisorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ServerAdvisorsClient 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/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..b6a94896f4aba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsClientImpl.java @@ -0,0 +1,419 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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..da7164f453d4d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsImpl.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.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; + +public final class ServerAutomaticTuningsImpl implements ServerAutomaticTunings { + private static 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..c6bd3f2cdaf5d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsClientImpl.java @@ -0,0 +1,1191 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("administratorName") AdministratorName 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/servers" + + "/{serverName}/administrators/{administratorName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("administratorName") AdministratorName administratorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @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, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("administratorName") AdministratorName administratorName, + @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}/administrators") + @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 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + 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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + 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 the {@link PollerFlux} for polling of azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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..5135df748f4e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsImpl.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + +public final class ServerAzureADAdministratorsImpl implements ServerAzureADAdministrators { + private static 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..34d0b924970c0 --- /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..a8375d34d01a5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsClientImpl.java @@ -0,0 +1,1221 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @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-11-01-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 along with {@link Response} on successful + * completion of {@link Mono}. + */ + @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-11-01-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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-11-01-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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-11-01-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 the {@link PollerFlux} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 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 as paginated response with {@link + * PagedFlux}. + */ + @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 as paginated response with {@link + * PagedFlux}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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..80d1cfd1ab833 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsImpl.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.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; + +public final class ServerAzureADOnlyAuthenticationsImpl implements ServerAzureADOnlyAuthentications { + private static 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..6a2819e4ccff9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesClientImpl.java @@ -0,0 +1,839 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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") + @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}/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("{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); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-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())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-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)); + } + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-11-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 the {@link PollerFlux} for polling of a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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(); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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..6bab331b168fb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesImpl.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.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; + +public final class ServerBlobAuditingPoliciesImpl implements ServerBlobAuditingPolicies { + private static 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 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 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 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..a3bd258753e99 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPolicyImpl.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.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 Boolean isDevopsAuditEnabled() { + return this.innerModel().isDevopsAuditEnabled(); + } + + 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 Boolean isStorageSecondaryKeyInUse() { + return this.innerModel().isStorageSecondaryKeyInUse(); + } + + public Boolean isAzureMonitorTargetEnabled() { + return this.innerModel().isAzureMonitorTargetEnabled(); + } + + public Integer queueDelayMs() { + return this.innerModel().queueDelayMs(); + } + + public Boolean isManagedIdentityInUse() { + return this.innerModel().isManagedIdentityInUse(); + } + + 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 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 withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled) { + this.innerModel().withIsDevopsAuditEnabled(isDevopsAuditEnabled); + 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 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; + } + + public ServerBlobAuditingPolicyImpl withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.innerModel().withIsManagedIdentityInUse(isManagedIdentityInUse); + 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 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/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..b98eb5ecbd699 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksClientImpl.java @@ -0,0 +1,978 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 the {@link PollerFlux} for polling of server communication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of server communication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of server communication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of server communication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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..b1d5536438472 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + +public final class ServerCommunicationLinksImpl implements ServerCommunicationLinks { + private static 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); + } + + 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..eb96c2905ce08 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesClientImpl.java @@ -0,0 +1,903 @@ +// Copyright (c) Microsoft Corporation. All rights 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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +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.ServerConnectionPolicyListResult; +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 ServerConnectionPoliciesClient. */ +public final class ServerConnectionPoliciesClientImpl implements ServerConnectionPoliciesClient { + /** 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"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/connectionPolicies/{connectionPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("connectionPolicyName") ConnectionPolicyName connectionPolicyName, + @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}/connectionPolicies/{connectionPolicyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("connectionPolicyName") ConnectionPolicyName connectionPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @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") + @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 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 a server connection policy along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + connectionPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server 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 a server connection policy along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + connectionPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a server 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 a server connection policy on successful completion of {@link Mono}. + */ + @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 a server 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 a server connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerConnectionPolicyInner get( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName) { + return getAsync(resourceGroupName, serverName, connectionPolicyName).block(); + } + + /** + * Gets a server 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 a server connection policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, connectionPolicyName, context).block(); + } + + /** + * Updates a server 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 server 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 connection policy along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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 = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + connectionPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a server 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 server 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 connection policy along with {@link Response} on successful completion of {@link Mono}. + */ + @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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (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 = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + connectionPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a server 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 server 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 {@link PollerFlux} for polling of a server connection policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerConnectionPolicyInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, connectionPolicyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerConnectionPolicyInner.class, + ServerConnectionPolicyInner.class, + this.client.getContext()); + } + + /** + * Updates a server 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 server 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 {@link PollerFlux} for polling of a server connection policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerConnectionPolicyInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, connectionPolicyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerConnectionPolicyInner.class, + ServerConnectionPolicyInner.class, + context); + } + + /** + * Updates a server 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 server 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 {@link SyncPoller} for polling of a server connection policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerConnectionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters) + .getSyncPoller(); + } + + /** + * Updates a server 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 server 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 {@link SyncPoller} for polling of a server connection policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerConnectionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates a server 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 server 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 connection policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a server 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 server 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 connection policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a server 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 server 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 connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerConnectionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters).block(); + } + + /** + * Updates a server 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 server 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 connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerConnectionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters, context).block(); + } + + /** + * Lists 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 connection policy objects along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-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 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 connection policy objects along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2021-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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 connection policy objects as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 connection policy objects as paginated response with {@link PagedFlux}. + */ + @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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 connection policy objects as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Lists 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 connection policy objects as paginated response with {@link PagedIterable}. + */ + @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 connection policy objects along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 connection policy objects along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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/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..22507fcce230f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesImpl.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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; + +public final class ServerConnectionPoliciesImpl implements ServerConnectionPolicies { + private static 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 PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerConnectionPolicyImpl(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 ServerConnectionPolicyImpl(inner1, this.manager())); + } + + 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..6948ba0946843 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPolicyImpl.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.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 location() { + return this.innerModel().location(); + } + + public String kind() { + return this.innerModel().kind(); + } + + 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() + .createOrUpdate(resourceGroupName, serverName, connectionPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerConnectionPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerConnectionPolicies() + .createOrUpdate(resourceGroupName, serverName, connectionPolicyName, this.innerModel(), context); + 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() + .createOrUpdate(resourceGroupName, serverName, connectionPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerConnectionPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerConnectionPolicies() + .createOrUpdate(resourceGroupName, serverName, connectionPolicyName, this.innerModel(), context); + 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..67228e34d21b0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsClientImpl.java @@ -0,0 +1,918 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-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 the {@link PollerFlux} for polling of a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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)); + } + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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..30ab86e517a89 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsImpl.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + +public final class ServerDevOpsAuditSettingsImpl implements ServerDevOpsAuditSettings { + private static 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..34cd74aa633fd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesClientImpl.java @@ -0,0 +1,1438 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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({"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, + @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 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 a server DNS alias along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .acquire( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + 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 a server DNS alias along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .acquire( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + 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 {@link PollerFlux} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerDnsAliasInner> beginAcquireAsync( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters) { + Mono>> mono = + acquireWithResponseAsync(resourceGroupName, serverName, dnsAliasName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerDnsAliasInner.class, + ServerDnsAliasInner.class, + this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerDnsAliasInner> 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(), ServerDnsAliasInner.class, ServerDnsAliasInner.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 {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerDnsAliasInner> 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 {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerDnsAliasInner> 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 a server DNS alias on successful completion of {@link Mono}. + */ + @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 a server DNS alias on successful completion of {@link Mono}. + */ + @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. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDnsAliasInner acquire( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters) { + return 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. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDnsAliasInner acquire( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context) { + return 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..bc3ec0494d5e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesImpl.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +public final class ServerDnsAliasesImpl implements ServerDnsAliases { + private static 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 ServerDnsAlias acquire( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters) { + ServerDnsAliasInner inner = + this.serviceClient().acquire(resourceGroupName, serverName, dnsAliasName, parameters); + if (inner != null) { + return new ServerDnsAliasImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerDnsAlias acquire( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context) { + ServerDnsAliasInner inner = + this.serviceClient().acquire(resourceGroupName, serverName, dnsAliasName, parameters, context); + if (inner != null) { + return new ServerDnsAliasImpl(inner, this.manager()); + } else { + return null; + } + } + + 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..639f92e50505a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerImpl.java @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. All rights 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.ImportExportOperationResult; +import com.azure.resourcemanager.sql.generated.models.ImportNewDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ResourceIdentity; +import com.azure.resourcemanager.sql.generated.models.Server; +import com.azure.resourcemanager.sql.generated.models.ServerExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ServerNetworkAccessFlag; +import com.azure.resourcemanager.sql.generated.models.ServerPrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.ServerUpdate; +import com.azure.resourcemanager.sql.generated.models.ServerWorkspaceFeature; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +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 ServerNetworkAccessFlag publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public ServerWorkspaceFeature workspaceFeature() { + return this.innerModel().workspaceFeature(); + } + + public String primaryUserAssignedIdentityId() { + return this.innerModel().primaryUserAssignedIdentityId(); + } + + public UUID federatedClientId() { + return this.innerModel().federatedClientId(); + } + + public String keyId() { + return this.innerModel().keyId(); + } + + public ServerExternalAdministrator administrators() { + return this.innerModel().administrators(); + } + + public ServerNetworkAccessFlag restrictOutboundNetworkAccess() { + return this.innerModel().restrictOutboundNetworkAccess(); + } + + 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() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .getByResourceGroupWithResponse(resourceGroupName, serverName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public Server refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .getByResourceGroupWithResponse(resourceGroupName, serverName, localExpand, context) + .getValue(); + return this; + } + + public ImportExportOperationResult importDatabase(ImportNewDatabaseDefinition parameters) { + return serviceManager.servers().importDatabase(resourceGroupName, serverName, parameters); + } + + public ImportExportOperationResult importDatabase(ImportNewDatabaseDefinition parameters, Context context) { + return serviceManager.servers().importDatabase(resourceGroupName, serverName, parameters, context); + } + + 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) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public ServerImpl withAdministratorLogin(String administratorLogin) { + this.innerModel().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(ServerNetworkAccessFlag publicNetworkAccess) { + if (isInCreateMode()) { + this.innerModel().withPublicNetworkAccess(publicNetworkAccess); + return this; + } else { + this.updateParameters.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + } + + public ServerImpl withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + if (isInCreateMode()) { + this.innerModel().withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } else { + this.updateParameters.withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } + } + + public ServerImpl withFederatedClientId(UUID federatedClientId) { + if (isInCreateMode()) { + this.innerModel().withFederatedClientId(federatedClientId); + return this; + } else { + this.updateParameters.withFederatedClientId(federatedClientId); + return this; + } + } + + public ServerImpl withKeyId(String keyId) { + if (isInCreateMode()) { + this.innerModel().withKeyId(keyId); + return this; + } else { + this.updateParameters.withKeyId(keyId); + return this; + } + } + + public ServerImpl withAdministrators(ServerExternalAdministrator administrators) { + this.innerModel().withAdministrators(administrators); + return this; + } + + public ServerImpl withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag restrictOutboundNetworkAccess) { + if (isInCreateMode()) { + this.innerModel().withRestrictOutboundNetworkAccess(restrictOutboundNetworkAccess); + return this; + } else { + this.updateParameters.withRestrictOutboundNetworkAccess(restrictOutboundNetworkAccess); + 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..80913bba2d50a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeyImpl.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.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 Boolean autoRotationEnabled() { + return this.innerModel().autoRotationEnabled(); + } + + 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 withServerKeyType(ServerKeyType serverKeyType) { + this.innerModel().withServerKeyType(serverKeyType); + return this; + } + + public ServerKeyImpl 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/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..7cfbaf731baca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysClientImpl.java @@ -0,0 +1,1151 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @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 the {@link PollerFlux} for polling of a server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @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 the {@link PollerFlux} for polling of a server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @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 the {@link SyncPoller} for polling of a server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @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 the {@link SyncPoller} for polling of a server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @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 on successful completion of {@link Mono}. + */ + @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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @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 on successful completion of {@link Mono}. + */ + @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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..dd6e3beb2e17f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysImpl.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.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; + +public final class ServerKeysImpl implements ServerKeys { + private static 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/ServerOperationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationImpl.java new file mode 100644 index 0000000000000..afcbefe115a57 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationImpl.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.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerOperationInner; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.azure.resourcemanager.sql.generated.models.ServerOperation; +import java.time.OffsetDateTime; + +public final class ServerOperationImpl implements ServerOperation { + private ServerOperationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ServerOperationImpl( + ServerOperationInner 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 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 ServerOperationInner 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/ServerOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationsClientImpl.java new file mode 100644 index 0000000000000..8489146052efa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationsClientImpl.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.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.resourcemanager.sql.generated.fluent.ServerOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerOperationInner; +import com.azure.resourcemanager.sql.generated.models.ServerOperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerOperationsClient. */ +public final class ServerOperationsClientImpl implements ServerOperationsClient { + /** The proxy service used to perform REST calls. */ + private final ServerOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/operations") + @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 list of operations performed on the server. + * + * @param resourceGroupName The name of the resource group that 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 operations performed on the server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 operations performed on the server. + * + * @param resourceGroupName The name of the resource group that contains 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 operations performed on the server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 operations performed on the server. + * + * @param resourceGroupName The name of the resource group that 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 operations performed on the server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of operations performed on the server. + * + * @param resourceGroupName The name of the resource group that contains 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 operations performed on the server as paginated response with {@link PagedFlux}. + */ + @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 operations performed on the server. + * + * @param resourceGroupName The name of the resource group that 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 operations performed on the server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of operations performed on the server. + * + * @param resourceGroupName The name of the resource group that contains 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 operations performed on the server as paginated response with {@link PagedIterable}. + */ + @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 the response to a list server operations request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 response to a list server operations request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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/ServerOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationsImpl.java new file mode 100644 index 0000000000000..baa76bb93982f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationsImpl.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.ServerOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerOperationInner; +import com.azure.resourcemanager.sql.generated.models.ServerOperation; +import com.azure.resourcemanager.sql.generated.models.ServerOperations; + +public final class ServerOperationsImpl implements ServerOperations { + private static final ClientLogger LOGGER = new ClientLogger(ServerOperationsImpl.class); + + private final ServerOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerOperationsImpl( + ServerOperationsClient 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 ServerOperationImpl(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 ServerOperationImpl(inner1, this.manager())); + } + + private ServerOperationsClient 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/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..2cbc5a9affd7e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,911 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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.SecurityAlertPolicyName; +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 { + /** 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") 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/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") SecurityAlertPolicyName 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, 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 (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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, 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 (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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyName 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, SecurityAlertPolicyName 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName 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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName 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 = "2020-11-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 the {@link PollerFlux} for polling of a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerSecurityAlertPolicyInner.class, + ServerSecurityAlertPolicyInner.class, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName 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 the {@link SyncPoller} for polling of a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName 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 the {@link SyncPoller} for polling of a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName 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, + SecurityAlertPolicyName 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, + SecurityAlertPolicyName 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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)); + } + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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..1c95a72258815 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesImpl.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.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.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicy; + +public final class ServerSecurityAlertPoliciesImpl implements ServerSecurityAlertPolicies { + private static 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, SecurityAlertPolicyName 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, SecurityAlertPolicyName 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))); + } + 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, 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))); + } + 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, securityAlertPolicyName, context); + } + + private ServerSecurityAlertPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerSecurityAlertPolicyImpl define(SecurityAlertPolicyName 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..899b7984f4711 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPolicyImpl.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.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public SecurityAlertsPolicyState 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 SecurityAlertPolicyName 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( + SecurityAlertPolicyName 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 = + SecurityAlertPolicyName.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(SecurityAlertsPolicyState 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/ServerTrustCertificateImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificateImpl.java new file mode 100644 index 0000000000000..124f0bf01d531 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificateImpl.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.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustCertificateInner; +import com.azure.resourcemanager.sql.generated.models.ServerTrustCertificate; + +public final class ServerTrustCertificateImpl + implements ServerTrustCertificate, ServerTrustCertificate.Definition, ServerTrustCertificate.Update { + private ServerTrustCertificateInner 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 publicBlob() { + return this.innerModel().publicBlob(); + } + + public String thumbprint() { + return this.innerModel().thumbprint(); + } + + public String certificateName() { + return this.innerModel().certificateName(); + } + + public ServerTrustCertificateInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String certificateName; + + public ServerTrustCertificateImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ServerTrustCertificate create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustCertificates() + .createOrUpdate( + resourceGroupName, managedInstanceName, certificateName, this.innerModel(), Context.NONE); + return this; + } + + public ServerTrustCertificate create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustCertificates() + .createOrUpdate(resourceGroupName, managedInstanceName, certificateName, this.innerModel(), context); + return this; + } + + ServerTrustCertificateImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerTrustCertificateInner(); + this.serviceManager = serviceManager; + this.certificateName = name; + } + + public ServerTrustCertificateImpl update() { + return this; + } + + public ServerTrustCertificate apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustCertificates() + .createOrUpdate( + resourceGroupName, managedInstanceName, certificateName, this.innerModel(), Context.NONE); + return this; + } + + public ServerTrustCertificate apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustCertificates() + .createOrUpdate(resourceGroupName, managedInstanceName, certificateName, this.innerModel(), context); + return this; + } + + ServerTrustCertificateImpl( + ServerTrustCertificateInner 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.certificateName = Utils.getValueFromIdByName(innerObject.id(), "serverTrustCertificates"); + } + + public ServerTrustCertificate refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustCertificates() + .getWithResponse(resourceGroupName, managedInstanceName, certificateName, Context.NONE) + .getValue(); + return this; + } + + public ServerTrustCertificate refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustCertificates() + .getWithResponse(resourceGroupName, managedInstanceName, certificateName, context) + .getValue(); + return this; + } + + public ServerTrustCertificateImpl withPublicBlob(String publicBlob) { + this.innerModel().withPublicBlob(publicBlob); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificatesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificatesClientImpl.java new file mode 100644 index 0000000000000..c0d9991b8eecd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificatesClientImpl.java @@ -0,0 +1,1209 @@ +// Copyright (c) Microsoft Corporation. All rights 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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerTrustCertificatesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustCertificateInner; +import com.azure.resourcemanager.sql.generated.models.ServerTrustCertificatesListResult; +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 ServerTrustCertificatesClient. */ +public final class ServerTrustCertificatesClientImpl implements ServerTrustCertificatesClient { + /** The proxy service used to perform REST calls. */ + private final ServerTrustCertificatesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerTrustCertificatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerTrustCertificatesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ServerTrustCertificatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerTrustCertificates to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface ServerTrustCertificatesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/serverTrustCertificates") + @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}/serverTrustCertificates/{certificateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("certificateName") String certificateName, + @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}/serverTrustCertificates/{certificateName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("certificateName") String certificateName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerTrustCertificateInner 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}/serverTrustCertificates/{certificateName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("certificateName") String certificateName, + @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 server trust certificates that were uploaded from box to the given Sql 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 server trust certificates that were uploaded from box to the given Sql Managed Instance along + * with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2021-11-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 server trust certificates that were uploaded from box to the given Sql 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 server trust certificates that were uploaded from box to the given Sql Managed Instance along + * with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2021-11-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 server trust certificates that were uploaded from box to the given Sql 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 server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedFlux}. + */ + @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 trust certificates that were uploaded from box to the given Sql 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 server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedFlux}. + */ + @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 trust certificates that were uploaded from box to the given Sql 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 server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 server trust certificate that was uploaded from box to Sql Managed Instance along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String certificateName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + certificateName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 server trust certificate that was uploaded from box to Sql Managed Instance along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + certificateName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 server trust certificate that was uploaded from box to Sql Managed Instance on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String certificateName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, certificateName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 server trust certificate that was uploaded from box to Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerTrustCertificateInner get( + String resourceGroupName, String managedInstanceName, String certificateName) { + return getAsync(resourceGroupName, managedInstanceName, certificateName).block(); + } + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 server trust certificate that was uploaded from box to Sql Managed Instance along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, certificateName, context).block(); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate 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 server trust certificate imported from box to enable connection between box and Sql Managed Instance + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner 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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and 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 = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + certificateName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate 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 server trust certificate imported from box to enable connection between box and Sql Managed Instance + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner 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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and 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 = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + certificateName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate 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 the {@link PollerFlux} for polling of server trust certificate imported from box to enable connection + * between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerTrustCertificateInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, certificateName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerTrustCertificateInner.class, + ServerTrustCertificateInner.class, + this.client.getContext()); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate 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 the {@link PollerFlux} for polling of server trust certificate imported from box to enable connection + * between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerTrustCertificateInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, certificateName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerTrustCertificateInner.class, + ServerTrustCertificateInner.class, + context); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate 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 the {@link SyncPoller} for polling of server trust certificate imported from box to enable connection + * between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerTrustCertificateInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, certificateName, parameters) + .getSyncPoller(); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate 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 the {@link SyncPoller} for polling of server trust certificate imported from box to enable connection + * between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerTrustCertificateInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, certificateName, parameters, context) + .getSyncPoller(); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate 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 server trust certificate imported from box to enable connection between box and Sql Managed Instance on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, certificateName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate 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 server trust certificate imported from box to enable connection between box and Sql Managed Instance on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, certificateName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate 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 server trust certificate imported from box to enable connection between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerTrustCertificateInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, certificateName, parameters).block(); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate 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 server trust certificate imported from box to enable connection between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerTrustCertificateInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, certificateName, parameters, context) + .block(); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, String certificateName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + certificateName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + certificateName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String certificateName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, certificateName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, certificateName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String certificateName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, certificateName).getSyncPoller(); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, certificateName, context).getSyncPoller(); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String managedInstanceName, String certificateName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, certificateName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, certificateName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 managedInstanceName, String certificateName) { + deleteAsync(resourceGroupName, managedInstanceName, certificateName).block(); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 managedInstanceName, String certificateName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, certificateName, 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 trust certificates in instance along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 certificates in instance along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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/ServerTrustCertificatesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificatesImpl.java new file mode 100644 index 0000000000000..c0b7f09efb100 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificatesImpl.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.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.ServerTrustCertificatesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustCertificateInner; +import com.azure.resourcemanager.sql.generated.models.ServerTrustCertificate; +import com.azure.resourcemanager.sql.generated.models.ServerTrustCertificates; + +public final class ServerTrustCertificatesImpl implements ServerTrustCertificates { + private static final ClientLogger LOGGER = new ClientLogger(ServerTrustCertificatesImpl.class); + + private final ServerTrustCertificatesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerTrustCertificatesImpl( + ServerTrustCertificatesClient 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 ServerTrustCertificateImpl(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 ServerTrustCertificateImpl(inner1, this.manager())); + } + + public ServerTrustCertificate get(String resourceGroupName, String managedInstanceName, String certificateName) { + ServerTrustCertificateInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, certificateName); + if (inner != null) { + return new ServerTrustCertificateImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, certificateName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerTrustCertificateImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, String certificateName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, certificateName); + } + + public void delete(String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, certificateName, context); + } + + public ServerTrustCertificate 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 certificateName = Utils.getValueFromIdByName(id, "serverTrustCertificates"); + if (certificateName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustCertificates'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, certificateName, 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 certificateName = Utils.getValueFromIdByName(id, "serverTrustCertificates"); + if (certificateName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustCertificates'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, certificateName, 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 certificateName = Utils.getValueFromIdByName(id, "serverTrustCertificates"); + if (certificateName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustCertificates'.", + id))); + } + this.delete(resourceGroupName, managedInstanceName, certificateName, 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 certificateName = Utils.getValueFromIdByName(id, "serverTrustCertificates"); + if (certificateName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustCertificates'.", + id))); + } + this.delete(resourceGroupName, managedInstanceName, certificateName, context); + } + + private ServerTrustCertificatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerTrustCertificateImpl define(String name) { + return new ServerTrustCertificateImpl(name, this.manager()); + } +} 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..dd72a76c0b7af --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupImpl.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.ServerTrustGroupInner; +import com.azure.resourcemanager.sql.generated.models.ServerInfo; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroup; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroupPropertiesTrustScopesItem; +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..ac8001c694031 --- /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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 the {@link PollerFlux} for polling of a server trust group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a server trust group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a server trust group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a server trust group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 {@link Response} on successful completion of {@link Mono}. + */ + @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-11-01-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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-11-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 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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-11-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 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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-11-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 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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-11-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 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..b158b54d72bef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsImpl.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.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; + +public final class ServerTrustGroupsImpl implements ServerTrustGroups { + private static 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..481b7cd33f437 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesClientImpl.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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..adbbbd6e2edcb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesImpl.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.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; + +public final class ServerUsagesImpl implements ServerUsages { + private static 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..aa363e94b9447 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsClientImpl.java @@ -0,0 +1,984 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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. Learn more about setting SQL vulnerability assessment + * with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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. Learn more about setting SQL vulnerability assessment + * with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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. Learn more about setting SQL vulnerability assessment + * with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that 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 on successful completion of {@link Mono}. + */ + @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. Learn more about setting SQL vulnerability assessment + * with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that 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. Learn more about setting SQL vulnerability assessment + * with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that 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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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())); + } + + /** + * 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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)); + } + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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..f706f2cee4bd9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + +public final class ServerVulnerabilityAssessmentsImpl implements ServerVulnerabilityAssessments { + private static 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); + } + + 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..c09d048cb0f93 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersClientImpl.java @@ -0,0 +1,2104 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/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, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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, + @QueryParam("$expand") String expand, + @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}/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"}) + @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"}) + @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. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + expand, + 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + expand, + 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. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String expand) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand), + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String expand = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand), + 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String expand, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand, 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String expand = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, expand)); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, String expand, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, expand, 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. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String serverName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (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 = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + serverName, + expand, + 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String serverName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (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 = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + serverName, + expand, + 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. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String serverName, String expand) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serverName, expand) + .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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String serverName) { + final String expand = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, serverName, expand) + .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) { + final String expand = null; + return getByResourceGroupAsync(resourceGroupName, serverName, expand).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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String serverName, String expand, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serverName, expand, 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 the {@link PollerFlux} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2021-02-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 the {@link PollerFlux} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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. + * + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String expand) { + 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 = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + expand, + 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), expand, 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. + * + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand) { + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String expand = null; + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all servers in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand, 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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String expand = null; + return new PagedIterable<>(listAsync(expand)); + } + + /** + * Gets a list of all servers in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String expand, Context context) { + return new PagedIterable<>(listAsync(expand, 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-02-01-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-02-01-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 the {@link PollerFlux} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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(); + } + + /** + * 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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-02-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 along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 = "2021-02-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest parameters, Context context) { + return checkNameAvailabilityWithResponseAsync(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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..211ed3ac70014 --- /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; + +public final class ServersImpl implements Servers { + private static 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, String expand, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, expand, 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, String expand, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, serverName, expand, 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(String expand, Context context) { + PagedIterable inner = this.serviceClient().list(expand, context); + return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + } + + 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 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 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))); + } + String localExpand = null; + return this.getByResourceGroupWithResponse(resourceGroupName, serverName, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String 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, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String 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..c4ba55d56ea98 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesClientImpl.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.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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 as paginated response with {@link + * PagedFlux}. + */ + @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 as paginated response with {@link + * PagedFlux}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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 as paginated response with {@link + * PagedIterable}. + */ + @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..deca7c7ab8521 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesImpl.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.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; + +public final class ServiceObjectivesImpl implements ServiceObjectives { + private static 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/SqlAgentConfigurationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentConfigurationImpl.java new file mode 100644 index 0000000000000..d7ebecd5209e9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentConfigurationImpl.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.SqlAgentConfigurationInner; +import com.azure.resourcemanager.sql.generated.models.SqlAgentConfiguration; +import com.azure.resourcemanager.sql.generated.models.SqlAgentConfigurationPropertiesState; + +public final class SqlAgentConfigurationImpl implements SqlAgentConfiguration { + private SqlAgentConfigurationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SqlAgentConfigurationImpl( + SqlAgentConfigurationInner 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 SqlAgentConfigurationPropertiesState state() { + return this.innerModel().state(); + } + + public SqlAgentConfigurationInner 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/SqlAgentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentsClientImpl.java new file mode 100644 index 0000000000000..843b1767d5d86 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentsClientImpl.java @@ -0,0 +1,426 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.SqlAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SqlAgentsClient. */ +public final class SqlAgentsClientImpl implements SqlAgentsClient { + /** The proxy service used to perform REST calls. */ + private final SqlAgentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SqlAgentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlAgentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(SqlAgentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSqlAgents to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + private interface SqlAgentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/sqlAgent/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @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}/sqlAgent/current") + @ExpectedResponses({200}) + @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") SqlAgentConfigurationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets current instance sql agent 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 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 current instance sql agent configuration along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets current instance sql agent 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 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 current instance sql agent configuration along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets current instance sql agent 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 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 current instance sql agent configuration on successful completion of {@link Mono}. + */ + @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 current instance sql agent 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 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 current instance sql agent configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlAgentConfigurationInner get(String resourceGroupName, String managedInstanceName) { + return getAsync(resourceGroupName, managedInstanceName).block(); + } + + /** + * Gets current instance sql agent 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 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 current instance sql agent configuration along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, context).block(); + } + + /** + * Puts new sql agent configuration to 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 A recoverable managed database 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 recoverable managed database resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner 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-11-01-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())); + } + + /** + * Puts new sql agent configuration to 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 A recoverable managed database 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 recoverable managed database resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner 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-11-01-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); + } + + /** + * Puts new sql agent configuration to 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 A recoverable managed database 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 recoverable managed database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Puts new sql agent configuration to 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 A recoverable managed database 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 recoverable managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlAgentConfigurationInner createOrUpdate( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, parameters).block(); + } + + /** + * Puts new sql agent configuration to 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 A recoverable managed database 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 recoverable managed database resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, parameters, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentsImpl.java new file mode 100644 index 0000000000000..c4438ba6208c3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentsImpl.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.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.SqlAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner; +import com.azure.resourcemanager.sql.generated.models.SqlAgentConfiguration; +import com.azure.resourcemanager.sql.generated.models.SqlAgents; + +public final class SqlAgentsImpl implements SqlAgents { + private static final ClientLogger LOGGER = new ClientLogger(SqlAgentsImpl.class); + + private final SqlAgentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SqlAgentsImpl( + SqlAgentsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SqlAgentConfiguration get(String resourceGroupName, String managedInstanceName) { + SqlAgentConfigurationInner inner = this.serviceClient().get(resourceGroupName, managedInstanceName); + if (inner != null) { + return new SqlAgentConfigurationImpl(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 SqlAgentConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlAgentConfiguration createOrUpdate( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters) { + SqlAgentConfigurationInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, managedInstanceName, parameters); + if (inner != null) { + return new SqlAgentConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters, Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse(resourceGroupName, managedInstanceName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlAgentConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SqlAgentsClient 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..618520e78ff26 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientBuilder.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.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 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 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 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 (pipeline == null) { + this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + 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..46191ee180d2a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientImpl.java @@ -0,0 +1,1983 @@ +// Copyright (c) Microsoft Corporation. All rights 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.DataWarehouseUserActivitiesOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseAdvisorsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseAutomaticTuningsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseColumnsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseExtensionsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseRecommendedActionsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSchemasClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseTablesClient; +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.DeletedServersClient; +import com.azure.resourcemanager.sql.generated.fluent.DistributedAvailabilityGroupsClient; +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.EndpointCertificatesClient; +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.IPv6FirewallRulesClient; +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.LedgerDigestUploadsOperationsClient; +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.MaintenanceWindowOptionsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.MaintenanceWindowsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedBackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseColumnsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseQueriesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseRecommendedSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseRestoreDetailsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSchemasClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSecurityEventsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseTablesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseTransparentDataEncryptionsClient; +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.ManagedInstancePrivateEndpointConnectionsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstancePrivateLinkResourcesClient; +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.OutboundFirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.sql.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.sql.generated.fluent.RecommendedSensitivityLabelsClient; +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.ServerAdvisorsClient; +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.ServerOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerTrustCertificatesClient; +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.SqlAgentsClient; +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.TimeZonesClient; +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 { + /** 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 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 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 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 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 DatabaseAdvisorsClient object to access its operations. */ + private final DatabaseAdvisorsClient databaseAdvisors; + + /** + * Gets the DatabaseAdvisorsClient object to access its operations. + * + * @return the DatabaseAdvisorsClient object. + */ + public DatabaseAdvisorsClient getDatabaseAdvisors() { + return this.databaseAdvisors; + } + + /** 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 DatabaseColumnsClient object to access its operations. */ + private final DatabaseColumnsClient databaseColumns; + + /** + * Gets the DatabaseColumnsClient object to access its operations. + * + * @return the DatabaseColumnsClient object. + */ + public DatabaseColumnsClient getDatabaseColumns() { + return this.databaseColumns; + } + + /** The DatabaseRecommendedActionsClient object to access its operations. */ + private final DatabaseRecommendedActionsClient databaseRecommendedActions; + + /** + * Gets the DatabaseRecommendedActionsClient object to access its operations. + * + * @return the DatabaseRecommendedActionsClient object. + */ + public DatabaseRecommendedActionsClient getDatabaseRecommendedActions() { + return this.databaseRecommendedActions; + } + + /** The DatabaseSchemasClient object to access its operations. */ + private final DatabaseSchemasClient databaseSchemas; + + /** + * Gets the DatabaseSchemasClient object to access its operations. + * + * @return the DatabaseSchemasClient object. + */ + public DatabaseSchemasClient getDatabaseSchemas() { + return this.databaseSchemas; + } + + /** The DatabaseSecurityAlertPoliciesClient object to access its operations. */ + private final DatabaseSecurityAlertPoliciesClient databaseSecurityAlertPolicies; + + /** + * Gets the DatabaseSecurityAlertPoliciesClient object to access its operations. + * + * @return the DatabaseSecurityAlertPoliciesClient object. + */ + public DatabaseSecurityAlertPoliciesClient getDatabaseSecurityAlertPolicies() { + return this.databaseSecurityAlertPolicies; + } + + /** The DatabaseTablesClient object to access its operations. */ + private final DatabaseTablesClient databaseTables; + + /** + * Gets the DatabaseTablesClient object to access its operations. + * + * @return the DatabaseTablesClient object. + */ + public DatabaseTablesClient getDatabaseTables() { + return this.databaseTables; + } + + /** 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 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 DataWarehouseUserActivitiesOperationsClient object to access its operations. */ + private final DataWarehouseUserActivitiesOperationsClient dataWarehouseUserActivitiesOperations; + + /** + * Gets the DataWarehouseUserActivitiesOperationsClient object to access its operations. + * + * @return the DataWarehouseUserActivitiesOperationsClient object. + */ + public DataWarehouseUserActivitiesOperationsClient getDataWarehouseUserActivitiesOperations() { + return this.dataWarehouseUserActivitiesOperations; + } + + /** The DeletedServersClient object to access its operations. */ + private final DeletedServersClient deletedServers; + + /** + * Gets the DeletedServersClient object to access its operations. + * + * @return the DeletedServersClient object. + */ + public DeletedServersClient getDeletedServers() { + return this.deletedServers; + } + + /** 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 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 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 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 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 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 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 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 MaintenanceWindowOptionsOperationsClient object to access its operations. */ + private final MaintenanceWindowOptionsOperationsClient maintenanceWindowOptionsOperations; + + /** + * Gets the MaintenanceWindowOptionsOperationsClient object to access its operations. + * + * @return the MaintenanceWindowOptionsOperationsClient object. + */ + public MaintenanceWindowOptionsOperationsClient getMaintenanceWindowOptionsOperations() { + return this.maintenanceWindowOptionsOperations; + } + + /** The MaintenanceWindowsOperationsClient object to access its operations. */ + private final MaintenanceWindowsOperationsClient maintenanceWindowsOperations; + + /** + * Gets the MaintenanceWindowsOperationsClient object to access its operations. + * + * @return the MaintenanceWindowsOperationsClient object. + */ + public MaintenanceWindowsOperationsClient getMaintenanceWindowsOperations() { + return this.maintenanceWindowsOperations; + } + + /** 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 ManagedDatabaseColumnsClient object to access its operations. */ + private final ManagedDatabaseColumnsClient managedDatabaseColumns; + + /** + * Gets the ManagedDatabaseColumnsClient object to access its operations. + * + * @return the ManagedDatabaseColumnsClient object. + */ + public ManagedDatabaseColumnsClient getManagedDatabaseColumns() { + return this.managedDatabaseColumns; + } + + /** The ManagedDatabaseQueriesClient object to access its operations. */ + private final ManagedDatabaseQueriesClient managedDatabaseQueries; + + /** + * Gets the ManagedDatabaseQueriesClient object to access its operations. + * + * @return the ManagedDatabaseQueriesClient object. + */ + public ManagedDatabaseQueriesClient getManagedDatabaseQueries() { + return this.managedDatabaseQueries; + } + + /** 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 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 ManagedDatabaseSchemasClient object to access its operations. */ + private final ManagedDatabaseSchemasClient managedDatabaseSchemas; + + /** + * Gets the ManagedDatabaseSchemasClient object to access its operations. + * + * @return the ManagedDatabaseSchemasClient object. + */ + public ManagedDatabaseSchemasClient getManagedDatabaseSchemas() { + return this.managedDatabaseSchemas; + } + + /** 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 ManagedDatabaseSecurityEventsClient object to access its operations. */ + private final ManagedDatabaseSecurityEventsClient managedDatabaseSecurityEvents; + + /** + * Gets the ManagedDatabaseSecurityEventsClient object to access its operations. + * + * @return the ManagedDatabaseSecurityEventsClient object. + */ + public ManagedDatabaseSecurityEventsClient getManagedDatabaseSecurityEvents() { + return this.managedDatabaseSecurityEvents; + } + + /** The ManagedDatabaseTablesClient object to access its operations. */ + private final ManagedDatabaseTablesClient managedDatabaseTables; + + /** + * Gets the ManagedDatabaseTablesClient object to access its operations. + * + * @return the ManagedDatabaseTablesClient object. + */ + public ManagedDatabaseTablesClient getManagedDatabaseTables() { + return this.managedDatabaseTables; + } + + /** The ManagedDatabaseTransparentDataEncryptionsClient object to access its operations. */ + private final ManagedDatabaseTransparentDataEncryptionsClient managedDatabaseTransparentDataEncryptions; + + /** + * Gets the ManagedDatabaseTransparentDataEncryptionsClient object to access its operations. + * + * @return the ManagedDatabaseTransparentDataEncryptionsClient object. + */ + public ManagedDatabaseTransparentDataEncryptionsClient getManagedDatabaseTransparentDataEncryptions() { + return this.managedDatabaseTransparentDataEncryptions; + } + + /** 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 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 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 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 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 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 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 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 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 ManagedInstancePrivateEndpointConnectionsClient object to access its operations. */ + private final ManagedInstancePrivateEndpointConnectionsClient managedInstancePrivateEndpointConnections; + + /** + * Gets the ManagedInstancePrivateEndpointConnectionsClient object to access its operations. + * + * @return the ManagedInstancePrivateEndpointConnectionsClient object. + */ + public ManagedInstancePrivateEndpointConnectionsClient getManagedInstancePrivateEndpointConnections() { + return this.managedInstancePrivateEndpointConnections; + } + + /** The ManagedInstancePrivateLinkResourcesClient object to access its operations. */ + private final ManagedInstancePrivateLinkResourcesClient managedInstancePrivateLinkResources; + + /** + * Gets the ManagedInstancePrivateLinkResourcesClient object to access its operations. + * + * @return the ManagedInstancePrivateLinkResourcesClient object. + */ + public ManagedInstancePrivateLinkResourcesClient getManagedInstancePrivateLinkResources() { + return this.managedInstancePrivateLinkResources; + } + + /** 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 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 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 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 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 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; + } + + /** 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 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 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 ServerAdvisorsClient object to access its operations. */ + private final ServerAdvisorsClient serverAdvisors; + + /** + * Gets the ServerAdvisorsClient object to access its operations. + * + * @return the ServerAdvisorsClient object. + */ + public ServerAdvisorsClient getServerAdvisors() { + return this.serverAdvisors; + } + + /** 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 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 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 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 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 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 ServerOperationsClient object to access its operations. */ + private final ServerOperationsClient serverOperations; + + /** + * Gets the ServerOperationsClient object to access its operations. + * + * @return the ServerOperationsClient object. + */ + public ServerOperationsClient getServerOperations() { + return this.serverOperations; + } + + /** 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 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 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 SqlAgentsClient object to access its operations. */ + private final SqlAgentsClient sqlAgents; + + /** + * Gets the SqlAgentsClient object to access its operations. + * + * @return the SqlAgentsClient object. + */ + public SqlAgentsClient getSqlAgents() { + return this.sqlAgents; + } + + /** 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 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 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 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 TimeZonesClient object to access its operations. */ + private final TimeZonesClient timeZones; + + /** + * Gets the TimeZonesClient object to access its operations. + * + * @return the TimeZonesClient object. + */ + public TimeZonesClient getTimeZones() { + return this.timeZones; + } + + /** 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 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 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 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 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 DatabaseExtensionsOperationsClient object to access its operations. */ + private final DatabaseExtensionsOperationsClient databaseExtensionsOperations; + + /** + * Gets the DatabaseExtensionsOperationsClient object to access its operations. + * + * @return the DatabaseExtensionsOperationsClient object. + */ + public DatabaseExtensionsOperationsClient getDatabaseExtensionsOperations() { + return this.databaseExtensionsOperations; + } + + /** 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 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 LedgerDigestUploadsOperationsClient object to access its operations. */ + private final LedgerDigestUploadsOperationsClient ledgerDigestUploadsOperations; + + /** + * Gets the LedgerDigestUploadsOperationsClient object to access its operations. + * + * @return the LedgerDigestUploadsOperationsClient object. + */ + public LedgerDigestUploadsOperationsClient getLedgerDigestUploadsOperations() { + return this.ledgerDigestUploadsOperations; + } + + /** The OutboundFirewallRulesClient object to access its operations. */ + private final OutboundFirewallRulesClient outboundFirewallRules; + + /** + * Gets the OutboundFirewallRulesClient object to access its operations. + * + * @return the OutboundFirewallRulesClient object. + */ + public OutboundFirewallRulesClient getOutboundFirewallRules() { + return this.outboundFirewallRules; + } + + /** 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 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 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 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 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 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 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 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 DistributedAvailabilityGroupsClient object to access its operations. */ + private final DistributedAvailabilityGroupsClient distributedAvailabilityGroups; + + /** + * Gets the DistributedAvailabilityGroupsClient object to access its operations. + * + * @return the DistributedAvailabilityGroupsClient object. + */ + public DistributedAvailabilityGroupsClient getDistributedAvailabilityGroups() { + return this.distributedAvailabilityGroups; + } + + /** The ServerTrustCertificatesClient object to access its operations. */ + private final ServerTrustCertificatesClient serverTrustCertificates; + + /** + * Gets the ServerTrustCertificatesClient object to access its operations. + * + * @return the ServerTrustCertificatesClient object. + */ + public ServerTrustCertificatesClient getServerTrustCertificates() { + return this.serverTrustCertificates; + } + + /** The IPv6FirewallRulesClient object to access its operations. */ + private final IPv6FirewallRulesClient iPv6FirewallRules; + + /** + * Gets the IPv6FirewallRulesClient object to access its operations. + * + * @return the IPv6FirewallRulesClient object. + */ + public IPv6FirewallRulesClient getIPv6FirewallRules() { + return this.iPv6FirewallRules; + } + + /** The EndpointCertificatesClient object to access its operations. */ + private final EndpointCertificatesClient endpointCertificates; + + /** + * Gets the EndpointCertificatesClient object to access its operations. + * + * @return the EndpointCertificatesClient object. + */ + public EndpointCertificatesClient getEndpointCertificates() { + return this.endpointCertificates; + } + + /** 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 ManagedDatabaseRecommendedSensitivityLabelsClient object to access its operations. */ + private final ManagedDatabaseRecommendedSensitivityLabelsClient managedDatabaseRecommendedSensitivityLabels; + + /** + * Gets the ManagedDatabaseRecommendedSensitivityLabelsClient object to access its operations. + * + * @return the ManagedDatabaseRecommendedSensitivityLabelsClient object. + */ + public ManagedDatabaseRecommendedSensitivityLabelsClient getManagedDatabaseRecommendedSensitivityLabels() { + return this.managedDatabaseRecommendedSensitivityLabels; + } + + /** 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 RecommendedSensitivityLabelsClient object to access its operations. */ + private final RecommendedSensitivityLabelsClient recommendedSensitivityLabels; + + /** + * Gets the RecommendedSensitivityLabelsClient object to access its operations. + * + * @return the RecommendedSensitivityLabelsClient object. + */ + public RecommendedSensitivityLabelsClient getRecommendedSensitivityLabels() { + return this.recommendedSensitivityLabels; + } + + /** 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 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; + } + + /** + * 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.dataMaskingPolicies = new DataMaskingPoliciesClientImpl(this); + this.dataMaskingRules = new DataMaskingRulesClientImpl(this); + this.geoBackupPolicies = new GeoBackupPoliciesClientImpl(this); + this.databases = new DatabasesClientImpl(this); + this.elasticPools = new ElasticPoolsClientImpl(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.serverUsages = new ServerUsagesClientImpl(this); + this.databaseAdvisors = new DatabaseAdvisorsClientImpl(this); + this.databaseAutomaticTunings = new DatabaseAutomaticTuningsClientImpl(this); + this.databaseColumns = new DatabaseColumnsClientImpl(this); + this.databaseRecommendedActions = new DatabaseRecommendedActionsClientImpl(this); + this.databaseSchemas = new DatabaseSchemasClientImpl(this); + this.databaseSecurityAlertPolicies = new DatabaseSecurityAlertPoliciesClientImpl(this); + this.databaseTables = new DatabaseTablesClientImpl(this); + this.databaseVulnerabilityAssessmentRuleBaselines = + new DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl(this); + this.databaseVulnerabilityAssessments = new DatabaseVulnerabilityAssessmentsClientImpl(this); + this.databaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansClientImpl(this); + this.dataWarehouseUserActivitiesOperations = new DataWarehouseUserActivitiesOperationsClientImpl(this); + this.deletedServers = new DeletedServersClientImpl(this); + this.elasticPoolOperations = new ElasticPoolOperationsClientImpl(this); + this.encryptionProtectors = new EncryptionProtectorsClientImpl(this); + this.failoverGroups = new FailoverGroupsClientImpl(this); + this.firewallRules = new FirewallRulesClientImpl(this); + this.instanceFailoverGroups = new InstanceFailoverGroupsClientImpl(this); + this.instancePools = new InstancePoolsClientImpl(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.capabilities = new CapabilitiesClientImpl(this); + this.longTermRetentionPolicies = new LongTermRetentionPoliciesClientImpl(this); + this.maintenanceWindowOptionsOperations = new MaintenanceWindowOptionsOperationsClientImpl(this); + this.maintenanceWindowsOperations = new MaintenanceWindowsOperationsClientImpl(this); + this.managedBackupShortTermRetentionPolicies = new ManagedBackupShortTermRetentionPoliciesClientImpl(this); + this.managedDatabaseColumns = new ManagedDatabaseColumnsClientImpl(this); + this.managedDatabaseQueries = new ManagedDatabaseQueriesClientImpl(this); + this.managedDatabaseRestoreDetails = new ManagedDatabaseRestoreDetailsClientImpl(this); + this.managedDatabases = new ManagedDatabasesClientImpl(this); + this.managedDatabaseSchemas = new ManagedDatabaseSchemasClientImpl(this); + this.managedDatabaseSecurityAlertPolicies = new ManagedDatabaseSecurityAlertPoliciesClientImpl(this); + this.managedDatabaseSecurityEvents = new ManagedDatabaseSecurityEventsClientImpl(this); + this.managedDatabaseTables = new ManagedDatabaseTablesClientImpl(this); + this.managedDatabaseTransparentDataEncryptions = new ManagedDatabaseTransparentDataEncryptionsClientImpl(this); + this.managedDatabaseVulnerabilityAssessmentRuleBaselines = + new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl(this); + this.managedDatabaseVulnerabilityAssessments = new ManagedDatabaseVulnerabilityAssessmentsClientImpl(this); + this.managedDatabaseVulnerabilityAssessmentScans = + new ManagedDatabaseVulnerabilityAssessmentScansClientImpl(this); + this.managedInstanceAdministrators = new ManagedInstanceAdministratorsClientImpl(this); + this.managedInstanceAzureADOnlyAuthentications = new ManagedInstanceAzureADOnlyAuthenticationsClientImpl(this); + this.managedInstanceEncryptionProtectors = new ManagedInstanceEncryptionProtectorsClientImpl(this); + this.managedInstanceKeys = new ManagedInstanceKeysClientImpl(this); + this.managedInstanceLongTermRetentionPolicies = new ManagedInstanceLongTermRetentionPoliciesClientImpl(this); + this.managedInstanceOperations = new ManagedInstanceOperationsClientImpl(this); + this.managedInstancePrivateEndpointConnections = new ManagedInstancePrivateEndpointConnectionsClientImpl(this); + this.managedInstancePrivateLinkResources = new ManagedInstancePrivateLinkResourcesClientImpl(this); + this.managedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesClientImpl(this); + this.managedInstanceVulnerabilityAssessments = new ManagedInstanceVulnerabilityAssessmentsClientImpl(this); + this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies = + new ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl(this); + this.managedServerSecurityAlertPolicies = new ManagedServerSecurityAlertPoliciesClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.recoverableManagedDatabases = new RecoverableManagedDatabasesClientImpl(this); + this.restorePoints = new RestorePointsClientImpl(this); + this.serverAdvisors = new ServerAdvisorsClientImpl(this); + this.serverAutomaticTunings = new ServerAutomaticTuningsClientImpl(this); + this.serverAzureADAdministrators = new ServerAzureADAdministratorsClientImpl(this); + this.serverAzureADOnlyAuthentications = new ServerAzureADOnlyAuthenticationsClientImpl(this); + this.serverDevOpsAuditSettings = new ServerDevOpsAuditSettingsClientImpl(this); + this.serverDnsAliases = new ServerDnsAliasesClientImpl(this); + this.serverKeys = new ServerKeysClientImpl(this); + this.serverOperations = new ServerOperationsClientImpl(this); + this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesClientImpl(this); + this.serverTrustGroups = new ServerTrustGroupsClientImpl(this); + this.serverVulnerabilityAssessments = new ServerVulnerabilityAssessmentsClientImpl(this); + this.sqlAgents = new SqlAgentsClientImpl(this); + this.subscriptionUsages = new SubscriptionUsagesClientImpl(this); + this.syncAgents = new SyncAgentsClientImpl(this); + this.syncGroups = new SyncGroupsClientImpl(this); + this.syncMembers = new SyncMembersClientImpl(this); + this.tdeCertificates = new TdeCertificatesClientImpl(this); + this.timeZones = new TimeZonesClientImpl(this); + this.virtualClusters = new VirtualClustersClientImpl(this); + this.virtualNetworkRules = new VirtualNetworkRulesClientImpl(this); + this.workloadClassifiers = new WorkloadClassifiersClientImpl(this); + this.workloadGroups = new WorkloadGroupsClientImpl(this); + this.transparentDataEncryptions = new TransparentDataEncryptionsClientImpl(this); + this.backupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesClientImpl(this); + this.databaseExtensionsOperations = new DatabaseExtensionsOperationsClientImpl(this); + this.databaseOperations = new DatabaseOperationsClientImpl(this); + this.databaseUsages = new DatabaseUsagesClientImpl(this); + this.ledgerDigestUploadsOperations = new LedgerDigestUploadsOperationsClientImpl(this); + this.outboundFirewallRules = new OutboundFirewallRulesClientImpl(this); + this.servers = new ServersClientImpl(this); + this.usages = new UsagesClientImpl(this); + this.longTermRetentionBackups = new LongTermRetentionBackupsClientImpl(this); + this.longTermRetentionManagedInstanceBackups = new LongTermRetentionManagedInstanceBackupsClientImpl(this); + this.managedInstances = new ManagedInstancesClientImpl(this); + this.restorableDroppedDatabases = new RestorableDroppedDatabasesClientImpl(this); + this.restorableDroppedManagedDatabases = new RestorableDroppedManagedDatabasesClientImpl(this); + this.serverConnectionPolicies = new ServerConnectionPoliciesClientImpl(this); + this.distributedAvailabilityGroups = new DistributedAvailabilityGroupsClientImpl(this); + this.serverTrustCertificates = new ServerTrustCertificatesClientImpl(this); + this.iPv6FirewallRules = new IPv6FirewallRulesClientImpl(this); + this.endpointCertificates = new EndpointCertificatesClientImpl(this); + this.managedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsClientImpl(this); + this.managedDatabaseRecommendedSensitivityLabels = + new ManagedDatabaseRecommendedSensitivityLabelsClientImpl(this); + this.sensitivityLabels = new SensitivityLabelsClientImpl(this); + this.recommendedSensitivityLabels = new RecommendedSensitivityLabelsClientImpl(this); + this.serverBlobAuditingPolicies = new ServerBlobAuditingPoliciesClientImpl(this); + this.databaseBlobAuditingPolicies = new DatabaseBlobAuditingPoliciesClientImpl(this); + this.extendedDatabaseBlobAuditingPolicies = new ExtendedDatabaseBlobAuditingPoliciesClientImpl(this); + this.extendedServerBlobAuditingPolicies = new ExtendedServerBlobAuditingPoliciesClientImpl(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)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlManagementClientImpl.class); +} 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..ac87cfcc035ae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesClientImpl.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.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.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 { + /** 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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..2477eae4d7e49 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesImpl.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.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; + +public final class SubscriptionUsagesImpl implements SubscriptionUsages { + private static 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..8d66605196796 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentImpl.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.Response; +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.SyncAgentKeyProperties; +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 SyncAgentKeyProperties generateKey() { + return serviceManager.syncAgents().generateKey(resourceGroupName, serverName, syncAgentName); + } + + public Response generateKeyWithResponse(Context context) { + return serviceManager + .syncAgents() + .generateKeyWithResponse(resourceGroupName, serverName, syncAgentName, context); + } + + 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..7ee7b6eac56f0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsClientImpl.java @@ -0,0 +1,1622 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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)); + } + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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..90e38dc6f1b41 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsImpl.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.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; + +public final class SyncAgentsImpl implements SyncAgents { + private static 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..a2be482cdf819 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupImpl.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights 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.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner; +import com.azure.resourcemanager.sql.generated.models.Sku; +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 Sku sku() { + return this.innerModel().sku(); + } + + 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 enableConflictLogging() { + return this.innerModel().enableConflictLogging(); + } + + public Integer conflictLoggingRetentionInDays() { + return this.innerModel().conflictLoggingRetentionInDays(); + } + + 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 void refreshHubSchema() { + serviceManager.syncGroups().refreshHubSchema(resourceGroupName, serverName, databaseName, syncGroupName); + } + + public void refreshHubSchema(Context context) { + serviceManager + .syncGroups() + .refreshHubSchema(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public void cancelSync() { + serviceManager.syncGroups().cancelSync(resourceGroupName, serverName, databaseName, syncGroupName); + } + + public Response cancelSyncWithResponse(Context context) { + return serviceManager + .syncGroups() + .cancelSyncWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public void triggerSync() { + serviceManager.syncGroups().triggerSync(resourceGroupName, serverName, databaseName, syncGroupName); + } + + public Response triggerSyncWithResponse(Context context) { + return serviceManager + .syncGroups() + .triggerSyncWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public SyncGroupImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + 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 withEnableConflictLogging(Boolean enableConflictLogging) { + this.innerModel().withEnableConflictLogging(enableConflictLogging); + return this; + } + + public SyncGroupImpl withConflictLoggingRetentionInDays(Integer conflictLoggingRetentionInDays) { + this.innerModel().withConflictLoggingRetentionInDays(conflictLoggingRetentionInDays); + 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..aa27e36effd40 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsClientImpl.java @@ -0,0 +1,3385 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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)); + } + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..3f998e2a50f86 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsImpl.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.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; + +public final class SyncGroupsImpl implements SyncGroups { + private static 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..1968336eb72ed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMemberImpl.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.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 void refreshMemberSchema() { + serviceManager + .syncMembers() + .refreshMemberSchema(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName); + } + + public void refreshMemberSchema(Context context) { + serviceManager + .syncMembers() + .refreshMemberSchema(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + } + + 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..89b1e44edfda3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersClientImpl.java @@ -0,0 +1,2505 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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..edf871bdfc5c2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersImpl.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + +public final class SyncMembersImpl implements SyncMembers { + private static 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..a30fe6e5609c2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesClientImpl.java @@ -0,0 +1,338 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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..27b4a77b9d0b3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesImpl.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.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; + +public final class TdeCertificatesImpl implements TdeCertificates { + private static 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/TimeZoneImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZoneImpl.java new file mode 100644 index 0000000000000..6e87c4405a48b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZoneImpl.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.resourcemanager.sql.generated.fluent.models.TimeZoneInner; +import com.azure.resourcemanager.sql.generated.models.TimeZone; + +public final class TimeZoneImpl implements TimeZone { + private TimeZoneInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + TimeZoneImpl(TimeZoneInner 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 timeZoneId() { + return this.innerModel().timeZoneId(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public TimeZoneInner 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/TimeZonesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZonesClientImpl.java new file mode 100644 index 0000000000000..b63ca22793954 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZonesClientImpl.java @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.TimeZonesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.TimeZoneInner; +import com.azure.resourcemanager.sql.generated.models.TimeZoneListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TimeZonesClient. */ +public final class TimeZonesClientImpl implements TimeZonesClient { + /** The proxy service used to perform REST calls. */ + private final TimeZonesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of TimeZonesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TimeZonesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(TimeZonesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientTimeZones to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientT") + private interface TimeZonesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones") + @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}/timeZones/{timeZoneId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("timeZoneId") String timeZoneId, + @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 list of managed instance time zones by location. + * + * @param locationName The locationName 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 time zones by location along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 a list of managed instance time zones by location. + * + * @param locationName The locationName 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 time zones by location along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 a list of managed instance time zones by location. + * + * @param locationName The locationName 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 time zones by location as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName), nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName 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 time zones by location as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName 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 time zones by location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName) { + return new PagedIterable<>(listByLocationAsync(locationName)); + } + + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName 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 time zones by location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName, Context context) { + return new PagedIterable<>(listByLocationAsync(locationName, context)); + } + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId 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 managed instance time zone along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String locationName, String timeZoneId) { + 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 (timeZoneId == null) { + return Mono.error(new IllegalArgumentException("Parameter timeZoneId is required and cannot be 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, + timeZoneId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId 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 managed instance time zone along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String timeZoneId, 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 (timeZoneId == null) { + return Mono.error(new IllegalArgumentException("Parameter timeZoneId is required and cannot be 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, + timeZoneId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId 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 managed instance time zone on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String locationName, String timeZoneId) { + return getWithResponseAsync(locationName, timeZoneId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId 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 managed instance time zone. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TimeZoneInner get(String locationName, String timeZoneId) { + return getAsync(locationName, timeZoneId).block(); + } + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId 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 managed instance time zone along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String locationName, String timeZoneId, Context context) { + return getWithResponseAsync(locationName, timeZoneId, 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 time zones along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 time zones along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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/TimeZonesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZonesImpl.java new file mode 100644 index 0000000000000..f8b694410c499 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZonesImpl.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.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.TimeZonesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.TimeZoneInner; +import com.azure.resourcemanager.sql.generated.models.TimeZone; +import com.azure.resourcemanager.sql.generated.models.TimeZones; + +public final class TimeZonesImpl implements TimeZones { + private static final ClientLogger LOGGER = new ClientLogger(TimeZonesImpl.class); + + private final TimeZonesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public TimeZonesImpl( + TimeZonesClient 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 TimeZoneImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String locationName, Context context) { + PagedIterable inner = this.serviceClient().listByLocation(locationName, context); + return Utils.mapPage(inner, inner1 -> new TimeZoneImpl(inner1, this.manager())); + } + + public TimeZone get(String locationName, String timeZoneId) { + TimeZoneInner inner = this.serviceClient().get(locationName, timeZoneId); + if (inner != null) { + return new TimeZoneImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String locationName, String timeZoneId, Context context) { + Response inner = this.serviceClient().getWithResponse(locationName, timeZoneId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TimeZoneImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private TimeZonesClient 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..30a5b74427544 --- /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.QueryStatisticsProperties; +import com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner; +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/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..ee989d7c18329 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsClientImpl.java @@ -0,0 +1,831 @@ +// Copyright (c) Microsoft Corporation. All rights 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.resourcemanager.sql.generated.fluent.TransparentDataEncryptionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LogicalDatabaseTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.LogicalDatabaseTransparentDataEncryptionListResult; +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 { + /** 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"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("tdeName") TransparentDataEncryptionName tdeName, + @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}/transparentDataEncryption/{tdeName}") + @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("tdeName") TransparentDataEncryptionName tdeName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LogicalDatabaseTransparentDataEncryptionInner 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") + @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 logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName 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 logical database's transparent data encryption along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionName tdeName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName 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 logical database's transparent data encryption along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter 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 (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName 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 logical database's transparent data encryption on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionName tdeName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, tdeName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName 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 logical database's transparent data encryption. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogicalDatabaseTransparentDataEncryptionInner get( + String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionName tdeName) { + return getAsync(resourceGroupName, serverName, databaseName, tdeName).block(); + } + + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName 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 logical database's transparent data encryption along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, tdeName, context).block(); + } + + /** + * Updates a logical 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 logical database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database 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 a logical database transparent data encryption state along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + LogicalDatabaseTransparentDataEncryptionInner 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 (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and 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 = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a logical 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 logical database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database 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 a logical database transparent data encryption state along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + LogicalDatabaseTransparentDataEncryptionInner 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 (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and 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 = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a logical 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 logical database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database 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 a logical database transparent data encryption state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + LogicalDatabaseTransparentDataEncryptionInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, tdeName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a logical 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 logical database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database 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 a logical database transparent data encryption state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogicalDatabaseTransparentDataEncryptionInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + LogicalDatabaseTransparentDataEncryptionInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, tdeName, parameters).block(); + } + + /** + * Updates a logical 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 logical database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database 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 a logical database transparent data encryption state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + LogicalDatabaseTransparentDataEncryptionInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, tdeName, parameters, context) + .block(); + } + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption 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 logical database's transparent data encryption along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 = "2021-02-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 the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption 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 logical database's transparent data encryption along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 = "2021-02-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 the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption 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 logical database's transparent data encryption as paginated response with {@link + * PagedFlux}. + */ + @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 the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption 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 logical database's transparent data encryption as paginated response with {@link + * PagedFlux}. + */ + @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 the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption 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 logical database's transparent data encryption as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption 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 logical database's transparent data encryption as paginated response with {@link + * PagedIterable}. + */ + @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 transparent data encryptions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 transparent data encryptions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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/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..e096a72576197 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsImpl.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.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.TransparentDataEncryptionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LogicalDatabaseTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.LogicalDatabaseTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptions; + +public final class TransparentDataEncryptionsImpl implements TransparentDataEncryptions { + private static 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 LogicalDatabaseTransparentDataEncryption get( + String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionName tdeName) { + LogicalDatabaseTransparentDataEncryptionInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, tdeName); + if (inner != null) { + return new LogicalDatabaseTransparentDataEncryptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, tdeName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LogicalDatabaseTransparentDataEncryptionImpl(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 LogicalDatabaseTransparentDataEncryptionImpl(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 LogicalDatabaseTransparentDataEncryptionImpl(inner1, this.manager())); + } + + public LogicalDatabaseTransparentDataEncryption 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 tdeName = + TransparentDataEncryptionName.fromString(Utils.getValueFromIdByName(id, "transparentDataEncryption")); + if (tdeName == 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, tdeName, 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 tdeName = + TransparentDataEncryptionName.fromString(Utils.getValueFromIdByName(id, "transparentDataEncryption")); + if (tdeName == 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, tdeName, context); + } + + private TransparentDataEncryptionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public LogicalDatabaseTransparentDataEncryptionImpl define(TransparentDataEncryptionName name) { + return new LogicalDatabaseTransparentDataEncryptionImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UpdateManagedInstanceDnsServersOperationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UpdateManagedInstanceDnsServersOperationImpl.java new file mode 100644 index 0000000000000..8ee7133dfd1dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UpdateManagedInstanceDnsServersOperationImpl.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.UpdateManagedInstanceDnsServersOperationInner; +import com.azure.resourcemanager.sql.generated.models.DnsRefreshConfigurationPropertiesStatus; +import com.azure.resourcemanager.sql.generated.models.UpdateManagedInstanceDnsServersOperation; + +public final class UpdateManagedInstanceDnsServersOperationImpl implements UpdateManagedInstanceDnsServersOperation { + private UpdateManagedInstanceDnsServersOperationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + UpdateManagedInstanceDnsServersOperationImpl( + UpdateManagedInstanceDnsServersOperationInner 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 DnsRefreshConfigurationPropertiesStatus status() { + return this.innerModel().status(); + } + + public UpdateManagedInstanceDnsServersOperationInner 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/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..ec3bbc8a215b8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesClientImpl.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.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.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 { + /** 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-02-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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 = "2021-02-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..8b85cf68074f7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesImpl.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.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; + +public final class UsagesImpl implements Usages { + private static 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..88f1fa58c7e4e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClusterImpl.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.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 String maintenanceConfigurationId() { + return this.innerModel().maintenanceConfigurationId(); + } + + 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..50d3dacc70fcb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersClientImpl.java @@ -0,0 +1,1467 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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.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.UpdateManagedInstanceDnsServersOperationInner; +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 { + /** 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"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters" + + "/{virtualClusterName}/updateManagedInstanceDnsServers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateDnsServers( + @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({"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); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 recoverable managed database resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateDnsServersWithResponseAsync( + 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 = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateDnsServers( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 recoverable managed database resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateDnsServersWithResponseAsync( + 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 = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateDnsServers( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 recoverable managed database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateDnsServersAsync( + String resourceGroupName, String virtualClusterName) { + return updateDnsServersWithResponseAsync(resourceGroupName, virtualClusterName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 recoverable managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateManagedInstanceDnsServersOperationInner updateDnsServers( + String resourceGroupName, String virtualClusterName) { + return updateDnsServersAsync(resourceGroupName, virtualClusterName).block(); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 recoverable managed database resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateDnsServersWithResponse( + String resourceGroupName, String virtualClusterName, Context context) { + return updateDnsServersWithResponseAsync(resourceGroupName, virtualClusterName, context).block(); + } + + /** + * 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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-11-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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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-11-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 along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 virtual cluster 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 virtual cluster 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 virtual cluster 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 {@link PollerFlux} for polling of an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 virtual cluster 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 {@link PollerFlux} for polling of an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 virtual cluster 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 {@link SyncPoller} for polling of an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 virtual cluster 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 {@link SyncPoller} for polling of an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 virtual cluster 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 on successful completion of {@link Mono}. + */ + @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 virtual cluster 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 on successful completion of {@link Mono}. + */ + @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 virtual cluster 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 virtual cluster 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..7a922f73694d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersImpl.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.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.UpdateManagedInstanceDnsServersOperationInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner; +import com.azure.resourcemanager.sql.generated.models.UpdateManagedInstanceDnsServersOperation; +import com.azure.resourcemanager.sql.generated.models.VirtualCluster; +import com.azure.resourcemanager.sql.generated.models.VirtualClusterUpdate; +import com.azure.resourcemanager.sql.generated.models.VirtualClusters; + +public final class VirtualClustersImpl implements VirtualClusters { + private static 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 UpdateManagedInstanceDnsServersOperation updateDnsServers( + String resourceGroupName, String virtualClusterName) { + UpdateManagedInstanceDnsServersOperationInner inner = + this.serviceClient().updateDnsServers(resourceGroupName, virtualClusterName); + if (inner != null) { + return new UpdateManagedInstanceDnsServersOperationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateDnsServersWithResponse( + String resourceGroupName, String virtualClusterName, Context context) { + Response inner = + this.serviceClient().updateDnsServersWithResponse(resourceGroupName, virtualClusterName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new UpdateManagedInstanceDnsServersOperationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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..f04d7d0a1e13f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesClientImpl.java @@ -0,0 +1,1185 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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..25fd398367a4a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesImpl.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.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; + +public final class VirtualNetworkRulesImpl implements VirtualNetworkRules { + private static 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..b0727064fd639 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersClientImpl.java @@ -0,0 +1,1474 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion + * of {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 = "2020-11-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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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..78b9566739db3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersImpl.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +public final class WorkloadClassifiersImpl implements WorkloadClassifiers { + private static 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..ddcddadac126f --- /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 int minResourcePercent() { + return this.innerModel().minResourcePercent(); + } + + public int 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(int minResourcePercent) { + this.innerModel().withMinResourcePercent(minResourcePercent); + return this; + } + + public WorkloadGroupImpl withMaxResourcePercent(int 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..182c7d22b102a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsClientImpl.java @@ -0,0 +1,1260 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 { + /** 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 along with {@link Response} on successful completion of + * {@link Mono}. + */ + @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 = "2020-11-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 the {@link PollerFlux} for polling of workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, + this.client.getContext()); + } + + /** + * 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 the {@link PollerFlux} for polling of workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 the {@link SyncPoller} for polling of workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link Response} on successful completion of {@link Mono}. + */ + @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 = "2020-11-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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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, this.client.getContext()); + } + + /** + * 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + 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 A {@link Mono} that completes when a successful response is received. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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..ea87f01653f78 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsImpl.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.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; + +public final class WorkloadGroupsImpl implements WorkloadGroups { + private static 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..3d9fbd6a581e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorListResult.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.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of active directory administrators. */ +@Immutable +public final class AdministratorListResult { + /* + * 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/Advisor.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Advisor.java new file mode 100644 index 0000000000000..3c4e8e198b866 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Advisor.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.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Advisor. */ +public interface Advisor { + /** + * 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 location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the advisorStatus property: Gets the status of availability of this advisor to customers. Possible values + * are 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. + * + * @return the advisorStatus value. + */ + AdvisorStatus advisorStatus(); + + /** + * Gets the autoExecuteStatus property: Gets the auto-execute status (whether to let the system execute the + * recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. + * + * @return the autoExecuteStatus value. + */ + AutoExecuteStatus autoExecuteStatus(); + + /** + * Gets the autoExecuteStatusInheritedFrom property: Gets the resource from which current value of auto-execute + * status is inherited. Auto-execute status can be set on (and inherited from) different levels in the resource + * hierarchy. Possible values are 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when status is + * not explicitly set on any level). + * + * @return the autoExecuteStatusInheritedFrom value. + */ + AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom(); + + /** + * Gets the recommendationsStatus property: Gets that status of recommendations for this advisor and reason for not + * having any recommendations. Possible values include, but are not limited to, 'Ok' (Recommendations + * available),LowActivity (not enough workload to analyze), 'DbSeemsTuned' (Database is doing well), etc. + * + * @return the recommendationsStatus value. + */ + String recommendationsStatus(); + + /** + * Gets the lastChecked property: Gets the time when the current resource was analyzed for recommendations by this + * advisor. + * + * @return the lastChecked value. + */ + OffsetDateTime lastChecked(); + + /** + * Gets the recommendedActions property: Gets the recommended actions for this advisor. + * + * @return the recommendedActions value. + */ + List recommendedActions(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner object. + * + * @return the inner object. + */ + AdvisorInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvisorStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvisorStatus.java new file mode 100644 index 0000000000000..a030ca780e9c1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvisorStatus.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 AdvisorStatus. */ +public enum AdvisorStatus { + /** Enum value GA. */ + GA("GA"), + + /** Enum value PublicPreview. */ + PUBLIC_PREVIEW("PublicPreview"), + + /** Enum value LimitedPublicPreview. */ + LIMITED_PUBLIC_PREVIEW("LimitedPublicPreview"), + + /** Enum value PrivatePreview. */ + PRIVATE_PREVIEW("PrivatePreview"); + + /** The actual serialized value for a AdvisorStatus instance. */ + private final String value; + + AdvisorStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AdvisorStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed AdvisorStatus object, or null if unable to parse. + */ + @JsonCreator + public static AdvisorStatus fromString(String value) { + AdvisorStatus[] items = AdvisorStatus.values(); + for (AdvisorStatus 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/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/AutoExecuteStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoExecuteStatus.java new file mode 100644 index 0000000000000..97cf230355add --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoExecuteStatus.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 AutoExecuteStatus. */ +public enum AutoExecuteStatus { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Default. */ + DEFAULT("Default"); + + /** The actual serialized value for a AutoExecuteStatus instance. */ + private final String value; + + AutoExecuteStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutoExecuteStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed AutoExecuteStatus object, or null if unable to parse. + */ + @JsonCreator + public static AutoExecuteStatus fromString(String value) { + AutoExecuteStatus[] items = AutoExecuteStatus.values(); + for (AutoExecuteStatus 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/AutoExecuteStatusInheritedFrom.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoExecuteStatusInheritedFrom.java new file mode 100644 index 0000000000000..c9341a1d3adfe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoExecuteStatusInheritedFrom.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 AutoExecuteStatusInheritedFrom. */ +public enum AutoExecuteStatusInheritedFrom { + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Subscription. */ + SUBSCRIPTION("Subscription"), + + /** Enum value Server. */ + SERVER("Server"), + + /** Enum value ElasticPool. */ + ELASTIC_POOL("ElasticPool"), + + /** Enum value Database. */ + DATABASE("Database"); + + /** The actual serialized value for a AutoExecuteStatusInheritedFrom instance. */ + private final String value; + + AutoExecuteStatusInheritedFrom(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutoExecuteStatusInheritedFrom instance. + * + * @param value the serialized value to parse. + * @return the parsed AutoExecuteStatusInheritedFrom object, or null if unable to parse. + */ + @JsonCreator + public static AutoExecuteStatusInheritedFrom fromString(String value) { + AutoExecuteStatusInheritedFrom[] items = AutoExecuteStatusInheritedFrom.values(); + for (AutoExecuteStatusInheritedFrom 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/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..b2c728e361d99 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoPauseDelayTimeRange.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.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Supported auto pause delay time range. */ +@Immutable +public final class AutoPauseDelayTimeRange { + /* + * 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..8375c2833e3b9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptions.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Automatic tuning properties for individual advisors. */ +@Fluent +public final class AutomaticTuningOptions { + /* + * 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..0dbd58dece430 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerOptions.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Automatic tuning properties for individual advisors. */ +@Fluent +public final class AutomaticTuningServerOptions { + /* + * 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..ee22fc18d2f06 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AzureADOnlyAuthListResult.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.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of active directory only authentications. */ +@Immutable +public final class AzureADOnlyAuthListResult { + /* + * 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..ef8840b3d7a9e --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..a3018ad02bbbf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicy.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.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 diffBackupIntervalInHours property: The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only applicable to live databases but not + * dropped databases. + * + * @return the diffBackupIntervalInHours value. + */ + DiffBackupIntervalInHours diffBackupIntervalInHours(); + + /** + * 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, DefinitionStages.WithDiffBackupIntervalInHours { + /** + * 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); + } + /** The stage of the BackupShortTermRetentionPolicy definition allowing to specify diffBackupIntervalInHours. */ + interface WithDiffBackupIntervalInHours { + /** + * Specifies the diffBackupIntervalInHours property: The differential backup interval in hours. This is how + * many interval hours between each differential backup will be supported. This is only applicable to live + * databases but not dropped databases.. + * + * @param diffBackupIntervalInHours The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only applicable to live databases + * but not dropped databases. + * @return the next definition stage. + */ + WithCreate withDiffBackupIntervalInHours(DiffBackupIntervalInHours diffBackupIntervalInHours); + } + } + /** + * 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, UpdateStages.WithDiffBackupIntervalInHours { + /** + * 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); + } + /** The stage of the BackupShortTermRetentionPolicy update allowing to specify diffBackupIntervalInHours. */ + interface WithDiffBackupIntervalInHours { + /** + * Specifies the diffBackupIntervalInHours property: The differential backup interval in hours. This is how + * many interval hours between each differential backup will be supported. This is only applicable to live + * databases but not dropped databases.. + * + * @param diffBackupIntervalInHours The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only applicable to live databases + * but not dropped databases. + * @return the next definition stage. + */ + Update withDiffBackupIntervalInHours(DiffBackupIntervalInHours diffBackupIntervalInHours); + } + } + /** + * 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..c550d534d125c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicyListResult.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.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of short term retention policies. */ +@Immutable +public final class BackupShortTermRetentionPolicyListResult { + /* + * 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..48f01e9941391 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupStorageRedundancy.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 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"); + + /** Static value GeoZone for BackupStorageRedundancy. */ + public static final BackupStorageRedundancy GEO_ZONE = fromString("GeoZone"); + + /** + * 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..03bd7bf9c757c --- /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 along with {@link Response}. + */ + 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..26d5e669635ce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityRequest.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A request to check whether the specified name for a resource is available. */ +@Fluent +public final class CheckNameAvailabilityRequest { + /* + * The name property. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The type property. + */ + @JsonProperty(value = "type", required = true) + private String type = "Microsoft.Sql/servers"; + + /** 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CheckNameAvailabilityRequest.class); +} 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/ColumnDataType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ColumnDataType.java new file mode 100644 index 0000000000000..fea49ec70cb3e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ColumnDataType.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ColumnDataType. */ +public final class ColumnDataType extends ExpandableStringEnum { + /** Static value image for ColumnDataType. */ + public static final ColumnDataType IMAGE = fromString("image"); + + /** Static value text for ColumnDataType. */ + public static final ColumnDataType TEXT = fromString("text"); + + /** Static value uniqueidentifier for ColumnDataType. */ + public static final ColumnDataType UNIQUEIDENTIFIER = fromString("uniqueidentifier"); + + /** Static value date for ColumnDataType. */ + public static final ColumnDataType DATE = fromString("date"); + + /** Static value time for ColumnDataType. */ + public static final ColumnDataType TIME = fromString("time"); + + /** Static value datetime2 for ColumnDataType. */ + public static final ColumnDataType DATETIME2 = fromString("datetime2"); + + /** Static value datetimeoffset for ColumnDataType. */ + public static final ColumnDataType DATETIMEOFFSET = fromString("datetimeoffset"); + + /** Static value tinyint for ColumnDataType. */ + public static final ColumnDataType TINYINT = fromString("tinyint"); + + /** Static value smallint for ColumnDataType. */ + public static final ColumnDataType SMALLINT = fromString("smallint"); + + /** Static value int for ColumnDataType. */ + public static final ColumnDataType INT = fromString("int"); + + /** Static value smalldatetime for ColumnDataType. */ + public static final ColumnDataType SMALLDATETIME = fromString("smalldatetime"); + + /** Static value real for ColumnDataType. */ + public static final ColumnDataType REAL = fromString("real"); + + /** Static value money for ColumnDataType. */ + public static final ColumnDataType MONEY = fromString("money"); + + /** Static value datetime for ColumnDataType. */ + public static final ColumnDataType DATETIME = fromString("datetime"); + + /** Static value float for ColumnDataType. */ + public static final ColumnDataType FLOAT = fromString("float"); + + /** Static value sql_variant for ColumnDataType. */ + public static final ColumnDataType SQL_VARIANT = fromString("sql_variant"); + + /** Static value ntext for ColumnDataType. */ + public static final ColumnDataType NTEXT = fromString("ntext"); + + /** Static value bit for ColumnDataType. */ + public static final ColumnDataType BIT = fromString("bit"); + + /** Static value decimal for ColumnDataType. */ + public static final ColumnDataType DECIMAL = fromString("decimal"); + + /** Static value numeric for ColumnDataType. */ + public static final ColumnDataType NUMERIC = fromString("numeric"); + + /** Static value smallmoney for ColumnDataType. */ + public static final ColumnDataType SMALLMONEY = fromString("smallmoney"); + + /** Static value bigint for ColumnDataType. */ + public static final ColumnDataType BIGINT = fromString("bigint"); + + /** Static value hierarchyid for ColumnDataType. */ + public static final ColumnDataType HIERARCHYID = fromString("hierarchyid"); + + /** Static value geometry for ColumnDataType. */ + public static final ColumnDataType GEOMETRY = fromString("geometry"); + + /** Static value geography for ColumnDataType. */ + public static final ColumnDataType GEOGRAPHY = fromString("geography"); + + /** Static value varbinary for ColumnDataType. */ + public static final ColumnDataType VARBINARY = fromString("varbinary"); + + /** Static value varchar for ColumnDataType. */ + public static final ColumnDataType VARCHAR = fromString("varchar"); + + /** Static value binary for ColumnDataType. */ + public static final ColumnDataType BINARY = fromString("binary"); + + /** Static value char for ColumnDataType. */ + public static final ColumnDataType CHAR = fromString("char"); + + /** Static value timestamp for ColumnDataType. */ + public static final ColumnDataType TIMESTAMP = fromString("timestamp"); + + /** Static value nvarchar for ColumnDataType. */ + public static final ColumnDataType NVARCHAR = fromString("nvarchar"); + + /** Static value nchar for ColumnDataType. */ + public static final ColumnDataType NCHAR = fromString("nchar"); + + /** Static value xml for ColumnDataType. */ + public static final ColumnDataType XML = fromString("xml"); + + /** Static value sysname for ColumnDataType. */ + public static final ColumnDataType SYSNAME = fromString("sysname"); + + /** + * Creates or finds a ColumnDataType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ColumnDataType. + */ + @JsonCreator + public static ColumnDataType fromString(String name) { + return fromString(name, ColumnDataType.class); + } + + /** @return known ColumnDataType values. */ + public static Collection values() { + return values(ColumnDataType.class); + } +} 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..d09e7dc79e728 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CompleteDatabaseRestoreDefinition.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.JsonProperty; + +/** Contains the information necessary to perform a complete database restore operation. */ +@Fluent +public final class CompleteDatabaseRestoreDefinition { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CompleteDatabaseRestoreDefinition.class); +} 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..13cd0b953e399 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CopyLongTermRetentionBackupParameters.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.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.CopyLongTermRetentionBackupParametersProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform long term retention backup copy operation. */ +@Fluent +public final class CopyLongTermRetentionBackupParameters { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private CopyLongTermRetentionBackupParametersProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private CopyLongTermRetentionBackupParametersProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the targetSubscriptionId property: The subscription that owns the target server. + * + * @return the targetSubscriptionId value. + */ + public String targetSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new CopyLongTermRetentionBackupParametersProperties(); + } + this.innerProperties().withTargetSubscriptionId(targetSubscriptionId); + return this; + } + + /** + * Get the targetResourceGroup property: The resource group that owns the target server. + * + * @return the targetResourceGroup value. + */ + public String targetResourceGroup() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new CopyLongTermRetentionBackupParametersProperties(); + } + this.innerProperties().withTargetResourceGroup(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new CopyLongTermRetentionBackupParametersProperties(); + } + this.innerProperties().withTargetServerResourceId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new CopyLongTermRetentionBackupParametersProperties(); + } + this.innerProperties().withTargetServerFullyQualifiedDomainName(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new CopyLongTermRetentionBackupParametersProperties(); + } + this.innerProperties().withTargetDatabaseName(targetDatabaseName); + return this; + } + + /** + * Get the targetBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the targetBackupStorageRedundancy value. + */ + public BackupStorageRedundancy targetBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().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( + BackupStorageRedundancy targetBackupStorageRedundancy) { + if (this.innerProperties() == null) { + this.innerProperties = new CopyLongTermRetentionBackupParametersProperties(); + } + this.innerProperties().withTargetBackupStorageRedundancy(targetBackupStorageRedundancy); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..1261095aa2925 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateDatabaseRestorePointDefinition.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.JsonProperty; + +/** Contains the information necessary to perform a create database restore point operation. */ +@Fluent +public final class CreateDatabaseRestorePointDefinition { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CreateDatabaseRestorePointDefinition.class); +} 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/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..3b0701f4a282d --- /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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..87d41156eeb45 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleListResult.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.resourcemanager.sql.generated.fluent.models.DataMaskingRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list data masking rules request. */ +@Fluent +public final class DataMaskingRuleListResult { + /* + * 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..f5c926aca3dc9 --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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/DataWarehouseUserActivities.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivities.java new file mode 100644 index 0000000000000..8dbe6b6473bbc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivities.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.DataWarehouseUserActivitiesInner; + +/** An immutable client-side representation of DataWarehouseUserActivities. */ +public interface DataWarehouseUserActivities { + /** + * 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 activeQueriesCount property: Count of running and suspended queries. + * + * @return the activeQueriesCount value. + */ + Integer activeQueriesCount(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DataWarehouseUserActivitiesInner object. + * + * @return the inner object. + */ + DataWarehouseUserActivitiesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivitiesListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivitiesListResult.java new file mode 100644 index 0000000000000..56e8e33ae8d23 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivitiesListResult.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.resourcemanager.sql.generated.fluent.models.DataWarehouseUserActivitiesInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** User activities of a data warehouse. */ +@Immutable +public final class DataWarehouseUserActivitiesListResult { + /* + * 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/DataWarehouseUserActivitiesOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivitiesOperations.java new file mode 100644 index 0000000000000..cf35474b17b9d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivitiesOperations.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 DataWarehouseUserActivitiesOperations. */ +public interface DataWarehouseUserActivitiesOperations { + /** + * Gets the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataWarehouseUserActivityName The activity name of the data warehouse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries. + */ + DataWarehouseUserActivities get( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName); + + /** + * Gets the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param dataWarehouseUserActivityName The activity name of the data warehouse. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries along with {@link + * Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName, + Context context); + + /** + * List the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 user activities of a data warehouse as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * List the user activities of a data warehouse which includes running and suspended queries. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 user activities of a data warehouse as paginated response with {@link PagedIterable}. + */ + 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/DataWarehouseUserActivityName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivityName.java new file mode 100644 index 0000000000000..5d028dbe2c657 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivityName.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 DataWarehouseUserActivityName. */ +public final class DataWarehouseUserActivityName extends ExpandableStringEnum { + /** Static value current for DataWarehouseUserActivityName. */ + public static final DataWarehouseUserActivityName CURRENT = fromString("current"); + + /** + * Creates or finds a DataWarehouseUserActivityName from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataWarehouseUserActivityName. + */ + @JsonCreator + public static DataWarehouseUserActivityName fromString(String name) { + return fromString(name, DataWarehouseUserActivityName.class); + } + + /** @return known DataWarehouseUserActivityName values. */ + public static Collection values() { + return values(DataWarehouseUserActivityName.class); + } +} 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..3b8e464e649c6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Database.java @@ -0,0 +1,1322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.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 identity property: The Azure Active Directory identity of the database. + * + * @return the identity value. + */ + DatabaseIdentity identity(); + + /** + * 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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @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. Not applicable to a Hyperscale database within an elastic pool. + * + * @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. + */ + BackupStorageRedundancy currentBackupStorageRedundancy(); + + /** + * Gets the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @return the requestedBackupStorageRedundancy value. + */ + BackupStorageRedundancy 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 isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @return the isLedgerOn value. + */ + Boolean isLedgerOn(); + + /** + * Gets the isInfraEncryptionEnabled property: Infra encryption is enabled for this database. + * + * @return the isInfraEncryptionEnabled value. + */ + Boolean isInfraEncryptionEnabled(); + + /** + * Gets the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @return the federatedClientId value. + */ + UUID federatedClientId(); + + /** + * Gets the sourceResourceId property: The resource identifier of the source associated with the create operation of + * this database. + * + *

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and + * sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + * + *

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of an existing database or + * existing sql pool, and restorePointInTime must be specified. + * + *

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or + * restorable dropped sql pool. + * + *

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable + * sql pool. + * + *

This property allows to restore across subscriptions which is only supported for DataWarehouse edition. + * + *

When source subscription belongs to a different tenant than target subscription, + * “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details + * about “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. + * + * @return the sourceResourceId value. + */ + String sourceResourceId(); + + /** + * 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.WithIdentity, + 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.WithHighAvailabilityReplicaCount, + DefinitionStages.WithSecondaryType, + DefinitionStages.WithAutoPauseDelay, + DefinitionStages.WithRequestedBackupStorageRedundancy, + DefinitionStages.WithMinCapacity, + DefinitionStages.WithMaintenanceConfigurationId, + DefinitionStages.WithIsLedgerOn, + DefinitionStages.WithFederatedClientId, + DefinitionStages.WithSourceResourceId { + /** + * 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 identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The Azure Active Directory identity of the database.. + * + * @param identity The Azure Active Directory identity of the database. + * @return the next definition stage. + */ + WithCreate withIdentity(DatabaseIdentity identity); + } + /** 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 highAvailabilityReplicaCount. */ + interface WithHighAvailabilityReplicaCount { + /** + * Specifies the highAvailabilityReplicaCount property: The number of secondary replicas associated with the + * database that are used to provide high availability. Not applicable to a Hyperscale database within an + * elastic pool.. + * + * @param highAvailabilityReplicaCount The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic + * pool. + * @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(BackupStorageRedundancy 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); + } + /** The stage of the Database definition allowing to specify isLedgerOn. */ + interface WithIsLedgerOn { + /** + * Specifies the isLedgerOn property: Whether or not this database is a ledger database, which means all + * tables in the database are ledger tables. Note: the value of this property cannot be changed after the + * database has been created.. + * + * @param isLedgerOn Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has + * been created. + * @return the next definition stage. + */ + WithCreate withIsLedgerOn(Boolean isLedgerOn); + } + /** The stage of the Database definition allowing to specify federatedClientId. */ + interface WithFederatedClientId { + /** + * Specifies the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @param federatedClientId The Client id used for cross tenant per database CMK scenario. + * @return the next definition stage. + */ + WithCreate withFederatedClientId(UUID federatedClientId); + } + /** The stage of the Database definition allowing to specify sourceResourceId. */ + interface WithSourceResourceId { + /** + * Specifies the sourceResourceId property: The resource identifier of the source associated with the create + * operation of this database. + * + *

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, + * restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must be + * PointInTimeRestore, Restore or Recover. + * + *

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of an existing + * database or existing sql pool, and restorePointInTime must be specified. + * + *

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or + * restorable dropped sql pool. + * + *

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or + * recoverable sql pool. + * + *

This property allows to restore across subscriptions which is only supported for DataWarehouse + * edition. + * + *

When source subscription belongs to a different tenant than target subscription, + * “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more + * details about “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant . + * + * @param sourceResourceId The resource identifier of the source associated with the create operation of + * this database. + *

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, + * restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must + * be PointInTimeRestore, Restore or Recover. + *

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of an existing + * database or existing sql pool, and restorePointInTime must be specified. + *

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped + * database or restorable dropped sql pool. + *

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or + * recoverable sql pool. + *

This property allows to restore across subscriptions which is only supported for DataWarehouse + * edition. + *

When source subscription belongs to a different tenant than target subscription, + * “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For + * more details about “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. + * @return the next definition stage. + */ + WithCreate withSourceResourceId(String sourceResourceId); + } + } + /** + * 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.WithIdentity, + UpdateStages.WithMaxSizeBytes, + UpdateStages.WithElasticPoolId, + UpdateStages.WithZoneRedundant, + UpdateStages.WithLicenseType, + UpdateStages.WithReadScale, + UpdateStages.WithHighAvailabilityReplicaCount, + UpdateStages.WithSecondaryType, + UpdateStages.WithAutoPauseDelay, + UpdateStages.WithMinCapacity, + UpdateStages.WithMaintenanceConfigurationId, + UpdateStages.WithIsLedgerOn, + UpdateStages.WithFederatedClientId { + /** + * 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 identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Database identity. + * + * @param identity Database identity. + * @return the next definition stage. + */ + Update withIdentity(DatabaseIdentity identity); + } + /** 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 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 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. Not applicable to a Hyperscale database within an elastic pool.. + * + * @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. Not applicable to a Hyperscale database within an elastic pool. + * @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. Not applicable to a Hyperscale database within an + * elastic pool.. + * + * @param highAvailabilityReplicaCount The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic + * pool. + * @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 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); + } + /** The stage of the Database update allowing to specify isLedgerOn. */ + interface WithIsLedgerOn { + /** + * Specifies the isLedgerOn property: Whether or not this database is a ledger database, which means all + * tables in the database are ledger tables. Note: the value of this property cannot be changed after the + * database has been created.. + * + * @param isLedgerOn Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has + * been created. + * @return the next definition stage. + */ + Update withIsLedgerOn(Boolean isLedgerOn); + } + /** The stage of the Database update allowing to specify federatedClientId. */ + interface WithFederatedClientId { + /** + * Specifies the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @param federatedClientId The Client id used for cross tenant per database CMK scenario. + * @return the next definition stage. + */ + Update withFederatedClientId(UUID federatedClientId); + } + } + /** + * 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); + + /** + * Exports a 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(ExportDatabaseDefinition parameters); + + /** + * Exports a 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(ExportDatabaseDefinition parameters, Context context); + + /** + * Failovers a database. + * + * @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(ReplicaType replicaType); + + /** + * Failovers a database. + * + * @throws com.azure.core.management.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(); + + /** + * Failovers a database. + * + * @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(ReplicaType replicaType, Context context); + + /** + * Imports a bacpac into a new 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(ImportExistingDatabaseDefinition parameters); + + /** + * Imports a bacpac into a new 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(ImportExistingDatabaseDefinition parameters, Context context); + + /** + * Renames a database. + * + * @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(ResourceMoveDefinition parameters); + + /** + * Renames a database. + * + * @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 {@link Response}. + */ + Response renameWithResponse(ResourceMoveDefinition parameters, Context context); + + /** + * Pauses a database. + * + * @throws com.azure.core.management.exception.ManagementException thrown 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(); + + /** + * Pauses a 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 resource. + */ + Database pause(Context context); + + /** + * Resumes a database. + * + * @throws com.azure.core.management.exception.ManagementException thrown 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(); + + /** + * Resumes a 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 resource. + */ + Database resume(Context context); + + /** + * Upgrades a data warehouse. + * + * @throws com.azure.core.management.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(); + + /** + * Upgrades a data warehouse. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvisors.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvisors.java new file mode 100644 index 0000000000000..aeee9875fd05c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvisors.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.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import java.util.List; + +/** Resource collection API of DatabaseAdvisors. */ +public interface DatabaseAdvisors { + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 advisors. + */ + List listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of database advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors along with {@link Response}. + */ + Response> listByDatabaseWithResponse( + String resourceGroupName, String serverName, String databaseName, String expand, Context context); + + /** + * Gets a database 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 the database. + * @param advisorName The name of the Database 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 database advisor. + */ + Advisor get(String resourceGroupName, String serverName, String databaseName, String advisorName); + + /** + * Gets a database 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 the database. + * @param advisorName The name of the Database 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 database advisor along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context); + + /** + * Updates a database 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 the database. + * @param advisorName The name of the Database Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor. + */ + Advisor update( + String resourceGroupName, String serverName, String databaseName, String advisorName, AdvisorInner parameters); + + /** + * Updates a database 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 the database. + * @param advisorName The name of the Database Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor along with {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + AdvisorInner parameters, + 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..1c64bacba9c62 --- /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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..0bd8df6893681 --- /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 { + /** + * 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, 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 com.azure.core.management.exception.ManagementException thrown 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 along with {@link Response}. + */ + Response getWithResponse( + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..4689c955e8dda --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicy.java @@ -0,0 +1,734 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 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 isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + Boolean isManagedIdentityInUse(); + + /** + * 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.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.WithRetentionDays, + DefinitionStages.WithAuditActionsAndGroups, + DefinitionStages.WithIsStorageSecondaryKeyInUse, + DefinitionStages.WithIsAzureMonitorTargetEnabled, + DefinitionStages.WithQueueDelayMs, + DefinitionStages.WithIsManagedIdentityInUse, + DefinitionStages.WithState, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithStorageAccountSubscriptionId { + /** + * 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 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + WithCreate withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the DatabaseBlobAuditingPolicy 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 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 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 DatabaseBlobAuditingPolicy resource. + * + * @return the stage of resource update. + */ + DatabaseBlobAuditingPolicy.Update update(); + + /** The template for DatabaseBlobAuditingPolicy update. */ + interface Update + extends UpdateStages.WithRetentionDays, + UpdateStages.WithAuditActionsAndGroups, + UpdateStages.WithIsStorageSecondaryKeyInUse, + UpdateStages.WithIsAzureMonitorTargetEnabled, + UpdateStages.WithQueueDelayMs, + UpdateStages.WithIsManagedIdentityInUse, + UpdateStages.WithState, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithStorageAccountSubscriptionId { + /** + * 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 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + Update withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the DatabaseBlobAuditingPolicy 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 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 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. + */ + 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..ad657dcbed00b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicyListResult.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.resourcemanager.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of database auditing settings. */ +@Immutable +public final class DatabaseBlobAuditingPolicyListResult { + /* + * 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/DatabaseColumn.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumn.java new file mode 100644 index 0000000000000..1bb7d8c2d2eeb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumn.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.DatabaseColumnInner; + +/** An immutable client-side representation of DatabaseColumn. */ +public interface DatabaseColumn { + /** + * 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 columnType property: The column data type. + * + * @return the columnType value. + */ + ColumnDataType columnType(); + + /** + * Gets the temporalType property: The table temporal type. + * + * @return the temporalType value. + */ + TableTemporalType temporalType(); + + /** + * Gets the memoryOptimized property: Whether or not the column belongs to a memory optimized table. + * + * @return the memoryOptimized value. + */ + Boolean memoryOptimized(); + + /** + * Gets the isComputed property: Whether or not the column is computed. + * + * @return the isComputed value. + */ + Boolean isComputed(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner object. + * + * @return the inner object. + */ + DatabaseColumnInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumnListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumnListResult.java new file mode 100644 index 0000000000000..27b9ba423aa33 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumnListResult.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.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of database columns. */ +@Immutable +public final class DatabaseColumnListResult { + /* + * 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/DatabaseColumns.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumns.java new file mode 100644 index 0000000000000..df462650bb5f8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumns.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.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of DatabaseColumns. */ +public interface DatabaseColumns { + /** + * List database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * List database 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 schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point 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 database columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context); + + /** + * List database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTable( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName); + + /** + * List database 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 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 database columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTable( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context); + + /** + * Get database 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. + * @return database column. + */ + DatabaseColumn get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Get database 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 database column along with {@link Response}. + */ + Response getWithResponse( + 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/models/DatabaseExtensions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseExtensions.java new file mode 100644 index 0000000000000..730daa180358f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseExtensions.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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseExtensionsProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An export managed database operation result resource. */ +@Fluent +public final class DatabaseExtensions extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseExtensionsProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseExtensionsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the operationMode property: Operation Mode. + * + * @return the operationMode value. + */ + public OperationMode operationMode() { + return this.innerProperties() == null ? null : this.innerProperties().operationMode(); + } + + /** + * Set the operationMode property: Operation Mode. + * + * @param operationMode the operationMode value to set. + * @return the DatabaseExtensions object itself. + */ + public DatabaseExtensions withOperationMode(OperationMode operationMode) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseExtensionsProperties(); + } + this.innerProperties().withOperationMode(operationMode); + return this; + } + + /** + * Get the storageKeyType property: Storage key type. + * + * @return the storageKeyType value. + */ + public StorageKeyType storageKeyType() { + return this.innerProperties() == null ? null : this.innerProperties().storageKeyType(); + } + + /** + * Set the storageKeyType property: Storage key type. + * + * @param storageKeyType the storageKeyType value to set. + * @return the DatabaseExtensions object itself. + */ + public DatabaseExtensions withStorageKeyType(StorageKeyType storageKeyType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseExtensionsProperties(); + } + this.innerProperties().withStorageKeyType(storageKeyType); + return this; + } + + /** + * Get the storageKey property: Storage key. + * + * @return the storageKey value. + */ + public String storageKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageKey(); + } + + /** + * Set the storageKey property: Storage key. + * + * @param storageKey the storageKey value to set. + * @return the DatabaseExtensions object itself. + */ + public DatabaseExtensions withStorageKey(String storageKey) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseExtensionsProperties(); + } + this.innerProperties().withStorageKey(storageKey); + return this; + } + + /** + * Get the storageUri property: Storage Uri. + * + * @return the storageUri value. + */ + public String storageUri() { + return this.innerProperties() == null ? null : this.innerProperties().storageUri(); + } + + /** + * Set the storageUri property: Storage Uri. + * + * @param storageUri the storageUri value to set. + * @return the DatabaseExtensions object itself. + */ + public DatabaseExtensions withStorageUri(String storageUri) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseExtensionsProperties(); + } + this.innerProperties().withStorageUri(storageUri); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseExtensionsOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseExtensionsOperations.java new file mode 100644 index 0000000000000..720f9a3cc943d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseExtensionsOperations.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.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseExtensionsOperations. */ +public interface DatabaseExtensionsOperations { + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName 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 get(String resourceGroupName, String serverName, String databaseName, String extensionName); + + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName 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 database extension along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String extensionName, Context context); + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 import export operation extensions list as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 import export operation extensions list as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Begins definition for a new ImportExportExtensionsOperationResult resource. + * + * @param name resource name. + * @return the first stage of the new ImportExportExtensionsOperationResult definition. + */ + ImportExportExtensionsOperationResult.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseIdentity.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseIdentity.java new file mode 100644 index 0000000000000..698d7f86f0d7c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseIdentity.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Azure Active Directory identity configuration for a resource. */ +@Fluent +public class DatabaseIdentity { + /* + * The identity type + */ + @JsonProperty(value = "type") + private DatabaseIdentityType type; + + /* + * The Azure Active Directory tenant id. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * The resource ids of the user assigned identities to use + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public DatabaseIdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the DatabaseIdentity object itself. + */ + public DatabaseIdentity withType(DatabaseIdentityType 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; + } + + /** + * Get the userAssignedIdentities property: The resource ids of the user assigned identities to use. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The resource ids of the user assigned identities to use. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the DatabaseIdentity object itself. + */ + public DatabaseIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .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/models/DatabaseIdentityType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseIdentityType.java new file mode 100644 index 0000000000000..d1f2d11a57db0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseIdentityType.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 DatabaseIdentityType. */ +public final class DatabaseIdentityType extends ExpandableStringEnum { + /** Static value None for DatabaseIdentityType. */ + public static final DatabaseIdentityType NONE = fromString("None"); + + /** Static value UserAssigned for DatabaseIdentityType. */ + public static final DatabaseIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Creates or finds a DatabaseIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseIdentityType. + */ + @JsonCreator + public static DatabaseIdentityType fromString(String name) { + return fromString(name, DatabaseIdentityType.class); + } + + /** @return known DatabaseIdentityType values. */ + public static Collection values() { + return values(DatabaseIdentityType.class); + } +} 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..1e5057f1c736d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseListResult.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.resourcemanager.sql.generated.fluent.models.DatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of databases. */ +@Immutable +public final class DatabaseListResult { + /* + * 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..07d2d22394a22 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperationListResult.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.resourcemanager.sql.generated.fluent.models.DatabaseOperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list database operations request. */ +@Immutable +public final class DatabaseOperationListResult { + /* + * 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..0294700538239 --- /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 {@link 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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/DatabaseRecommendedActions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseRecommendedActions.java new file mode 100644 index 0000000000000..d34f174d81c72 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseRecommendedActions.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.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import java.util.List; + +/** Resource collection API of DatabaseRecommendedActions. */ +public interface DatabaseRecommendedActions { + /** + * Gets list of Database Recommended Actions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database 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 list of Database Recommended Actions. + */ + List listByDatabaseAdvisor( + String resourceGroupName, String serverName, String databaseName, String advisorName); + + /** + * Gets list of Database Recommended Actions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database 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 list of Database Recommended Actions along with {@link Response}. + */ + Response> listByDatabaseAdvisorWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context); + + /** + * Gets a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action. + */ + RecommendedAction get( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName); + + /** + * Gets a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + Context context); + + /** + * Updates a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param parameters The requested recommended action 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, Server or Elastic Pool Recommended Action. + */ + RecommendedAction update( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters); + + /** + * Updates a database recommended action. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advisorName The name of the Database Advisor. + * @param recommendedActionName The name of Database Recommended Action. + * @param parameters The requested recommended action 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, Server or Elastic Pool Recommended Action along with {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchema.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchema.java new file mode 100644 index 0000000000000..eae76d211b13d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchema.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.DatabaseSchemaInner; + +/** An immutable client-side representation of DatabaseSchema. */ +public interface DatabaseSchema { + /** + * 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.DatabaseSchemaInner object. + * + * @return the inner object. + */ + DatabaseSchemaInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchemaListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchemaListResult.java new file mode 100644 index 0000000000000..ca4ba84db58a8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchemaListResult.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.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of database schemas. */ +@Immutable +public final class DatabaseSchemaListResult { + /* + * 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/DatabaseSchemas.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchemas.java new file mode 100644 index 0000000000000..700bd9474d725 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchemas.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; + +/** Resource collection API of DatabaseSchemas. */ +public interface DatabaseSchemas { + /** + * List 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 schemas as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * List 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. + * @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 database schemas as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, String filter, Context context); + + /** + * Get 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. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 schema. + */ + DatabaseSchema get(String resourceGroupName, String serverName, String databaseName, String schemaName); + + /** + * Get 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. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 schema along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String schemaName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertListResult.java new file mode 100644 index 0000000000000..174028894818b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertListResult.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.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the database's security alert policies. */ +@Immutable +public final class DatabaseSecurityAlertListResult { + /* + * 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/DatabaseSecurityAlertPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertPolicies.java new file mode 100644 index 0000000000000..59b6a4f0d144a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertPolicies.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 DatabaseSecurityAlertPolicies. */ +public interface DatabaseSecurityAlertPolicies { + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the 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 database's security alert policy. + */ + DatabaseSecurityAlertPolicy get( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the 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 database's security alert policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context); + + /** + * Gets a list of 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 serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy 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 database's security alert policies as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of 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 serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy 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 database's security alert policies as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a 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 database's security alert policy along with {@link Response}. + */ + DatabaseSecurityAlertPolicy getById(String id); + + /** + * Gets a 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 database's security alert policy along with {@link Response}. + */ + 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/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..c2ffadbca68de --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertPolicy.java @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.DatabaseSecurityAlertPolicyInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** 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 systemData property: SystemData of SecurityAlertPolicyResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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. + */ + SecurityAlertsPolicyState 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, Brute_Force. + * + * @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.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 the security alert 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.WithState, + DefinitionStages.WithDisabledAlerts, + DefinitionStages.WithEmailAddresses, + DefinitionStages.WithEmailAccountAdmins, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays { + /** + * 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 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(SecurityAlertsPolicyState state); + } + /** The stage of the DatabaseSecurityAlertPolicy 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, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @return the next definition stage. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + /** The stage of the DatabaseSecurityAlertPolicy 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 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(Boolean 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.. + * + * @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 DatabaseSecurityAlertPolicy 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 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); + } + } + /** + * 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 { + /** + * 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, 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(SecurityAlertsPolicyState state); + } + /** The stage of the DatabaseSecurityAlertPolicy 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, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @return the next definition stage. + */ + Update withDisabledAlerts(List disabledAlerts); + } + /** The stage of the DatabaseSecurityAlertPolicy 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 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(Boolean 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.. + * + * @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 DatabaseSecurityAlertPolicy 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 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); + } + } + /** + * 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..cddebacedc9f2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseStatus.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.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"); + + /** Static value Stopping for DatabaseStatus. */ + public static final DatabaseStatus STOPPING = fromString("Stopping"); + + /** Static value Stopped for DatabaseStatus. */ + public static final DatabaseStatus STOPPED = fromString("Stopped"); + + /** Static value Starting for DatabaseStatus. */ + public static final DatabaseStatus STARTING = fromString("Starting"); + + /** + * 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/DatabaseTable.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTable.java new file mode 100644 index 0000000000000..926d24ce679fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTable.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.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; + +/** An immutable client-side representation of DatabaseTable. */ +public interface DatabaseTable { + /** + * 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 temporalType property: The table temporal type. + * + * @return the temporalType value. + */ + TableTemporalType temporalType(); + + /** + * Gets the memoryOptimized property: Whether or not the table is memory optimized. + * + * @return the memoryOptimized value. + */ + Boolean memoryOptimized(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner object. + * + * @return the inner object. + */ + DatabaseTableInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTableListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTableListResult.java new file mode 100644 index 0000000000000..36f81aade98d6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTableListResult.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.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of database tables. */ +@Immutable +public final class DatabaseTableListResult { + /* + * 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/DatabaseTables.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTables.java new file mode 100644 index 0000000000000..c7cd349090803 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTables.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.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 DatabaseTables. */ +public interface DatabaseTables { + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 tables as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySchema( + String resourceGroupName, String serverName, String databaseName, String schemaName); + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 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 database tables as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySchema( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String filter, + Context context); + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 table. + */ + DatabaseTable get( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName); + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 table along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + Context context); +} 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..38ed1776e9504 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUpdate.java @@ -0,0 +1,895 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.resourcemanager.sql.generated.fluent.models.DatabaseUpdateProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; +import java.util.UUID; + +/** A database update resource. */ +@Fluent +public final class DatabaseUpdate { + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Database identity + */ + @JsonProperty(value = "identity") + private DatabaseIdentity identity; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseUpdateProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * 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 identity property: Database identity. + * + * @return the identity value. + */ + public DatabaseIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Database identity. + * + * @param identity the identity value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withIdentity(DatabaseIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withCreateMode(createMode); + return this; + } + + /** + * Get the collation property: The collation of the database. + * + * @return the collation value. + */ + public String collation() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withCollation(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withMaxSizeBytes(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withSampleName(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withElasticPoolId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withSourceDatabaseId(sourceDatabaseId); + return this; + } + + /** + * Get the status property: The status of the database. + * + * @return the status value. + */ + public DatabaseStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the databaseId property: The ID of the database. + * + * @return the databaseId value. + */ + public UUID databaseId() { + return this.innerProperties() == null ? null : this.innerProperties().databaseId(); + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the currentServiceObjectiveName property: The current service level objective name of the database. + * + * @return the currentServiceObjectiveName value. + */ + public String currentServiceObjectiveName() { + return this.innerProperties() == null ? null : this.innerProperties().currentServiceObjectiveName(); + } + + /** + * Get the requestedServiceObjectiveName property: The requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value. + */ + public String requestedServiceObjectiveName() { + return this.innerProperties() == null ? null : this.innerProperties().requestedServiceObjectiveName(); + } + + /** + * Get the defaultSecondaryLocation property: The default secondary region for this database. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.innerProperties() == null ? null : this.innerProperties().defaultSecondaryLocation(); + } + + /** + * Get the failoverGroupId property: Failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value. + */ + public String failoverGroupId() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withRestorePointInTime(restorePointInTime); + return this; + } + + /** + * Get the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value. + */ + public OffsetDateTime sourceDatabaseDeletionDate() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withSourceDatabaseDeletionDate(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withRecoveryServicesRecoveryPointId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withLongTermRetentionBackupResourceId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withRecoverableDatabaseId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + return this; + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withCatalogCollation(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withZoneRedundant(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the maxLogSizeBytes property: The max log size for this database. + * + * @return the maxLogSizeBytes value. + */ + public Long maxLogSizeBytes() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @return the readScale value. + */ + public DatabaseReadScale readScale() { + return this.innerProperties() == null ? null : this.innerProperties().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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @param readScale the readScale value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withReadScale(DatabaseReadScale readScale) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withReadScale(readScale); + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.innerProperties() == null ? null : this.innerProperties().highAvailabilityReplicaCount(); + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withHighAvailabilityReplicaCount(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withSecondaryType(secondaryType); + return this; + } + + /** + * Get the currentSku property: The name and tier of the SKU. + * + * @return the currentSku value. + */ + public Sku currentSku() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withAutoPauseDelay(autoPauseDelay); + return this; + } + + /** + * Get the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * database. + * + * @return the currentBackupStorageRedundancy value. + */ + public BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().currentBackupStorageRedundancy(); + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().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( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withRequestedBackupStorageRedundancy(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withMinCapacity(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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + + /** + * Get the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @return the isLedgerOn value. + */ + public Boolean isLedgerOn() { + return this.innerProperties() == null ? null : this.innerProperties().isLedgerOn(); + } + + /** + * Set the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @param isLedgerOn the isLedgerOn value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withIsLedgerOn(Boolean isLedgerOn) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withIsLedgerOn(isLedgerOn); + return this; + } + + /** + * Get the isInfraEncryptionEnabled property: Infra encryption is enabled for this database. + * + * @return the isInfraEncryptionEnabled value. + */ + public Boolean isInfraEncryptionEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isInfraEncryptionEnabled(); + } + + /** + * Get the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @return the federatedClientId value. + */ + public UUID federatedClientId() { + return this.innerProperties() == null ? null : this.innerProperties().federatedClientId(); + } + + /** + * Set the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withFederatedClientId(UUID federatedClientId) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withFederatedClientId(federatedClientId); + 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 (innerProperties() != null) { + innerProperties().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..4a410c4a26b7f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsage.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.DatabaseUsageInner; + +/** An immutable client-side representation of DatabaseUsage. */ +public interface DatabaseUsage { + /** + * 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.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..7f991b2267f7e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsageListResult.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.resourcemanager.sql.generated.fluent.models.DatabaseUsageInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of database usage metrics. */ +@Immutable +public final class DatabaseUsageListResult { + /* + * 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/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..ca839503458d5 --- /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 { + /** + * Gets 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 database usages as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets 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 database usages as paginated response with {@link PagedIterable}. + */ + 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/DatabaseUserIdentity.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUserIdentity.java new file mode 100644 index 0000000000000..fcafc8c94628b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUserIdentity.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Azure Active Directory identity configuration for a resource. */ +@Immutable +public class DatabaseUserIdentity { + /* + * The Azure Active Directory principal id. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The Azure Active Directory client id. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** + * Get the principalId property: The Azure Active Directory principal id. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The Azure Active Directory client id. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * 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/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..a04e779663468 --- /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 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 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 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 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 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..c0a54cc370d4a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentListResult.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.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the database's vulnerability assessments. */ +@Immutable +public final class DatabaseVulnerabilityAssessmentListResult { + /* + * 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..af7d9171accbd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselineItem.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.JsonProperty; +import java.util.List; + +/** Properties for an Azure SQL Database Vulnerability Assessment rule baseline's result. */ +@Fluent +public final class DatabaseVulnerabilityAssessmentRuleBaselineItem { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DatabaseVulnerabilityAssessmentRuleBaselineItem.class); +} 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..28907944d996b --- /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 along with {@link Response}. + */ + 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 {@link 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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..647e3387007c8 --- /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 { + /** + * 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); + + /** + * 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + Response getWithResponse( + 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 along with {@link Response}. + */ + 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..f6a4e740f493b --- /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 along with {@link Response}. + */ + 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 {@link 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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..d1bdcde6e287b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Databases.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.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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName, 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 as paginated response with {@link PagedIterable}. + */ + 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 skipToken The skipToken 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 databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, String skipToken, 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 along with {@link Response}. + */ + 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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 {@link Response}. + */ + Response renameWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ResourceMoveDefinition parameters, + 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); + + /** + * 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); + + /** + * 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName, 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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/DayOfWeek.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DayOfWeek.java new file mode 100644 index 0000000000000..b703bfb246b6b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DayOfWeek.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 DayOfWeek. */ +public final class DayOfWeek extends ExpandableStringEnum { + /** Static value Sunday for DayOfWeek. */ + public static final DayOfWeek SUNDAY = fromString("Sunday"); + + /** Static value Monday for DayOfWeek. */ + public static final DayOfWeek MONDAY = fromString("Monday"); + + /** Static value Tuesday for DayOfWeek. */ + public static final DayOfWeek TUESDAY = fromString("Tuesday"); + + /** Static value Wednesday for DayOfWeek. */ + public static final DayOfWeek WEDNESDAY = fromString("Wednesday"); + + /** Static value Thursday for DayOfWeek. */ + public static final DayOfWeek THURSDAY = fromString("Thursday"); + + /** Static value Friday for DayOfWeek. */ + public static final DayOfWeek FRIDAY = fromString("Friday"); + + /** Static value Saturday for DayOfWeek. */ + public static final DayOfWeek SATURDAY = fromString("Saturday"); + + /** + * Creates or finds a DayOfWeek from its string representation. + * + * @param name a name to look for. + * @return the corresponding DayOfWeek. + */ + @JsonCreator + public static DayOfWeek fromString(String name) { + return fromString(name, DayOfWeek.class); + } + + /** @return known DayOfWeek values. */ + public static Collection values() { + return values(DayOfWeek.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServer.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServer.java new file mode 100644 index 0000000000000..6b156a354e64a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServer.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.DeletedServerInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of DeletedServer. */ +public interface DeletedServer { + /** + * 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 version property: The version of the deleted server. + * + * @return the version value. + */ + String version(); + + /** + * Gets the deletionTime property: The deletion time of the deleted server. + * + * @return the deletionTime value. + */ + OffsetDateTime deletionTime(); + + /** + * Gets the originalId property: The original ID of the server before deletion. + * + * @return the originalId value. + */ + String originalId(); + + /** + * Gets the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + String fullyQualifiedDomainName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DeletedServerInner object. + * + * @return the inner object. + */ + DeletedServerInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServerListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServerListResult.java new file mode 100644 index 0000000000000..83414096782be --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServerListResult.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.resourcemanager.sql.generated.fluent.models.DeletedServerInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of deleted servers. */ +@Immutable +public final class DeletedServerListResult { + /* + * 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/DeletedServers.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServers.java new file mode 100644 index 0000000000000..76258d71a58cf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServers.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.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 DeletedServers. */ +public interface DeletedServers { + /** + * Gets a list of all deleted servers in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets a list of all deleted servers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server. + */ + DeletedServer get(String locationName, String deletedServerName); + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server along with {@link Response}. + */ + Response getWithResponse(String locationName, String deletedServerName, Context context); + + /** + * Gets a list of deleted servers for a 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 a list of deleted servers for a location as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String locationName); + + /** + * Gets a list of deleted servers for a 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 a list of deleted servers for a location as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String locationName, Context context); + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server. + */ + DeletedServer recover(String locationName, String deletedServerName); + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted 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 deleted server. + */ + DeletedServer recover(String locationName, String deletedServerName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DiffBackupIntervalInHours.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DiffBackupIntervalInHours.java new file mode 100644 index 0000000000000..c55097d410be7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DiffBackupIntervalInHours.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 DiffBackupIntervalInHours. */ +public final class DiffBackupIntervalInHours extends ExpandableStringEnum { + /** Static value 12 for DiffBackupIntervalInHours. */ + public static final DiffBackupIntervalInHours ONE_TWO = fromInt(12); + + /** Static value 24 for DiffBackupIntervalInHours. */ + public static final DiffBackupIntervalInHours TWO_FOUR = fromInt(24); + + /** + * Creates or finds a DiffBackupIntervalInHours from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiffBackupIntervalInHours. + */ + @JsonCreator + public static DiffBackupIntervalInHours fromInt(int name) { + return fromString(String.valueOf(name), DiffBackupIntervalInHours.class); + } + + /** @return known DiffBackupIntervalInHours values. */ + public static Collection values() { + return values(DiffBackupIntervalInHours.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroup.java new file mode 100644 index 0000000000000..b0999abec8838 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroup.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.DistributedAvailabilityGroupInner; +import java.util.UUID; + +/** An immutable client-side representation of DistributedAvailabilityGroup. */ +public interface DistributedAvailabilityGroup { + /** + * 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 targetDatabase property: The name of the target database. + * + * @return the targetDatabase value. + */ + String targetDatabase(); + + /** + * Gets the sourceEndpoint property: The source endpoint. + * + * @return the sourceEndpoint value. + */ + String sourceEndpoint(); + + /** + * Gets the primaryAvailabilityGroupName property: The primary availability group name. + * + * @return the primaryAvailabilityGroupName value. + */ + String primaryAvailabilityGroupName(); + + /** + * Gets the secondaryAvailabilityGroupName property: The secondary availability group name. + * + * @return the secondaryAvailabilityGroupName value. + */ + String secondaryAvailabilityGroupName(); + + /** + * Gets the replicationMode property: The replication mode of a distributed availability group. Parameter will be + * ignored during link creation. + * + * @return the replicationMode value. + */ + ReplicationMode replicationMode(); + + /** + * Gets the distributedAvailabilityGroupId property: The distributed availability group id. + * + * @return the distributedAvailabilityGroupId value. + */ + UUID distributedAvailabilityGroupId(); + + /** + * Gets the sourceReplicaId property: The source replica id. + * + * @return the sourceReplicaId value. + */ + UUID sourceReplicaId(); + + /** + * Gets the targetReplicaId property: The target replica id. + * + * @return the targetReplicaId value. + */ + UUID targetReplicaId(); + + /** + * Gets the linkState property: The link state. + * + * @return the linkState value. + */ + String linkState(); + + /** + * Gets the lastHardenedLsn property: The last hardened lsn. + * + * @return the lastHardenedLsn value. + */ + String lastHardenedLsn(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DistributedAvailabilityGroupInner object. + * + * @return the inner object. + */ + DistributedAvailabilityGroupInner innerModel(); + + /** The entirety of the DistributedAvailabilityGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DistributedAvailabilityGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the DistributedAvailabilityGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DistributedAvailabilityGroup 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 DistributedAvailabilityGroup 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.WithTargetDatabase, + DefinitionStages.WithSourceEndpoint, + DefinitionStages.WithPrimaryAvailabilityGroupName, + DefinitionStages.WithSecondaryAvailabilityGroupName, + DefinitionStages.WithReplicationMode { + /** + * Executes the create request. + * + * @return the created resource. + */ + DistributedAvailabilityGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DistributedAvailabilityGroup create(Context context); + } + /** The stage of the DistributedAvailabilityGroup definition allowing to specify targetDatabase. */ + interface WithTargetDatabase { + /** + * Specifies the targetDatabase property: The name of the target database. + * + * @param targetDatabase The name of the target database. + * @return the next definition stage. + */ + WithCreate withTargetDatabase(String targetDatabase); + } + /** The stage of the DistributedAvailabilityGroup definition allowing to specify sourceEndpoint. */ + interface WithSourceEndpoint { + /** + * Specifies the sourceEndpoint property: The source endpoint. + * + * @param sourceEndpoint The source endpoint. + * @return the next definition stage. + */ + WithCreate withSourceEndpoint(String sourceEndpoint); + } + /** + * The stage of the DistributedAvailabilityGroup definition allowing to specify primaryAvailabilityGroupName. + */ + interface WithPrimaryAvailabilityGroupName { + /** + * Specifies the primaryAvailabilityGroupName property: The primary availability group name. + * + * @param primaryAvailabilityGroupName The primary availability group name. + * @return the next definition stage. + */ + WithCreate withPrimaryAvailabilityGroupName(String primaryAvailabilityGroupName); + } + /** + * The stage of the DistributedAvailabilityGroup definition allowing to specify secondaryAvailabilityGroupName. + */ + interface WithSecondaryAvailabilityGroupName { + /** + * Specifies the secondaryAvailabilityGroupName property: The secondary availability group name. + * + * @param secondaryAvailabilityGroupName The secondary availability group name. + * @return the next definition stage. + */ + WithCreate withSecondaryAvailabilityGroupName(String secondaryAvailabilityGroupName); + } + /** The stage of the DistributedAvailabilityGroup definition allowing to specify replicationMode. */ + interface WithReplicationMode { + /** + * Specifies the replicationMode property: The replication mode of a distributed availability group. + * Parameter will be ignored during link creation.. + * + * @param replicationMode The replication mode of a distributed availability group. Parameter will be + * ignored during link creation. + * @return the next definition stage. + */ + WithCreate withReplicationMode(ReplicationMode replicationMode); + } + } + /** + * Begins update for the DistributedAvailabilityGroup resource. + * + * @return the stage of resource update. + */ + DistributedAvailabilityGroup.Update update(); + + /** The template for DistributedAvailabilityGroup update. */ + interface Update + extends UpdateStages.WithTargetDatabase, + UpdateStages.WithSourceEndpoint, + UpdateStages.WithPrimaryAvailabilityGroupName, + UpdateStages.WithSecondaryAvailabilityGroupName, + UpdateStages.WithReplicationMode { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DistributedAvailabilityGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DistributedAvailabilityGroup apply(Context context); + } + /** The DistributedAvailabilityGroup update stages. */ + interface UpdateStages { + /** The stage of the DistributedAvailabilityGroup update allowing to specify targetDatabase. */ + interface WithTargetDatabase { + /** + * Specifies the targetDatabase property: The name of the target database. + * + * @param targetDatabase The name of the target database. + * @return the next definition stage. + */ + Update withTargetDatabase(String targetDatabase); + } + /** The stage of the DistributedAvailabilityGroup update allowing to specify sourceEndpoint. */ + interface WithSourceEndpoint { + /** + * Specifies the sourceEndpoint property: The source endpoint. + * + * @param sourceEndpoint The source endpoint. + * @return the next definition stage. + */ + Update withSourceEndpoint(String sourceEndpoint); + } + /** The stage of the DistributedAvailabilityGroup update allowing to specify primaryAvailabilityGroupName. */ + interface WithPrimaryAvailabilityGroupName { + /** + * Specifies the primaryAvailabilityGroupName property: The primary availability group name. + * + * @param primaryAvailabilityGroupName The primary availability group name. + * @return the next definition stage. + */ + Update withPrimaryAvailabilityGroupName(String primaryAvailabilityGroupName); + } + /** The stage of the DistributedAvailabilityGroup update allowing to specify secondaryAvailabilityGroupName. */ + interface WithSecondaryAvailabilityGroupName { + /** + * Specifies the secondaryAvailabilityGroupName property: The secondary availability group name. + * + * @param secondaryAvailabilityGroupName The secondary availability group name. + * @return the next definition stage. + */ + Update withSecondaryAvailabilityGroupName(String secondaryAvailabilityGroupName); + } + /** The stage of the DistributedAvailabilityGroup update allowing to specify replicationMode. */ + interface WithReplicationMode { + /** + * Specifies the replicationMode property: The replication mode of a distributed availability group. + * Parameter will be ignored during link creation.. + * + * @param replicationMode The replication mode of a distributed availability group. Parameter will be + * ignored during link creation. + * @return the next definition stage. + */ + Update withReplicationMode(ReplicationMode replicationMode); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DistributedAvailabilityGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DistributedAvailabilityGroup refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroups.java new file mode 100644 index 0000000000000..df59e10af9e0c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroups.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 DistributedAvailabilityGroups. */ +public interface DistributedAvailabilityGroups { + /** + * Gets a list of a distributed availability groups in 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 a distributed availability groups in instance as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of a distributed availability groups in 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 a distributed availability groups in instance as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group 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 distributed availability group info. + */ + DistributedAvailabilityGroup get( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName); + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group 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 distributed availability group info along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName, Context context); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group 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 resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName, Context context); + + /** + * Gets a distributed availability group info. + * + * @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 distributed availability group info along with {@link Response}. + */ + DistributedAvailabilityGroup getById(String id); + + /** + * Gets a distributed availability group info. + * + * @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 distributed availability group info along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 DistributedAvailabilityGroup resource. + * + * @param name resource name. + * @return the first stage of the new DistributedAvailabilityGroup definition. + */ + DistributedAvailabilityGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroupsListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroupsListResult.java new file mode 100644 index 0000000000000..9e755660efeed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroupsListResult.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.resourcemanager.sql.generated.fluent.models.DistributedAvailabilityGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of distributed availability groups in instance. */ +@Immutable +public final class DistributedAvailabilityGroupsListResult { + /* + * 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/DnsRefreshConfigurationPropertiesStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DnsRefreshConfigurationPropertiesStatus.java new file mode 100644 index 0000000000000..907ffba742a01 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DnsRefreshConfigurationPropertiesStatus.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 DnsRefreshConfigurationPropertiesStatus. */ +public final class DnsRefreshConfigurationPropertiesStatus + extends ExpandableStringEnum { + /** Static value Succeeded for DnsRefreshConfigurationPropertiesStatus. */ + public static final DnsRefreshConfigurationPropertiesStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for DnsRefreshConfigurationPropertiesStatus. */ + public static final DnsRefreshConfigurationPropertiesStatus FAILED = fromString("Failed"); + + /** + * Creates or finds a DnsRefreshConfigurationPropertiesStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding DnsRefreshConfigurationPropertiesStatus. + */ + @JsonCreator + public static DnsRefreshConfigurationPropertiesStatus fromString(String name) { + return fromString(name, DnsRefreshConfigurationPropertiesStatus.class); + } + + /** @return known DnsRefreshConfigurationPropertiesStatus values. */ + public static Collection values() { + return values(DnsRefreshConfigurationPropertiesStatus.class); + } +} 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..77b6a68dd26b6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EditionCapability.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The edition capability. */ +@Fluent +public final class EditionCapability { + /* + * 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..fb17d73ac2f73 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPool.java @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. + * + * @return the highAvailabilityReplicaCount value. + */ + Integer highAvailabilityReplicaCount(); + + /** + * 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, + DefinitionStages.WithHighAvailabilityReplicaCount { + /** + * 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); + } + /** The stage of the ElasticPool definition allowing to specify highAvailabilityReplicaCount. */ + interface WithHighAvailabilityReplicaCount { + /** + * Specifies the highAvailabilityReplicaCount property: The number of secondary replicas associated with the + * elastic pool that are used to provide high availability.. + * + * @param highAvailabilityReplicaCount The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. + * @return the next definition stage. + */ + WithCreate withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount); + } + } + /** + * 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, + UpdateStages.WithHighAvailabilityReplicaCount { + /** + * 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); + } + /** The stage of the ElasticPool update allowing to specify highAvailabilityReplicaCount. */ + interface WithHighAvailabilityReplicaCount { + /** + * Specifies the highAvailabilityReplicaCount property: The number of secondary replicas associated with the + * elastic pool that are used to provide high availability. Applicable only to Hyperscale elastic pools.. + * + * @param highAvailabilityReplicaCount The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. Applicable only to Hyperscale elastic pools. + * @return the next definition stage. + */ + Update withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount); + } + } + /** + * 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); + + /** + * Failovers an elastic pool. + * + * @throws com.azure.core.management.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(); + + /** + * Failovers an 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 failover(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..ba52fe8a54102 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivities.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.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 as paginated response with {@link + * PagedIterable}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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..d384e6adbcca8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivityListResult.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.ElasticPoolActivityInner; +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 { + /* + * 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()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ElasticPoolActivityListResult.class); +} 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..cea574cff6b98 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivities.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.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 as paginated response with + * {@link PagedIterable}. + */ + 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 as paginated response with + * {@link PagedIterable}. + */ + 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..f94d534b59c80 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivityListResult.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.ElasticPoolDatabaseActivityInner; +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 { + /* + * 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()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ElasticPoolDatabaseActivityListResult.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..f72224f039bf0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolEditionCapability.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The elastic pool edition capability. */ +@Fluent +public final class ElasticPoolEditionCapability { + /* + * 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..395a93dbec402 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolListResult.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.resourcemanager.sql.generated.fluent.models.ElasticPoolInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The result of an elastic pool list request. */ +@Immutable +public final class ElasticPoolListResult { + /* + * 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..03c8c2fca77e1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperationListResult.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.resourcemanager.sql.generated.fluent.models.ElasticPoolOperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list elastic pool operations request. */ +@Immutable +public final class ElasticPoolOperationListResult { + /* + * 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..e26a83d6e6b47 --- /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 {@link 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..8b47161b852b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The max per-database performance level capability. */ +@Fluent +public final class ElasticPoolPerDatabaseMaxPerformanceLevelCapability { + /* + * 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..a34339d3f6853 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMinPerformanceLevelCapability.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The minimum per-database performance level capability. */ +@Fluent +public final class ElasticPoolPerDatabaseMinPerformanceLevelCapability { + /* + * 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..fca6d902ff4e0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseSettings.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Per database settings of an elastic pool. */ +@Fluent +public final class ElasticPoolPerDatabaseSettings { + /* + * 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..b3c8959dc69b9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerformanceLevelCapability.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The Elastic Pool performance level capability. */ +@Fluent +public final class ElasticPoolPerformanceLevelCapability { + /* + * 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..ceefe389c3168 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolUpdate.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.resourcemanager.sql.generated.fluent.models.ElasticPoolUpdateProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An elastic pool update. */ +@Fluent +public final class ElasticPoolUpdate { + /* + * An ARM Resource SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ElasticPoolUpdateProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ElasticPoolUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolUpdateProperties(); + } + this.innerProperties().withMaxSizeBytes(maxSizeBytes); + return this; + } + + /** + * Get the perDatabaseSettings property: The per database settings for the elastic pool. + * + * @return the perDatabaseSettings value. + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolUpdateProperties(); + } + this.innerProperties().withPerDatabaseSettings(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolUpdateProperties(); + } + this.innerProperties().withZoneRedundant(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolUpdateProperties(); + } + this.innerProperties().withLicenseType(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolUpdateProperties(); + } + this.innerProperties().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. Applicable only to Hyperscale elastic pools. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.innerProperties() == null ? null : this.innerProperties().highAvailabilityReplicaCount(); + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. Applicable only to Hyperscale elastic pools. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolUpdateProperties(); + } + this.innerProperties().withHighAvailabilityReplicaCount(highAvailabilityReplicaCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().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..5d69d2fc7c65f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPools.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.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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Long 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..dabe98bc9566d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtector.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + Boolean autoRotationEnabled(); + + /** + * 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, + DefinitionStages.WithAutoRotationEnabled { + /** + * 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); + } + /** The stage of the EncryptionProtector definition allowing to specify autoRotationEnabled. */ + interface WithAutoRotationEnabled { + /** + * Specifies the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false.. + * + * @param autoRotationEnabled Key auto rotation opt-in flag. Either true or false. + * @return the next definition stage. + */ + WithCreate withAutoRotationEnabled(Boolean autoRotationEnabled); + } + } + /** + * 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.WithAutoRotationEnabled { + /** + * 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 autoRotationEnabled. */ + interface WithAutoRotationEnabled { + /** + * Specifies the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false.. + * + * @param autoRotationEnabled Key auto rotation opt-in flag. Either true or false. + * @return the next definition stage. + */ + Update withAutoRotationEnabled(Boolean autoRotationEnabled); + } + } + /** + * 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); + + /** + * Revalidates an existing encryption protector. + * + * @throws com.azure.core.management.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(); + + /** + * Revalidates an existing encryption protector. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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(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..3f1e7c4040799 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorListResult.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.resourcemanager.sql.generated.fluent.models.EncryptionProtectorInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server encryption protectors. */ +@Immutable +public final class EncryptionProtectorListResult { + /* + * 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..879f48a3e1a53 --- /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 { + /** + * 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + Response getWithResponse( + 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. + */ + 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 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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/EndpointCertificate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificate.java new file mode 100644 index 0000000000000..d689b39bde084 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificate.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.EndpointCertificateInner; + +/** An immutable client-side representation of EndpointCertificate. */ +public interface EndpointCertificate { + /** + * 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 publicBlob property: The certificate public blob. + * + * @return the publicBlob value. + */ + String publicBlob(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.EndpointCertificateInner object. + * + * @return the inner object. + */ + EndpointCertificateInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificateListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificateListResult.java new file mode 100644 index 0000000000000..6852639c4d736 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificateListResult.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.resourcemanager.sql.generated.fluent.models.EndpointCertificateInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of endpoint certificates on the target instance. */ +@Immutable +public final class EndpointCertificateListResult { + /* + * 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/EndpointCertificates.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificates.java new file mode 100644 index 0000000000000..e538e57abd4f0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificates.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.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of EndpointCertificates. */ +public interface EndpointCertificates { + /** + * List certificates used on endpoints on the target 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 endpoint certificates on the target instance as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * List certificates used on endpoints on the target 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 endpoint certificates on the target instance as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking 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 a certificate used on the endpoint with the given id. + */ + EndpointCertificate get(String resourceGroupName, String managedInstanceName, String endpointType); + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking 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 a certificate used on the endpoint with the given id along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String endpointType, Context context); +} 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..2f49070477c92 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExportDatabaseDefinition.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform export database operation. */ +@Fluent +public final class ExportDatabaseDefinition { + /* + * 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(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExportDatabaseDefinition.class); +} 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..6505665cbf671 --- /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 { + /** + * 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, 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 com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getWithResponse( + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..1d023dd5c51ec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicy.java @@ -0,0 +1,776 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 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 isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + Boolean isManagedIdentityInUse(); + + /** + * 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.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.WithRetentionDays, + DefinitionStages.WithAuditActionsAndGroups, + DefinitionStages.WithIsStorageSecondaryKeyInUse, + DefinitionStages.WithIsAzureMonitorTargetEnabled, + DefinitionStages.WithQueueDelayMs, + DefinitionStages.WithIsManagedIdentityInUse, + DefinitionStages.WithState, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithStorageAccountSubscriptionId { + /** + * 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 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 + * 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); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify isManagedIdentityInUse. + */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + WithCreate withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy 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 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 + * 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 ExtendedDatabaseBlobAuditingPolicy resource. + * + * @return the stage of resource update. + */ + ExtendedDatabaseBlobAuditingPolicy.Update update(); + + /** The template for ExtendedDatabaseBlobAuditingPolicy update. */ + interface Update + extends UpdateStages.WithPredicateExpression, + UpdateStages.WithRetentionDays, + UpdateStages.WithAuditActionsAndGroups, + UpdateStages.WithIsStorageSecondaryKeyInUse, + UpdateStages.WithIsAzureMonitorTargetEnabled, + UpdateStages.WithQueueDelayMs, + UpdateStages.WithIsManagedIdentityInUse, + UpdateStages.WithState, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithStorageAccountSubscriptionId { + /** + * 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 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + Update withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy 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 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 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. + */ + 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..28ecbe2805323 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicyListResult.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.resourcemanager.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of database extended auditing settings. */ +@Immutable +public final class ExtendedDatabaseBlobAuditingPolicyListResult { + /* + * 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..4914b3a1ed073 --- /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 { + /** + * 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, 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 com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getWithResponse( + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..10b8892af5c4a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicy.java @@ -0,0 +1,847 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs + * will be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be 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 isDevopsAuditEnabled value. + */ + Boolean isDevopsAuditEnabled(); + + /** + * Gets the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value. + */ + String predicateExpression(); + + /** + * 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 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 isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + Boolean isManagedIdentityInUse(); + + /** + * 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.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.WithIsDevopsAuditEnabled, + DefinitionStages.WithPredicateExpression, + DefinitionStages.WithRetentionDays, + DefinitionStages.WithAuditActionsAndGroups, + DefinitionStages.WithIsStorageSecondaryKeyInUse, + DefinitionStages.WithIsAzureMonitorTargetEnabled, + DefinitionStages.WithQueueDelayMs, + DefinitionStages.WithIsManagedIdentityInUse, + DefinitionStages.WithState, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithStorageAccountSubscriptionId { + /** + * 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 isDevopsAuditEnabled. */ + interface WithIsDevopsAuditEnabled { + /** + * Specifies the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, + * devops logs will be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' + * as 'Enabled', 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should also be 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 isDevopsAuditEnabled Specifies the state of devops audit. If state is Enabled, devops logs will be + * sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should also be 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 withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled); + } + /** 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 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + WithCreate withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the ExtendedServerBlobAuditingPolicy 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 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 + * 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 ExtendedServerBlobAuditingPolicy resource. + * + * @return the stage of resource update. + */ + ExtendedServerBlobAuditingPolicy.Update update(); + + /** The template for ExtendedServerBlobAuditingPolicy update. */ + interface Update + extends UpdateStages.WithIsDevopsAuditEnabled, + UpdateStages.WithPredicateExpression, + UpdateStages.WithRetentionDays, + UpdateStages.WithAuditActionsAndGroups, + UpdateStages.WithIsStorageSecondaryKeyInUse, + UpdateStages.WithIsAzureMonitorTargetEnabled, + UpdateStages.WithQueueDelayMs, + UpdateStages.WithIsManagedIdentityInUse, + UpdateStages.WithState, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithStorageAccountSubscriptionId { + /** + * 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 isDevopsAuditEnabled. */ + interface WithIsDevopsAuditEnabled { + /** + * Specifies the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, + * devops logs will be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' + * as 'Enabled', 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should also be 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 isDevopsAuditEnabled Specifies the state of devops audit. If state is Enabled, devops logs will be + * sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should also be 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 withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled); + } + /** 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 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + Update withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the ExtendedServerBlobAuditingPolicy 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 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 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. + */ + 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..441f90a0a81e0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicyListResult.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.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server extended auditing settings. */ +@Immutable +public final class ExtendedServerBlobAuditingPolicyListResult { + /* + * 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..d2953b5e31ae4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroup.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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); + + /** + * Fails over from the current primary server to this server. + * + * @throws com.azure.core.management.exception.ManagementException 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(); + + /** + * Fails over from the current primary server to this 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 failover group. + */ + FailoverGroup failover(Context context); + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @throws com.azure.core.management.exception.ManagementException 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(); + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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(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..c125864bfd3ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupListResult.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.resourcemanager.sql.generated.fluent.models.FailoverGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of failover groups. */ +@Immutable +public final class FailoverGroupListResult { + /* + * 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..0ddbd63a37218 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadOnlyEndpoint.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Read-only endpoint of the failover group instance. */ +@Fluent +public final class FailoverGroupReadOnlyEndpoint { + /* + * 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..de6136a8ec270 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadWriteEndpoint.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Read-write endpoint of the failover group instance. */ +@Fluent +public final class FailoverGroupReadWriteEndpoint { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FailoverGroupReadWriteEndpoint.class); +} 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..f5a07c202e90b --- /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.resourcemanager.sql.generated.fluent.models.FailoverGroupUpdateProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** A failover group update request. */ +@Fluent +public final class FailoverGroupUpdate { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private FailoverGroupUpdateProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private FailoverGroupUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new FailoverGroupUpdateProperties(); + } + this.innerProperties().withReadWriteEndpoint(readWriteEndpoint); + return this; + } + + /** + * Get the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new FailoverGroupUpdateProperties(); + } + this.innerProperties().withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } + + /** + * Get the databases property: List of databases in the failover group. + * + * @return the databases value. + */ + public List databases() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new FailoverGroupUpdateProperties(); + } + this.innerProperties().withDatabases(databases); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..b29a4b820ad55 --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..22c6cc4c215bd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRule.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +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 type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the startIpAddress property: The start IP address of the firewall rule. Must be IPv4 format. Use value + * '0.0.0.0' for 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' for all Azure-internal IP addresses. + * + * @return the endIpAddress value. + */ + String endIpAddress(); + + /** + * 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.WithName, 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 name. */ + interface WithName { + /** + * Specifies the name property: Resource name.. + * + * @param name Resource name. + * @return the next definition stage. + */ + WithCreate withName(String name); + } + /** 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' for 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' + * for 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' for 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' for 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.WithName, 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 name. */ + interface WithName { + /** + * Specifies the name property: Resource name.. + * + * @param name Resource name. + * @return the next definition stage. + */ + Update withName(String name); + } + /** 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' for 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' + * for 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' for 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' for 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/FirewallRuleList.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRuleList.java new file mode 100644 index 0000000000000..55d6a7852b213 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRuleList.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.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server firewall rules. */ +@Fluent +public final class FirewallRuleList { + /* + * The values property. + */ + @JsonProperty(value = "values") + private List values; + + /** + * Get the values property: The values property. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: The values property. + * + * @param values the values value to set. + * @return the FirewallRuleList object itself. + */ + public FirewallRuleList withValues(List values) { + this.values = values; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (values() != null) { + values().forEach(e -> e.validate()); + } + } +} 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..679bddda0e04a --- /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.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list firewall rules request. */ +@Immutable +public final class FirewallRuleListResult { + /* + * 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/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..b5b976fb35802 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRules.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.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 { + /** + * 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 along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, 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. + */ + 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 {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * Gets 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 a list of firewall rules as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets 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 a list of firewall rules as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Replaces all firewall rules on the server. + * + * @param resourceGroupName The name of the resource group that contains 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 A list of server firewall rules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 firewall rule. + */ + FirewallRule replace(String resourceGroupName, String serverName, FirewallRuleList parameters); + + /** + * Replaces all firewall rules on the server. + * + * @param resourceGroupName The name of the resource group that contains 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 A list of server firewall rules. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 firewall rule along with {@link Response}. + */ + Response replaceWithResponse( + String resourceGroupName, String serverName, FirewallRuleList parameters, 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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..f1378b78a1189 --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..f2426d681c608 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyListResult.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.resourcemanager.sql.generated.fluent.models.GeoBackupPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list geo backup policies request. */ +@Fluent +public final class GeoBackupPolicyListResult { + /* + * 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/IPv6FirewallRule.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRule.java new file mode 100644 index 0000000000000..928cc190c84a3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRule.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.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.IPv6FirewallRuleInner; + +/** An immutable client-side representation of IPv6FirewallRule. */ +public interface IPv6FirewallRule { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the startIPv6Address property: The start IP address of the firewall rule. Must be IPv6 format. + * + * @return the startIPv6Address value. + */ + String startIPv6Address(); + + /** + * Gets the endIPv6Address property: The end IP address of the firewall rule. Must be IPv6 format. Must be greater + * than or equal to startIpAddress. + * + * @return the endIPv6Address value. + */ + String endIPv6Address(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.IPv6FirewallRuleInner object. + * + * @return the inner object. + */ + IPv6FirewallRuleInner innerModel(); + + /** The entirety of the IPv6FirewallRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The IPv6FirewallRule definition stages. */ + interface DefinitionStages { + /** The first stage of the IPv6FirewallRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the IPv6FirewallRule 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 IPv6FirewallRule 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.WithName, + DefinitionStages.WithStartIPv6Address, + DefinitionStages.WithEndIPv6Address { + /** + * Executes the create request. + * + * @return the created resource. + */ + IPv6FirewallRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + IPv6FirewallRule create(Context context); + } + /** The stage of the IPv6FirewallRule definition allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: Resource name.. + * + * @param name Resource name. + * @return the next definition stage. + */ + WithCreate withName(String name); + } + /** The stage of the IPv6FirewallRule definition allowing to specify startIPv6Address. */ + interface WithStartIPv6Address { + /** + * Specifies the startIPv6Address property: The start IP address of the firewall rule. Must be IPv6 format.. + * + * @param startIPv6Address The start IP address of the firewall rule. Must be IPv6 format. + * @return the next definition stage. + */ + WithCreate withStartIPv6Address(String startIPv6Address); + } + /** The stage of the IPv6FirewallRule definition allowing to specify endIPv6Address. */ + interface WithEndIPv6Address { + /** + * Specifies the endIPv6Address property: The end IP address of the firewall rule. Must be IPv6 format. Must + * be greater than or equal to startIpAddress.. + * + * @param endIPv6Address The end IP address of the firewall rule. Must be IPv6 format. Must be greater than + * or equal to startIpAddress. + * @return the next definition stage. + */ + WithCreate withEndIPv6Address(String endIPv6Address); + } + } + /** + * Begins update for the IPv6FirewallRule resource. + * + * @return the stage of resource update. + */ + IPv6FirewallRule.Update update(); + + /** The template for IPv6FirewallRule update. */ + interface Update extends UpdateStages.WithName, UpdateStages.WithStartIPv6Address, UpdateStages.WithEndIPv6Address { + /** + * Executes the update request. + * + * @return the updated resource. + */ + IPv6FirewallRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + IPv6FirewallRule apply(Context context); + } + /** The IPv6FirewallRule update stages. */ + interface UpdateStages { + /** The stage of the IPv6FirewallRule update allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: Resource name.. + * + * @param name Resource name. + * @return the next definition stage. + */ + Update withName(String name); + } + /** The stage of the IPv6FirewallRule update allowing to specify startIPv6Address. */ + interface WithStartIPv6Address { + /** + * Specifies the startIPv6Address property: The start IP address of the firewall rule. Must be IPv6 format.. + * + * @param startIPv6Address The start IP address of the firewall rule. Must be IPv6 format. + * @return the next definition stage. + */ + Update withStartIPv6Address(String startIPv6Address); + } + /** The stage of the IPv6FirewallRule update allowing to specify endIPv6Address. */ + interface WithEndIPv6Address { + /** + * Specifies the endIPv6Address property: The end IP address of the firewall rule. Must be IPv6 format. Must + * be greater than or equal to startIpAddress.. + * + * @param endIPv6Address The end IP address of the firewall rule. Must be IPv6 format. Must be greater than + * or equal to startIpAddress. + * @return the next definition stage. + */ + Update withEndIPv6Address(String endIPv6Address); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + IPv6FirewallRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + IPv6FirewallRule refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRuleListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRuleListResult.java new file mode 100644 index 0000000000000..e23e9c38f7e5f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRuleListResult.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.resourcemanager.sql.generated.fluent.models.IPv6FirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list IPv6 firewall rules request. */ +@Immutable +public final class IPv6FirewallRuleListResult { + /* + * 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/IPv6FirewallRules.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRules.java new file mode 100644 index 0000000000000..34709528024f8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRules.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 IPv6FirewallRules. */ +public interface IPv6FirewallRules { + /** + * Gets a list of IPv6 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 a list of IPv6 firewall rules as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of IPv6 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 a list of IPv6 firewall rules as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets an IPv6 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 an IPv6 firewall rule. + */ + IPv6FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Gets an IPv6 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 an IPv6 firewall rule along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * Deletes an IPv6 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 an IPv6 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 {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * Gets an IPv6 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 an IPv6 firewall rule along with {@link Response}. + */ + IPv6FirewallRule getById(String id); + + /** + * Gets an IPv6 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 an IPv6 firewall rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an IPv6 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 an IPv6 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 {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new IPv6FirewallRule resource. + * + * @param name resource name. + * @return the first stage of the new IPv6FirewallRule definition. + */ + IPv6FirewallRule.DefinitionStages.Blank define(String name); +} 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..ca13c8a5a4063 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IdentityType.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 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"); + + /** Static value SystemAssigned,UserAssigned for IdentityType. */ + public static final IdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = fromString("SystemAssigned,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/ImplementationMethod.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImplementationMethod.java new file mode 100644 index 0000000000000..38a8b7d61736d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImplementationMethod.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 ImplementationMethod. */ +public enum ImplementationMethod { + /** Enum value TSql. */ + TSQL("TSql"), + + /** Enum value AzurePowerShell. */ + AZURE_POWER_SHELL("AzurePowerShell"); + + /** The actual serialized value for a ImplementationMethod instance. */ + private final String value; + + ImplementationMethod(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ImplementationMethod instance. + * + * @param value the serialized value to parse. + * @return the parsed ImplementationMethod object, or null if unable to parse. + */ + @JsonCreator + public static ImplementationMethod fromString(String value) { + ImplementationMethod[] items = ImplementationMethod.values(); + for (ImplementationMethod 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/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..9ab76f0515912 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExistingDatabaseDefinition.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.JsonProperty; + +/** Contains the information necessary to perform import operation for existing database. */ +@Fluent +public final class ImportExistingDatabaseDefinition { + /* + * 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(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ImportExistingDatabaseDefinition.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportExtensionsOperationListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportExtensionsOperationListResult.java new file mode 100644 index 0000000000000..338fa70b4394e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportExtensionsOperationListResult.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.resourcemanager.sql.generated.fluent.models.ImportExportExtensionsOperationResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Import export operation extensions list. */ +@Immutable +public final class ImportExportExtensionsOperationListResult { + /* + * 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/ImportExportExtensionsOperationResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportExtensionsOperationResult.java new file mode 100644 index 0000000000000..0d824a67a8f2e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportExtensionsOperationResult.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.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportExtensionsOperationResultInner; +import java.util.UUID; + +/** An immutable client-side representation of ImportExportExtensionsOperationResult. */ +public interface ImportExportExtensionsOperationResult { + /** + * 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 lastModifiedTime property: Last modified time. + * + * @return the lastModifiedTime value. + */ + String lastModifiedTime(); + + /** + * 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 inner com.azure.resourcemanager.sql.generated.fluent.models.ImportExportExtensionsOperationResultInner + * object. + * + * @return the inner object. + */ + ImportExportExtensionsOperationResultInner innerModel(); + + /** The entirety of the ImportExportExtensionsOperationResult definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ImportExportExtensionsOperationResult definition stages. */ + interface DefinitionStages { + /** The first stage of the ImportExportExtensionsOperationResult definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ImportExportExtensionsOperationResult 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 ImportExportExtensionsOperationResult 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.WithOperationMode, + DefinitionStages.WithStorageKeyType, + DefinitionStages.WithStorageKey, + DefinitionStages.WithStorageUri { + /** + * Executes the create request. + * + * @return the created resource. + */ + ImportExportExtensionsOperationResult create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ImportExportExtensionsOperationResult create(Context context); + } + /** The stage of the ImportExportExtensionsOperationResult definition allowing to specify operationMode. */ + interface WithOperationMode { + /** + * Specifies the operationMode property: Operation Mode.. + * + * @param operationMode Operation Mode. + * @return the next definition stage. + */ + WithCreate withOperationMode(OperationMode operationMode); + } + /** The stage of the ImportExportExtensionsOperationResult definition allowing to specify storageKeyType. */ + interface WithStorageKeyType { + /** + * Specifies the storageKeyType property: Storage key type.. + * + * @param storageKeyType Storage key type. + * @return the next definition stage. + */ + WithCreate withStorageKeyType(StorageKeyType storageKeyType); + } + /** The stage of the ImportExportExtensionsOperationResult definition allowing to specify storageKey. */ + interface WithStorageKey { + /** + * Specifies the storageKey property: Storage key.. + * + * @param storageKey Storage key. + * @return the next definition stage. + */ + WithCreate withStorageKey(String storageKey); + } + /** The stage of the ImportExportExtensionsOperationResult definition allowing to specify storageUri. */ + interface WithStorageUri { + /** + * Specifies the storageUri property: Storage Uri.. + * + * @param storageUri Storage Uri. + * @return the next definition stage. + */ + WithCreate withStorageUri(String storageUri); + } + } + /** + * Begins update for the ImportExportExtensionsOperationResult resource. + * + * @return the stage of resource update. + */ + ImportExportExtensionsOperationResult.Update update(); + + /** The template for ImportExportExtensionsOperationResult update. */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ImportExportExtensionsOperationResult apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ImportExportExtensionsOperationResult apply(Context context); + } + /** The ImportExportExtensionsOperationResult update stages. */ + interface UpdateStages { + } +} 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/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..8f207bd339df6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportNewDatabaseDefinition.java @@ -0,0 +1,342 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.JsonProperty; + +/** Contains the information necessary to perform import operation for new database. */ +@Fluent +public final class ImportNewDatabaseDefinition { + /* + * 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(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ImportNewDatabaseDefinition.class); +} 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..2dd40d969e700 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroup.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.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.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 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); + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @throws com.azure.core.management.exception.ManagementException 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(); + + /** + * Fails over from the current primary managed instance to this 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 an instance failover group. + */ + InstanceFailoverGroup failover(Context context); + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @throws com.azure.core.management.exception.ManagementException 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(); + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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(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..6b829c56a4b08 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupListResult.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.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of instance failover groups. */ +@Immutable +public final class InstanceFailoverGroupListResult { + /* + * 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..efc53211b5f9f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadOnlyEndpoint.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Read-only endpoint of the failover group instance. */ +@Fluent +public final class InstanceFailoverGroupReadOnlyEndpoint { + /* + * 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..00f619663fb2a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadWriteEndpoint.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Read-write endpoint of the failover group instance. */ +@Fluent +public final class InstanceFailoverGroupReadWriteEndpoint { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InstanceFailoverGroupReadWriteEndpoint.class); +} 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..0c70828178cef --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..13b372d06971e --- /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. + */ + int 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(int 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..d859f93b1fbd0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolEditionCapability.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.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The instance pool capability. */ +@Fluent +public final class InstancePoolEditionCapability { + /* + * 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..d28ee091826c7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolFamilyCapability.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.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The instance pool family capability. */ +@Fluent +public final class InstancePoolFamilyCapability { + /* + * 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..ee312a60f9de0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolListResult.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.resourcemanager.sql.generated.fluent.models.InstancePoolInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Azure SQL instance pools. */ +@Immutable +public final class InstancePoolListResult { + /* + * 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..592998bb25473 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolUpdate.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An update to an Instance pool. */ +@Fluent +public final class InstancePoolUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the 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..a0ff8c4b6f97d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolVcoresCapability.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.fasterxml.jackson.annotation.JsonProperty; + +/** The managed instance virtual cores capability. */ +@Fluent +public final class InstancePoolVcoresCapability { + /* + * 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..60de22ab7cc94 --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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/IsRetryable.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IsRetryable.java new file mode 100644 index 0000000000000..632bb18353654 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IsRetryable.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 IsRetryable. */ +public enum IsRetryable { + /** Enum value Yes. */ + YES("Yes"), + + /** Enum value No. */ + NO("No"); + + /** The actual serialized value for a IsRetryable instance. */ + private final String value; + + IsRetryable(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IsRetryable instance. + * + * @param value the serialized value to parse. + * @return the parsed IsRetryable object, or null if unable to parse. + */ + @JsonCreator + public static IsRetryable fromString(String value) { + IsRetryable[] items = IsRetryable.values(); + for (IsRetryable 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/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..97f60e9781992 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentListResult.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.resourcemanager.sql.generated.fluent.models.JobAgentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Azure SQL job agents. */ +@Immutable +public final class JobAgentListResult { + /* + * 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..c114b7bb05bcd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentUpdate.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An update to an Azure SQL job agent. */ +@Fluent +public final class JobAgentUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the 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..56fc9eb49d02f --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..ca51f6c03b4dd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentialListResult.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.resourcemanager.sql.generated.fluent.models.JobCredentialInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of job credentials. */ +@Immutable +public final class JobCredentialListResult { + /* + * 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..192e5762eb748 --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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..0b45b1685f6dd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionListResult.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.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of job executions. */ +@Immutable +public final class JobExecutionListResult { + /* + * 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..fb92ea888c05a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionTarget.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The target that a job execution is executed on. */ +@Immutable +public final class JobExecutionTarget { + /* + * 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..52f959b85ca4d --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 {@link 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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..ce069b7bdd9cb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobListResult.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.resourcemanager.sql.generated.fluent.models.JobInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of jobs. */ +@Immutable +public final class JobListResult { + /* + * 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..3dc76db4ea16d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSchedule.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Scheduling properties of a job. */ +@Fluent +public final class JobSchedule { + /* + * 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 ScheduleType 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 ScheduleType 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 ScheduleType 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..acb0e837ece21 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepAction.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The action to be executed by a job step. */ +@Fluent +public final class JobStepAction { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobStepAction.class); +} 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..60c2f1dbabd9f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutionOptions.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The execution options of a job step. */ +@Fluent +public final class JobStepExecutionOptions { + /* + * 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..9ce0082980a44 --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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..cd5ff5fe65d48 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepListResult.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.resourcemanager.sql.generated.fluent.models.JobStepInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of job steps. */ +@Immutable +public final class JobStepListResult { + /* + * 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..8e0592329c7f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutput.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.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** The output configuration of a job step. */ +@Fluent +public final class JobStepOutput { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobStepOutput.class); +} 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..9042b1f2d9f71 --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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..0cf1cf4d019ec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTarget.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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 { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobTarget.class); +} 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..b5031123e3220 --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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..4ebd7e7921273 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupListResult.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.resourcemanager.sql.generated.fluent.models.JobTargetGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of target groups. */ +@Immutable +public final class JobTargetGroupListResult { + /* + * 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..bc764c34edc1b --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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..4d131e4113f7e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersionListResult.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.resourcemanager.sql.generated.fluent.models.JobVersionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of job versions. */ +@Immutable +public final class JobVersionListResult { + /* + * 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..e72cd7d4ccb7d --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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..f11b4ff00660f --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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/LedgerDigestUploads.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploads.java new file mode 100644 index 0000000000000..58f6155c21fe2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploads.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.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.LedgerDigestUploadsInner; + +/** An immutable client-side representation of LedgerDigestUploads. */ +public interface LedgerDigestUploads { + /** + * 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 digestStorageEndpoint property: The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + * + * @return the digestStorageEndpoint value. + */ + String digestStorageEndpoint(); + + /** + * Gets the state property: Specifies the state of ledger digest upload. + * + * @return the state value. + */ + LedgerDigestUploadsState state(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.LedgerDigestUploadsInner object. + * + * @return the inner object. + */ + LedgerDigestUploadsInner innerModel(); + + /** The entirety of the LedgerDigestUploads definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The LedgerDigestUploads definition stages. */ + interface DefinitionStages { + /** The first stage of the LedgerDigestUploads definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the LedgerDigestUploads 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 LedgerDigestUploads 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.WithDigestStorageEndpoint { + /** + * Executes the create request. + * + * @return the created resource. + */ + LedgerDigestUploads create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LedgerDigestUploads create(Context context); + } + /** The stage of the LedgerDigestUploads definition allowing to specify digestStorageEndpoint. */ + interface WithDigestStorageEndpoint { + /** + * Specifies the digestStorageEndpoint property: The digest storage endpoint, which must be either an Azure + * blob storage endpoint or an URI for Azure Confidential Ledger.. + * + * @param digestStorageEndpoint The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + * @return the next definition stage. + */ + WithCreate withDigestStorageEndpoint(String digestStorageEndpoint); + } + } + /** + * Begins update for the LedgerDigestUploads resource. + * + * @return the stage of resource update. + */ + LedgerDigestUploads.Update update(); + + /** The template for LedgerDigestUploads update. */ + interface Update extends UpdateStages.WithDigestStorageEndpoint { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LedgerDigestUploads apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LedgerDigestUploads apply(Context context); + } + /** The LedgerDigestUploads update stages. */ + interface UpdateStages { + /** The stage of the LedgerDigestUploads update allowing to specify digestStorageEndpoint. */ + interface WithDigestStorageEndpoint { + /** + * Specifies the digestStorageEndpoint property: The digest storage endpoint, which must be either an Azure + * blob storage endpoint or an URI for Azure Confidential Ledger.. + * + * @param digestStorageEndpoint The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + * @return the next definition stage. + */ + Update withDigestStorageEndpoint(String digestStorageEndpoint); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LedgerDigestUploads refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LedgerDigestUploads refresh(Context context); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. + * + * @throws com.azure.core.management.exception.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 SQL Database ledger digest upload settings. + */ + LedgerDigestUploads disable(); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 azure SQL Database ledger digest upload settings. + */ + LedgerDigestUploads disable(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsListResult.java new file mode 100644 index 0000000000000..6d871c4b5ee17 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsListResult.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.resourcemanager.sql.generated.fluent.models.LedgerDigestUploadsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of ledger digest upload settings. */ +@Immutable +public final class LedgerDigestUploadsListResult { + /* + * 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/LedgerDigestUploadsName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsName.java new file mode 100644 index 0000000000000..aef063ba29a95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsName.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 LedgerDigestUploadsName. */ +public final class LedgerDigestUploadsName extends ExpandableStringEnum { + /** Static value current for LedgerDigestUploadsName. */ + public static final LedgerDigestUploadsName CURRENT = fromString("current"); + + /** + * Creates or finds a LedgerDigestUploadsName from its string representation. + * + * @param name a name to look for. + * @return the corresponding LedgerDigestUploadsName. + */ + @JsonCreator + public static LedgerDigestUploadsName fromString(String name) { + return fromString(name, LedgerDigestUploadsName.class); + } + + /** @return known LedgerDigestUploadsName values. */ + public static Collection values() { + return values(LedgerDigestUploadsName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsOperations.java new file mode 100644 index 0000000000000..bf66cd9fc45b9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsOperations.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 LedgerDigestUploadsOperations. */ +public interface LedgerDigestUploadsOperations { + /** + * Gets the current ledger digest upload configuration 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 current ledger digest upload configuration for a database. + */ + LedgerDigestUploads get( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads); + + /** + * Gets the current ledger digest upload configuration 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 current ledger digest upload configuration for a database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context); + + /** + * Gets all ledger digest upload settings on 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 all ledger digest upload settings on a database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets all ledger digest upload settings on 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 all ledger digest upload settings on a database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 azure SQL Database ledger digest upload settings. + */ + LedgerDigestUploads disable( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads 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 azure SQL Database ledger digest upload settings. + */ + LedgerDigestUploads disable( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context); + + /** + * Gets the current ledger digest upload configuration for 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 the current ledger digest upload configuration for a database along with {@link Response}. + */ + LedgerDigestUploads getById(String id); + + /** + * Gets the current ledger digest upload configuration for 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 the current ledger digest upload configuration for a database along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new LedgerDigestUploads resource. + * + * @param name resource name. + * @return the first stage of the new LedgerDigestUploads definition. + */ + LedgerDigestUploads.DefinitionStages.Blank define(LedgerDigestUploadsName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsState.java new file mode 100644 index 0000000000000..e58de60e2e9d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsState.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 LedgerDigestUploadsState. */ +public enum LedgerDigestUploadsState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a LedgerDigestUploadsState instance. */ + private final String value; + + LedgerDigestUploadsState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a LedgerDigestUploadsState instance. + * + * @param value the serialized value to parse. + * @return the parsed LedgerDigestUploadsState object, or null if unable to parse. + */ + @JsonCreator + public static LedgerDigestUploadsState fromString(String value) { + LedgerDigestUploadsState[] items = LedgerDigestUploadsState.values(); + for (LedgerDigestUploadsState 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/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..46b09844fbc22 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LicenseTypeCapability.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.fasterxml.jackson.annotation.JsonProperty; + +/** The license type capability. */ +@Fluent +public final class LicenseTypeCapability { + /* + * 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..cc798da9ea72b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeCapability.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The log size capability. */ +@Immutable +public final class LogSizeCapability { + /* + * 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/LogicalDatabaseTransparentDataEncryption.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalDatabaseTransparentDataEncryption.java new file mode 100644 index 0000000000000..2bc09995a6f6b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalDatabaseTransparentDataEncryption.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.LogicalDatabaseTransparentDataEncryptionInner; + +/** An immutable client-side representation of LogicalDatabaseTransparentDataEncryption. */ +public interface LogicalDatabaseTransparentDataEncryption { + /** + * 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 transparent data encryption. + * + * @return the state value. + */ + TransparentDataEncryptionState state(); + + /** + * Gets the inner + * com.azure.resourcemanager.sql.generated.fluent.models.LogicalDatabaseTransparentDataEncryptionInner object. + * + * @return the inner object. + */ + LogicalDatabaseTransparentDataEncryptionInner innerModel(); + + /** The entirety of the LogicalDatabaseTransparentDataEncryption definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The LogicalDatabaseTransparentDataEncryption definition stages. */ + interface DefinitionStages { + /** The first stage of the LogicalDatabaseTransparentDataEncryption definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the LogicalDatabaseTransparentDataEncryption 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 logical database for which the security alert policy is defined. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the LogicalDatabaseTransparentDataEncryption 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + LogicalDatabaseTransparentDataEncryption create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LogicalDatabaseTransparentDataEncryption create(Context context); + } + /** The stage of the LogicalDatabaseTransparentDataEncryption definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the transparent data encryption.. + * + * @param state Specifies the state of the transparent data encryption. + * @return the next definition stage. + */ + WithCreate withState(TransparentDataEncryptionState state); + } + } + /** + * Begins update for the LogicalDatabaseTransparentDataEncryption resource. + * + * @return the stage of resource update. + */ + LogicalDatabaseTransparentDataEncryption.Update update(); + + /** The template for LogicalDatabaseTransparentDataEncryption update. */ + interface Update extends UpdateStages.WithState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LogicalDatabaseTransparentDataEncryption apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LogicalDatabaseTransparentDataEncryption apply(Context context); + } + /** The LogicalDatabaseTransparentDataEncryption update stages. */ + interface UpdateStages { + /** The stage of the LogicalDatabaseTransparentDataEncryption update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the transparent data encryption.. + * + * @param state Specifies the state of the transparent data encryption. + * @return the next definition stage. + */ + Update withState(TransparentDataEncryptionState state); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LogicalDatabaseTransparentDataEncryption refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LogicalDatabaseTransparentDataEncryption refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalDatabaseTransparentDataEncryptionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalDatabaseTransparentDataEncryptionListResult.java new file mode 100644 index 0000000000000..f3945881d0f9d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalDatabaseTransparentDataEncryptionListResult.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.resourcemanager.sql.generated.fluent.models.LogicalDatabaseTransparentDataEncryptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of transparent data encryptions. */ +@Immutable +public final class LogicalDatabaseTransparentDataEncryptionListResult { + /* + * 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/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..6ddd6d6a4a55f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalServerSecurityAlertPolicyListResult.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.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the server's security alert policies. */ +@Immutable +public final class LogicalServerSecurityAlertPolicyListResult { + /* + * 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..46ef688f350ad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupListResult.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.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention backups. */ +@Immutable +public final class LongTermRetentionBackupListResult { + /* + * 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..943d09c6d1c8b --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..917230d12a34f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionManagedInstanceBackups.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.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 along with {@link Response}. + */ + 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) as paginated response with {@link + * PagedIterable}. + */ + 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) as paginated response with {@link + * PagedIterable}. + */ + 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) as paginated response with {@link + * PagedIterable}. + */ + 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) as paginated response with {@link + * PagedIterable}. + */ + 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) as paginated response with {@link + * PagedIterable}. + */ + 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) as paginated response with {@link + * PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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) as paginated response with {@link + * PagedIterable}. + */ + 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) as paginated response with {@link + * PagedIterable}. + */ + 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) as paginated response with {@link + * PagedIterable}. + */ + 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) as paginated response with {@link + * PagedIterable}. + */ + 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) as paginated response with {@link + * PagedIterable}. + */ + 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) as paginated response with {@link + * PagedIterable}. + */ + 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..73090c4241522 --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..ce832378868d8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyListResult.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.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention policies. */ +@Immutable +public final class LongTermRetentionPolicyListResult { + /* + * 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..47fa43c23b039 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceConfigurationCapability.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The maintenance configuration capability. */ +@Fluent +public final class MaintenanceConfigurationCapability { + /* + * 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/MaintenanceWindowOptions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowOptions.java new file mode 100644 index 0000000000000..49b36aa0fd201 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowOptions.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.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowOptionsInner; +import java.util.List; + +/** An immutable client-side representation of MaintenanceWindowOptions. */ +public interface MaintenanceWindowOptions { + /** + * 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 isEnabled property: Whether maintenance windows are enabled for the database. + * + * @return the isEnabled value. + */ + Boolean isEnabled(); + + /** + * Gets the maintenanceWindowCycles property: Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, + * 24*60}. + * + * @return the maintenanceWindowCycles value. + */ + List maintenanceWindowCycles(); + + /** + * Gets the minDurationInMinutes property: Minimum duration of maintenance window. + * + * @return the minDurationInMinutes value. + */ + Integer minDurationInMinutes(); + + /** + * Gets the defaultDurationInMinutes property: Default duration for maintenance window. + * + * @return the defaultDurationInMinutes value. + */ + Integer defaultDurationInMinutes(); + + /** + * Gets the minCycles property: Minimum number of maintenance windows cycles to be set on the database. + * + * @return the minCycles value. + */ + Integer minCycles(); + + /** + * Gets the timeGranularityInMinutes property: Time granularity in minutes for maintenance windows. + * + * @return the timeGranularityInMinutes value. + */ + Integer timeGranularityInMinutes(); + + /** + * Gets the allowMultipleMaintenanceWindowsPerCycle property: Whether we allow multiple maintenance windows per + * cycle. + * + * @return the allowMultipleMaintenanceWindowsPerCycle value. + */ + Boolean allowMultipleMaintenanceWindowsPerCycle(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowOptionsInner object. + * + * @return the inner object. + */ + MaintenanceWindowOptionsInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowOptionsOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowOptionsOperations.java new file mode 100644 index 0000000000000..400fc6269c85f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowOptionsOperations.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 MaintenanceWindowOptionsOperations. */ +public interface MaintenanceWindowOptionsOperations { + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options 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 available maintenance windows. + */ + MaintenanceWindowOptions get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowOptionsName); + + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options 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 available maintenance windows along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowOptionsName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowTimeRange.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowTimeRange.java new file mode 100644 index 0000000000000..5f332816e85a9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowTimeRange.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.fasterxml.jackson.annotation.JsonProperty; + +/** Maintenance window time range. */ +@Fluent +public final class MaintenanceWindowTimeRange { + /* + * Day of maintenance window. + */ + @JsonProperty(value = "dayOfWeek") + private DayOfWeek dayOfWeek; + + /* + * Start time minutes offset from 12am. + */ + @JsonProperty(value = "startTime") + private String startTime; + + /* + * Duration of maintenance window in minutes. + */ + @JsonProperty(value = "duration") + private String duration; + + /** + * Get the dayOfWeek property: Day of maintenance window. + * + * @return the dayOfWeek value. + */ + public DayOfWeek dayOfWeek() { + return this.dayOfWeek; + } + + /** + * Set the dayOfWeek property: Day of maintenance window. + * + * @param dayOfWeek the dayOfWeek value to set. + * @return the MaintenanceWindowTimeRange object itself. + */ + public MaintenanceWindowTimeRange withDayOfWeek(DayOfWeek dayOfWeek) { + this.dayOfWeek = dayOfWeek; + return this; + } + + /** + * Get the startTime property: Start time minutes offset from 12am. + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Start time minutes offset from 12am. + * + * @param startTime the startTime value to set. + * @return the MaintenanceWindowTimeRange object itself. + */ + public MaintenanceWindowTimeRange withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the duration property: Duration of maintenance window in minutes. + * + * @return the duration value. + */ + public String duration() { + return this.duration; + } + + /** + * Set the duration property: Duration of maintenance window in minutes. + * + * @param duration the duration value to set. + * @return the MaintenanceWindowTimeRange object itself. + */ + public MaintenanceWindowTimeRange withDuration(String duration) { + this.duration = duration; + 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/MaintenanceWindows.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindows.java new file mode 100644 index 0000000000000..2fd361a259b1c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindows.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.MaintenanceWindowsInner; +import java.util.List; + +/** An immutable client-side representation of MaintenanceWindows. */ +public interface MaintenanceWindows { + /** + * 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 timeRanges property: The timeRanges property. + * + * @return the timeRanges value. + */ + List timeRanges(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner object. + * + * @return the inner object. + */ + MaintenanceWindowsInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowsOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowsOperations.java new file mode 100644 index 0000000000000..08e747703f03c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowsOperations.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.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner; + +/** Resource collection API of MaintenanceWindowsOperations. */ +public interface MaintenanceWindowsOperations { + /** + * Gets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to get maintenance windows for. + * @param maintenanceWindowName Maintenance window 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 maintenance windows settings for a database. + */ + MaintenanceWindows get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowName); + + /** + * Gets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to get maintenance windows for. + * @param maintenanceWindowName Maintenance window 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 maintenance windows settings for a database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + Context context); + + /** + * Sets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters); + + /** + * Sets maintenance windows settings 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 serverName The name of the server. + * @param databaseName The name of the database to set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters, + Context context); +} 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..dd671cd041e34 --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..2ab2e75606087 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicyListResult.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.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of short term retention policies. */ +@Immutable +public final class ManagedBackupShortTermRetentionPolicyListResult { + /* + * 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..a1f98e9d586da --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabase.java @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 { + /** + * 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); + } + } + /** + * 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); + + /** + * Completes the restore operation on a managed 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(CompleteDatabaseRestoreDefinition parameters); + + /** + * Completes the restore operation on a managed 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(CompleteDatabaseRestoreDefinition parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseColumns.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseColumns.java new file mode 100644 index 0000000000000..6be40fba9f80c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseColumns.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; +import java.util.List; + +/** Resource collection API of ManagedDatabaseColumns. */ +public interface ManagedDatabaseColumns { + /** + * List managed database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * List managed database 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 schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point 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 database columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context); + + /** + * List managed database 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTable( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName); + + /** + * List managed database 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 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 database columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTable( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context); + + /** + * Get managed database 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. + * @return managed database column. + */ + DatabaseColumn get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Get managed database 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 managed database column along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + 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/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..1c26081a0ae4d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseListResult.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.resourcemanager.sql.generated.fluent.models.ManagedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed databases. */ +@Immutable +public final class ManagedDatabaseListResult { + /* + * 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/ManagedDatabaseQueries.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseQueries.java new file mode 100644 index 0000000000000..86c2885809fc0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseQueries.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.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseQueries. */ +public interface ManagedDatabaseQueries { + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId 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 query by query id. + */ + ManagedInstanceQuery get(String resourceGroupName, String managedInstanceName, String databaseName, String queryId); + + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId 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 query by query id along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId, Context context); + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId 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 query execution statistics by query id as paginated response with {@link PagedIterable}. + */ + PagedIterable listByQuery( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId); + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id as paginated response with {@link PagedIterable}. + */ + PagedIterable listByQuery( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRecommendedSensitivityLabels.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRecommendedSensitivityLabels.java new file mode 100644 index 0000000000000..507040f86d0bb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRecommendedSensitivityLabels.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.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseRecommendedSensitivityLabels. */ +public interface ManagedDatabaseRecommendedSensitivityLabels { + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters); + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update 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 the {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context); +} 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..afb9c588e03ae --- /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 along with {@link Response}. + */ + 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/ManagedDatabaseSchemas.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSchemas.java new file mode 100644 index 0000000000000..e8bd2ebd01477 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSchemas.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.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseSchemas. */ +public interface ManagedDatabaseSchemas { + /** + * List managed 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 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 list of database schemas as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * List managed 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 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 a list of database schemas as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context); + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 schema. + */ + DatabaseSchema get(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName); + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 schema along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, Context context); +} 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..5535fa78ec03e --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..8137ce50332ee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicy.java @@ -0,0 +1,369 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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, Brute_Force. + * + * @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, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @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, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @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..48b2a2ef379e3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicyListResult.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.resourcemanager.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner; +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 { + /* + * 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/ManagedDatabaseSecurityEvents.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityEvents.java new file mode 100644 index 0000000000000..4499fda056afe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityEvents.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.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseSecurityEvents. */ +public interface ManagedDatabaseSecurityEvents { + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events 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 a list of security events as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @param filter An OData filter expression that filters elements in the collection. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point 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 security events as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken, + Context context); +} 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..b64ee6b256ca9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSensitivityLabels.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + 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 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 {@link 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 {@link 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 {@link 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 as paginated response with {@link PagedIterable}. + */ + 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 skipToken The skipToken parameter. + * @param count The count 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable listCurrentByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update 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 the {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters, + 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 as paginated response with {@link PagedIterable}. + */ + 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 skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @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 as paginated response with {@link PagedIterable}. + */ + PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + 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 {@link 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/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/ManagedDatabaseTables.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseTables.java new file mode 100644 index 0000000000000..ae3df642b2369 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseTables.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.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 ManagedDatabaseTables. */ +public interface ManagedDatabaseTables { + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 tables as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySchema( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName); + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 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 database tables as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySchema( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String filter, + Context context); + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 table. + */ + DatabaseTable get( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName); + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 table along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseTransparentDataEncryptions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseTransparentDataEncryptions.java new file mode 100644 index 0000000000000..a5a80edc62529 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseTransparentDataEncryptions.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; + +/** Resource collection API of ManagedDatabaseTransparentDataEncryptions. */ +public interface ManagedDatabaseTransparentDataEncryptions { + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName 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 managed database's transparent data encryption. + */ + ManagedTransparentDataEncryption get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName); + + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName 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 managed database's transparent data encryption along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context); + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption 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 managed database's transparent data encryptions as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption 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 managed database's transparent data encryptions as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Gets a managed database's transparent data encryption. + * + * @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 transparent data encryption along with {@link Response}. + */ + ManagedTransparentDataEncryption getById(String id); + + /** + * Gets a managed database's transparent data encryption. + * + * @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 transparent data encryption along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedTransparentDataEncryption resource. + * + * @param name resource name. + * @return the first stage of the new ManagedTransparentDataEncryption definition. + */ + ManagedTransparentDataEncryption.DefinitionStages.Blank define(TransparentDataEncryptionName name); +} 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..dd7d67bc0f44d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseUpdate.java @@ -0,0 +1,419 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.resourcemanager.sql.generated.fluent.models.ManagedDatabaseProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An managed database update. */ +@Fluent +public final class ManagedDatabaseUpdate { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedDatabaseProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withCollation(collation); + return this; + } + + /** + * Get the status property: Status of the database. + * + * @return the status value. + */ + public ManagedDatabaseStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the creationDate property: Creation date of the database. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the earliestRestorePoint property: Earliest restore point in time for point in time restore. + * + * @return the earliestRestorePoint value. + */ + public OffsetDateTime earliestRestorePoint() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withRestorePointInTime(restorePointInTime); + return this; + } + + /** + * Get the defaultSecondaryLocation property: Geo paired region. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.innerProperties() == null ? null : this.innerProperties().defaultSecondaryLocation(); + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withCatalogCollation(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withCreateMode(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withStorageContainerUri(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withSourceDatabaseId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withRestorableDroppedDatabaseId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withStorageContainerSasToken(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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withRecoverableDatabaseId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withLongTermRetentionBackupResourceId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withAutoCompleteRestore(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withLastBackupName(lastBackupName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..aabe0a3c3c983 --- /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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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..8d5556556c2ca --- /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 { + /** + * 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 along with {@link Response}. + */ + Response exportWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + 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 com.azure.core.management.exception.ManagementException thrown if 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + Response getWithResponse( + 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..cd3e1c4b25ec5 --- /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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..d22d8e44feadb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabases.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.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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..f7ce7fc67fd8e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstance.java @@ -0,0 +1,959 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 currentBackupStorageRedundancy property: The storage account type used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the currentBackupStorageRedundancy value. + */ + BackupStorageRedundancy currentBackupStorageRedundancy(); + + /** + * Gets the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the requestedBackupStorageRedundancy value. + */ + BackupStorageRedundancy requestedBackupStorageRedundancy(); + + /** + * Gets the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * Gets the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + String primaryUserAssignedIdentityId(); + + /** + * Gets the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + String keyId(); + + /** + * Gets the administrators property: The Azure Active Directory administrator of the server. + * + * @return the administrators value. + */ + ManagedInstanceExternalAdministrator administrators(); + + /** + * Gets the servicePrincipal property: The managed instance's service principal. + * + * @return the servicePrincipal value. + */ + ServicePrincipal servicePrincipal(); + + /** + * 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.WithRequestedBackupStorageRedundancy, + DefinitionStages.WithZoneRedundant, + DefinitionStages.WithPrimaryUserAssignedIdentityId, + DefinitionStages.WithKeyId, + DefinitionStages.WithAdministrators, + DefinitionStages.WithServicePrincipal { + /** + * 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 requestedBackupStorageRedundancy. */ + interface WithRequestedBackupStorageRedundancy { + /** + * Specifies the requestedBackupStorageRedundancy property: The storage account type to be used to store + * backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), + * Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + * + * @param requestedBackupStorageRedundancy The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo + * (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + * @return the next definition stage. + */ + WithCreate withRequestedBackupStorageRedundancy(BackupStorageRedundancy requestedBackupStorageRedundancy); + } + /** 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); + } + /** The stage of the ManagedInstance definition allowing to specify primaryUserAssignedIdentityId. */ + interface WithPrimaryUserAssignedIdentityId { + /** + * Specifies the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be + * used by default.. + * + * @param primaryUserAssignedIdentityId The resource id of a user assigned identity to be used by default. + * @return the next definition stage. + */ + WithCreate withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId); + } + /** The stage of the ManagedInstance definition allowing to specify keyId. */ + interface WithKeyId { + /** + * Specifies the keyId property: A CMK URI of the key to use for encryption.. + * + * @param keyId A CMK URI of the key to use for encryption. + * @return the next definition stage. + */ + WithCreate withKeyId(String keyId); + } + /** The stage of the ManagedInstance definition allowing to specify administrators. */ + interface WithAdministrators { + /** + * Specifies the administrators property: The Azure Active Directory administrator of the server.. + * + * @param administrators The Azure Active Directory administrator of the server. + * @return the next definition stage. + */ + WithCreate withAdministrators(ManagedInstanceExternalAdministrator administrators); + } + /** The stage of the ManagedInstance definition allowing to specify servicePrincipal. */ + interface WithServicePrincipal { + /** + * Specifies the servicePrincipal property: The managed instance's service principal.. + * + * @param servicePrincipal The managed instance's service principal. + * @return the next definition stage. + */ + WithCreate withServicePrincipal(ServicePrincipal servicePrincipal); + } + } + /** + * 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.WithAdministratorLoginPassword, + UpdateStages.WithSubnetId, + UpdateStages.WithLicenseType, + UpdateStages.WithVCores, + UpdateStages.WithStorageSizeInGB, + UpdateStages.WithPublicDataEndpointEnabled, + UpdateStages.WithProxyOverride, + UpdateStages.WithInstancePoolId, + UpdateStages.WithMaintenanceConfigurationId, + UpdateStages.WithMinimalTlsVersion, + UpdateStages.WithZoneRedundant, + UpdateStages.WithPrimaryUserAssignedIdentityId, + UpdateStages.WithServicePrincipal { + /** + * 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 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 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 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 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 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); + } + /** The stage of the ManagedInstance update allowing to specify primaryUserAssignedIdentityId. */ + interface WithPrimaryUserAssignedIdentityId { + /** + * Specifies the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be + * used by default.. + * + * @param primaryUserAssignedIdentityId The resource id of a user assigned identity to be used by default. + * @return the next definition stage. + */ + Update withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId); + } + /** The stage of the ManagedInstance update allowing to specify servicePrincipal. */ + interface WithServicePrincipal { + /** + * Specifies the servicePrincipal property: The managed instance's service principal.. + * + * @param servicePrincipal The managed instance's service principal. + * @return the next definition stage. + */ + Update withServicePrincipal(ServicePrincipal servicePrincipal); + } + } + /** + * 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); + + /** + * Failovers a managed instance. + * + * @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(ReplicaType replicaType); + + /** + * Failovers a managed instance. + * + * @throws com.azure.core.management.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(); + + /** + * Failovers a managed instance. + * + * @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(ReplicaType replicaType, 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..8a1b94b45b8a9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorListResult.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.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed instance administrators. */ +@Immutable +public final class ManagedInstanceAdministratorListResult { + /* + * 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..fb2b7bd8fe03a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrators.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 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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. + * @param administratorName The administratorName 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 managed instance administrator. + */ + ManagedInstanceAdministrator get( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName); + + /** + * 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 administratorName The administratorName 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 managed instance administrator along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, 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. + * @param administratorName The administratorName 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 managedInstanceName, AdministratorName administratorName); + + /** + * 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 administratorName The administratorName 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 managedInstanceName, AdministratorName administratorName, 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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. + * + * @param name resource name. + * @return the first stage of the new ManagedInstanceAdministrator definition. + */ + ManagedInstanceAdministrator.DefinitionStages.Blank define(AdministratorName name); +} 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..f24ac5864ea8a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthListResult.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.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of active directory only authentications. */ +@Immutable +public final class ManagedInstanceAzureADOnlyAuthListResult { + /* + * 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..dffb90c4e7e2d --- /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..cba53fa0eec28 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentications.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.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 along with {@link Response}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..8724a155c8022 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEditionCapability.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.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The managed server capability. */ +@Fluent +public final class ManagedInstanceEditionCapability { + /* + * 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..db67293a3b5eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtector.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.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 autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + Boolean autoRotationEnabled(); + + /** + * 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, + DefinitionStages.WithAutoRotationEnabled { + /** + * 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); + } + /** The stage of the ManagedInstanceEncryptionProtector definition allowing to specify autoRotationEnabled. */ + interface WithAutoRotationEnabled { + /** + * Specifies the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false.. + * + * @param autoRotationEnabled Key auto rotation opt-in flag. Either true or false. + * @return the next definition stage. + */ + WithCreate withAutoRotationEnabled(Boolean autoRotationEnabled); + } + } + /** + * 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.WithAutoRotationEnabled { + /** + * 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 autoRotationEnabled. */ + interface WithAutoRotationEnabled { + /** + * Specifies the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false.. + * + * @param autoRotationEnabled Key auto rotation opt-in flag. Either true or false. + * @return the next definition stage. + */ + Update withAutoRotationEnabled(Boolean autoRotationEnabled); + } + } + /** + * 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); + + /** + * Revalidates an existing encryption protector. + * + * @throws com.azure.core.management.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(); + + /** + * Revalidates an existing encryption protector. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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(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..b4e6e281991a5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectorListResult.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.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed instance encryption protectors. */ +@Immutable +public final class ManagedInstanceEncryptionProtectorListResult { + /* + * 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..1b85ec5ed37ce --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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/ManagedInstanceExternalAdministrator.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceExternalAdministrator.java new file mode 100644 index 0000000000000..b1f64f5683830 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceExternalAdministrator.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Properties of a active directory administrator. */ +@Fluent +public final class ManagedInstanceExternalAdministrator { + /* + * Type of the sever administrator. + */ + @JsonProperty(value = "administratorType") + private AdministratorType administratorType; + + /* + * Principal Type of the sever administrator. + */ + @JsonProperty(value = "principalType") + private PrincipalType principalType; + + /* + * Login name of the server administrator. + */ + @JsonProperty(value = "login") + private String login; + + /* + * SID (object ID) of the server administrator. + */ + @JsonProperty(value = "sid") + private UUID sid; + + /* + * Tenant ID of the administrator. + */ + @JsonProperty(value = "tenantId") + private UUID tenantId; + + /* + * Azure Active Directory only Authentication enabled. + */ + @JsonProperty(value = "azureADOnlyAuthentication") + 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 ManagedInstanceExternalAdministrator object itself. + */ + public ManagedInstanceExternalAdministrator withAdministratorType(AdministratorType administratorType) { + this.administratorType = administratorType; + return this; + } + + /** + * Get the principalType property: Principal Type of the sever administrator. + * + * @return the principalType value. + */ + public PrincipalType principalType() { + return this.principalType; + } + + /** + * Set the principalType property: Principal Type of the sever administrator. + * + * @param principalType the principalType value to set. + * @return the ManagedInstanceExternalAdministrator object itself. + */ + public ManagedInstanceExternalAdministrator withPrincipalType(PrincipalType principalType) { + this.principalType = principalType; + 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 ManagedInstanceExternalAdministrator object itself. + */ + public ManagedInstanceExternalAdministrator 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 ManagedInstanceExternalAdministrator object itself. + */ + public ManagedInstanceExternalAdministrator 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 ManagedInstanceExternalAdministrator object itself. + */ + public ManagedInstanceExternalAdministrator 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; + } + + /** + * Set the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @param azureADOnlyAuthentication the azureADOnlyAuthentication value to set. + * @return the ManagedInstanceExternalAdministrator object itself. + */ + public ManagedInstanceExternalAdministrator 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/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..aa0641a725642 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceFamilyCapability.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.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The managed server family capability. */ +@Fluent +public final class ManagedInstanceFamilyCapability { + /* + * 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..2e878aa01e427 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKey.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.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 autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + Boolean autoRotationEnabled(); + + /** + * 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 { + /** + * 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 { + } + /** + * 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..63af37d3b4351 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeyListResult.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.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed instance keys. */ +@Immutable +public final class ManagedInstanceKeyListResult { + /* + * 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..2b05722e9c891 --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..add13d9850b45 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceListResult.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.resourcemanager.sql.generated.fluent.models.ManagedInstanceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed instances. */ +@Immutable +public final class ManagedInstanceListResult { + /* + * 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..5380845cc4692 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackup.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.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 backupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the backupStorageRedundancy value. + */ + BackupStorageRedundancy backupStorageRedundancy(); + + /** + * 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..3963dd09c618e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackupListResult.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.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner; +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 { + /* + * 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..b657cf3789fa6 --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..d0e97c07ed39b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyListResult.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.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention policies. */ +@Immutable +public final class ManagedInstanceLongTermRetentionPolicyListResult { + /* + * 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..116a9c865dc19 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceMaintenanceConfigurationCapability.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.fasterxml.jackson.annotation.JsonProperty; + +/** The maintenance configuration capability. */ +@Fluent +public final class ManagedInstanceMaintenanceConfigurationCapability { + /* + * 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..b6575e8eb7f65 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationListResult.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.resourcemanager.sql.generated.fluent.models.ManagedInstanceOperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list managed instance operations request. */ +@Immutable +public final class ManagedInstanceOperationListResult { + /* + * 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..190e96c23d5fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationParametersPair.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The parameters of a managed instance operation. */ +@Immutable +public final class ManagedInstanceOperationParametersPair { + /* + * 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..98e395f025153 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationSteps.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.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The steps of a managed instance operation. */ +@Immutable +public final class ManagedInstanceOperationSteps { + /* + * 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..8aae41d02900c --- /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 { + /** + * 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, 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 com.azure.core.management.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 {@link Response}. + */ + Response cancelWithResponse( + 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..e9d8c2e9152ad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePairInfo.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Pairs of Managed Instances in the failover group. */ +@Fluent +public final class ManagedInstancePairInfo { + /* + * 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..79e0475c625a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePecProperty.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.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection under a managed instance. */ +@Immutable +public final class ManagedInstancePecProperty { + /* + * 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/ManagedInstancePrivateEndpointConnection.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnection.java new file mode 100644 index 0000000000000..e2169af622aca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnection.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionInner; + +/** An immutable client-side representation of ManagedInstancePrivateEndpointConnection. */ +public interface ManagedInstancePrivateEndpointConnection { + /** + * 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. + */ + ManagedInstancePrivateEndpointProperty privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @return the privateLinkServiceConnectionState value. + */ + ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: State of the Private Endpoint Connection. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner + * com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + ManagedInstancePrivateEndpointConnectionInner innerModel(); + + /** The entirety of the ManagedInstancePrivateEndpointConnection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstancePrivateEndpointConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstancePrivateEndpointConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstancePrivateEndpointConnection 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 ManagedInstancePrivateEndpointConnection 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. + */ + ManagedInstancePrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstancePrivateEndpointConnection create(Context context); + } + /** The stage of the ManagedInstancePrivateEndpointConnection 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(ManagedInstancePrivateEndpointProperty privateEndpoint); + } + /** + * The stage of the ManagedInstancePrivateEndpointConnection 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( + ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + } + /** + * Begins update for the ManagedInstancePrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + ManagedInstancePrivateEndpointConnection.Update update(); + + /** The template for ManagedInstancePrivateEndpointConnection update. */ + interface Update extends UpdateStages.WithPrivateEndpoint, UpdateStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstancePrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstancePrivateEndpointConnection apply(Context context); + } + /** The ManagedInstancePrivateEndpointConnection update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstancePrivateEndpointConnection 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(ManagedInstancePrivateEndpointProperty privateEndpoint); + } + /** + * The stage of the ManagedInstancePrivateEndpointConnection 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( + ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstancePrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstancePrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnectionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnectionListResult.java new file mode 100644 index 0000000000000..68f3f040b4d40 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnectionListResult.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.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private endpoint connections. */ +@Immutable +public final class ManagedInstancePrivateEndpointConnectionListResult { + /* + * 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/ManagedInstancePrivateEndpointConnections.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnections.java new file mode 100644 index 0000000000000..b9985658172ed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnections.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 ManagedInstancePrivateEndpointConnections. */ +public interface ManagedInstancePrivateEndpointConnections { + /** + * 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 managedInstanceName The name of the managed instance. + * @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. + */ + ManagedInstancePrivateEndpointConnection get( + String resourceGroupName, String managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 managedInstanceName, 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 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 all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName); + + /** + * 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 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 all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, 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 along with {@link Response}. + */ + ManagedInstancePrivateEndpointConnection 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 along with {@link Response}. + */ + 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 ManagedInstancePrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstancePrivateEndpointConnection definition. + */ + ManagedInstancePrivateEndpointConnection.DefinitionStages.Blank define(String name); +} 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..add023a3bad89 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointProperty.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ManagedInstancePrivateEndpointProperty model. */ +@Fluent +public final class ManagedInstancePrivateEndpointProperty { + /* + * 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/ManagedInstancePrivateLink.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLink.java new file mode 100644 index 0000000000000..a6f1c21596e7d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLink.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.ManagedInstancePrivateLinkInner; + +/** An immutable client-side representation of ManagedInstancePrivateLink. */ +public interface ManagedInstancePrivateLink { + /** + * 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. + */ + ManagedInstancePrivateLinkProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateLinkInner object. + * + * @return the inner object. + */ + ManagedInstancePrivateLinkInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkListResult.java new file mode 100644 index 0000000000000..9d5e972c5ca24 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkListResult.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.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateLinkInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Immutable +public final class ManagedInstancePrivateLinkListResult { + /* + * 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/ManagedInstancePrivateLinkProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkProperties.java new file mode 100644 index 0000000000000..01615ab8d5ac4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkProperties.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a private link resource. */ +@Immutable +public final class ManagedInstancePrivateLinkProperties { + /* + * 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/ManagedInstancePrivateLinkResources.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkResources.java new file mode 100644 index 0000000000000..27fd9ba0a6888 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkResources.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 ManagedInstancePrivateLinkResources. */ +public interface ManagedInstancePrivateLinkResources { + /** + * 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 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 private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName); + + /** + * 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 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 private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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. + */ + ManagedInstancePrivateLink get(String resourceGroupName, String managedInstanceName, 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 managedInstanceName The name of the managed instance. + * @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 along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String groupName, Context context); +} 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..4ae06ce1b64af --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkServiceConnectionStateProperty.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ManagedInstancePrivateLinkServiceConnectionStateProperty model. */ +@Fluent +public final class ManagedInstancePrivateLinkServiceConnectionStateProperty { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = + new ClientLogger(ManagedInstancePrivateLinkServiceConnectionStateProperty.class); +} 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..90ba0ae5eab38 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePropertiesProvisioningState.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.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"); + + /** Static value Accepted for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState ACCEPTED = fromString("Accepted"); + + /** Static value Created for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState CREATED = fromString("Created"); + + /** Static value Deleted for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState DELETED = fromString("Deleted"); + + /** Static value Unrecognized for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState UNRECOGNIZED = fromString("Unrecognized"); + + /** Static value Running for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState RUNNING = fromString("Running"); + + /** Static value Canceled for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState CANCELED = fromString("Canceled"); + + /** Static value NotSpecified for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Registering for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState REGISTERING = fromString("Registering"); + + /** Static value TimedOut for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState TIMED_OUT = fromString("TimedOut"); + + /** + * 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/ManagedInstanceQuery.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceQuery.java new file mode 100644 index 0000000000000..394a757435e9b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceQuery.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.ManagedInstanceQueryInner; + +/** An immutable client-side representation of ManagedInstanceQuery. */ +public interface ManagedInstanceQuery { + /** + * 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 queryText property: Query text. + * + * @return the queryText value. + */ + String queryText(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceQueryInner object. + * + * @return the inner object. + */ + ManagedInstanceQueryInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceQueryStatistics.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceQueryStatistics.java new file mode 100644 index 0000000000000..fe9c6d76e200f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceQueryStatistics.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.resourcemanager.sql.generated.fluent.models.QueryStatisticsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Execution statistics for one particular query. */ +@Immutable +public final class ManagedInstanceQueryStatistics { + /* + * 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/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..a50fd9bf38688 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceUpdate.java @@ -0,0 +1,756 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.resourcemanager.sql.generated.fluent.models.ManagedInstanceProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +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. */ +@Fluent +public final class ManagedInstanceUpdate { + /* + * Managed instance sku + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Managed instance identity + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withManagedInstanceCreateMode(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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withAdministratorLogin(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + /** + * Get the subnetId property: Subnet resource ID for the managed instance. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withSubnetId(subnetId); + return this; + } + + /** + * Get the state property: The state of the managed instance. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withLicenseType(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withVCores(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withStorageSizeInGB(storageSizeInGB); + return this; + } + + /** + * Get the collation property: Collation of the managed instance. + * + * @return the collation value. + */ + public String collation() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withCollation(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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withDnsZonePartner(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withPublicDataEndpointEnabled(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withSourceManagedInstanceId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withRestorePointInTime(restorePointInTime); + return this; + } + + /** + * Get the proxyOverride property: Connection type used for connecting to the instance. + * + * @return the proxyOverride value. + */ + public ManagedInstanceProxyOverride proxyOverride() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withProxyOverride(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withTimezoneId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withInstancePoolId(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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withMaintenanceConfigurationId(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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** + * Get the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the currentBackupStorageRedundancy value. + */ + public BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().currentBackupStorageRedundancy(); + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().requestedBackupStorageRedundancy(); + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } + + /** + * Get the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withZoneRedundant(zoneRedundant); + return this; + } + + /** + * Get the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + public String primaryUserAssignedIdentityId() { + return this.innerProperties() == null ? null : this.innerProperties().primaryUserAssignedIdentityId(); + } + + /** + * Set the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } + + /** + * Get the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + public String keyId() { + return this.innerProperties() == null ? null : this.innerProperties().keyId(); + } + + /** + * Set the keyId property: A CMK URI of the key to use for encryption. + * + * @param keyId the keyId value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withKeyId(String keyId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withKeyId(keyId); + return this; + } + + /** + * Get the administrators property: The Azure Active Directory administrator of the server. + * + * @return the administrators value. + */ + public ManagedInstanceExternalAdministrator administrators() { + return this.innerProperties() == null ? null : this.innerProperties().administrators(); + } + + /** + * Set the administrators property: The Azure Active Directory administrator of the server. + * + * @param administrators the administrators value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withAdministrators(ManagedInstanceExternalAdministrator administrators) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withAdministrators(administrators); + return this; + } + + /** + * Get the servicePrincipal property: The managed instance's service principal. + * + * @return the servicePrincipal value. + */ + public ServicePrincipal servicePrincipal() { + return this.innerProperties() == null ? null : this.innerProperties().servicePrincipal(); + } + + /** + * Set the servicePrincipal property: The managed instance's service principal. + * + * @param servicePrincipal the servicePrincipal value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withServicePrincipal(ServicePrincipal servicePrincipal) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withServicePrincipal(servicePrincipal); + 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 (innerProperties() != null) { + innerProperties().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..22345d889e9d0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVcoresCapability.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The managed instance virtual cores capability. */ +@Fluent +public final class ManagedInstanceVcoresCapability { + /* + * 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..f0a2034de597d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVersionCapability.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.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The managed instance capability. */ +@Fluent +public final class ManagedInstanceVersionCapability { + /* + * 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..cf35c04ad26f5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessment.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.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 write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @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. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @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 write access + * to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet + * or a firewall. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. Applies only if the storage account is not behind a + * Vnet or a firewall. + * @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. Applies only if the storage account is not behind a Vnet or a + * firewall. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. Applies only if the storage account is not behind a Vnet or a firewall. + * @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 write access + * to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet + * or a firewall. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. Applies only if the storage account is not behind a + * Vnet or a firewall. + * @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. Applies only if the storage account is not behind a Vnet or a + * firewall. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. Applies only if the storage account is not behind a Vnet or a firewall. + * @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..105db1569855c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessmentListResult.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.resourcemanager.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the ManagedInstance's vulnerability assessments. */ +@Immutable +public final class ManagedInstanceVulnerabilityAssessmentListResult { + /* + * 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..766c0e6600d91 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessments.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.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 along with {@link Response}. + */ + 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 {@link 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 as paginated response with {@link + * PagedIterable}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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..cf0c0147cadae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstances.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.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 as paginated response with {@link PagedIterable}. + */ + 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, String expand, 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets a list of all managed instances in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String expand, 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 as paginated response with {@link PagedIterable}. + */ + 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String expand, 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String managedInstanceName, String expand, 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 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 along with {@link Response}. + */ + ManagedInstance getById(String id); + + /** + * Gets a managed instance. + * + * @param id the resource ID. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance along with {@link Response}. + */ + Response getByIdWithResponse(String id, String expand, 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..c010cbfec52e2 --- /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 along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + Context context); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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. + */ + ManagedBackupShortTermRetentionPolicy createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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. + */ + ManagedBackupShortTermRetentionPolicy createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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. + */ + ManagedBackupShortTermRetentionPolicy update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @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. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..5fbf84e3f24ee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicies.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.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, SecurityAlertPolicyName 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 along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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(SecurityAlertPolicyName 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..67f6dd9ee657a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicy.java @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.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 systemData property: SystemData of SecurityAlertPolicyResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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. + */ + SecurityAlertsPolicyState 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, Brute_Force. + * + * @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(SecurityAlertsPolicyState 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, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @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(SecurityAlertsPolicyState 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, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @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..2ae0a0d040d5c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicyListResult.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.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner; +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 { + /* + * 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/ManagedTransparentDataEncryption.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedTransparentDataEncryption.java new file mode 100644 index 0000000000000..892ffe749dcab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedTransparentDataEncryption.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.ManagedTransparentDataEncryptionInner; + +/** An immutable client-side representation of ManagedTransparentDataEncryption. */ +public interface ManagedTransparentDataEncryption { + /** + * 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 transparent data encryption. + * + * @return the state value. + */ + TransparentDataEncryptionState state(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedTransparentDataEncryptionInner + * object. + * + * @return the inner object. + */ + ManagedTransparentDataEncryptionInner innerModel(); + + /** The entirety of the ManagedTransparentDataEncryption definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedTransparentDataEncryption definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedTransparentDataEncryption definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedTransparentDataEncryption 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 ManagedTransparentDataEncryption 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedTransparentDataEncryption create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedTransparentDataEncryption create(Context context); + } + /** The stage of the ManagedTransparentDataEncryption definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the transparent data encryption.. + * + * @param state Specifies the state of the transparent data encryption. + * @return the next definition stage. + */ + WithCreate withState(TransparentDataEncryptionState state); + } + } + /** + * Begins update for the ManagedTransparentDataEncryption resource. + * + * @return the stage of resource update. + */ + ManagedTransparentDataEncryption.Update update(); + + /** The template for ManagedTransparentDataEncryption update. */ + interface Update extends UpdateStages.WithState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedTransparentDataEncryption apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedTransparentDataEncryption apply(Context context); + } + /** The ManagedTransparentDataEncryption update stages. */ + interface UpdateStages { + /** The stage of the ManagedTransparentDataEncryption update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the transparent data encryption.. + * + * @param state Specifies the state of the transparent data encryption. + * @return the next definition stage. + */ + Update withState(TransparentDataEncryptionState state); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedTransparentDataEncryption refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedTransparentDataEncryption refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedTransparentDataEncryptionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedTransparentDataEncryptionListResult.java new file mode 100644 index 0000000000000..7082d320252ba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedTransparentDataEncryptionListResult.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.resourcemanager.sql.generated.fluent.models.ManagedTransparentDataEncryptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed transparent data encryptions. */ +@Immutable +public final class ManagedTransparentDataEncryptionListResult { + /* + * 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/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..5f5fea6ad9af1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeCapability.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The maximum size capability. */ +@Immutable +public final class MaxSizeCapability { + /* + * 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..3e9c7aa3d37c7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeRangeCapability.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The maximum size range capability. */ +@Fluent +public final class MaxSizeRangeCapability { + /* + * 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..57d6cd98579aa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricAvailability.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A metric availability value. */ +@Immutable +public final class MetricAvailability { + /* + * 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..c2eee85d3ae4a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinitionListResult.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.MetricDefinitionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list database metric definitions request. */ +@Fluent +public final class MetricDefinitionListResult { + /* + * 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()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricDefinitionListResult.class); +} 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..fc57acafd8fdc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricListResult.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.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list database metrics request. */ +@Fluent +public final class MetricListResult { + /* + * 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()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricListResult.class); +} 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..e2837bf474ff5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricName.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A database metric name. */ +@Immutable +public final class MetricName { + /* + * 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..81c6aecf11188 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricValue.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.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents database metrics. */ +@Immutable +public final class MetricValue { + /* + * 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..85861c36f48ae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MinCapacityCapability.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.fasterxml.jackson.annotation.JsonProperty; + +/** The min capacity capability. */ +@Fluent +public final class MinCapacityCapability { + /* + * 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..dbb8638240d76 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Name.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** ARM Usage Name. */ +@Fluent +public final class Name { + /* + * 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..fa91fcf8824d6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/NetworkIsolationSettings.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.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the ARM resources for which to create private endpoint connection. */ +@Fluent +public final class NetworkIsolationSettings { + /* + * 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..bb2ad2d2905ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationDisplay.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display metadata associated with the operation. */ +@Immutable +public final class OperationDisplay { + /* + * 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/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..21afb11c2ccaf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationListResult.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.resourcemanager.sql.generated.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the request to list SQL operations. */ +@Immutable +public final class OperationListResult { + /* + * 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/OperationMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationMode.java new file mode 100644 index 0000000000000..3723569d9a0fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationMode.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 OperationMode. */ +public final class OperationMode extends ExpandableStringEnum { + /** Static value PolybaseImport for OperationMode. */ + public static final OperationMode POLYBASE_IMPORT = fromString("PolybaseImport"); + + /** + * Creates or finds a OperationMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationMode. + */ + @JsonCreator + public static OperationMode fromString(String name) { + return fromString(name, OperationMode.class); + } + + /** @return known OperationMode values. */ + public static Collection values() { + return values(OperationMode.class); + } +} 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..99fa720c46f8b --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRule.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRule.java new file mode 100644 index 0000000000000..91197959c22f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRule.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.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.OutboundFirewallRuleInner; + +/** An immutable client-side representation of OutboundFirewallRule. */ +public interface OutboundFirewallRule { + /** + * 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 provisioningState property: The state of the outbound rule. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.OutboundFirewallRuleInner object. + * + * @return the inner object. + */ + OutboundFirewallRuleInner innerModel(); + + /** The entirety of the OutboundFirewallRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The OutboundFirewallRule definition stages. */ + interface DefinitionStages { + /** The first stage of the OutboundFirewallRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the OutboundFirewallRule 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 OutboundFirewallRule 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. + */ + OutboundFirewallRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + OutboundFirewallRule create(Context context); + } + } + /** + * Begins update for the OutboundFirewallRule resource. + * + * @return the stage of resource update. + */ + OutboundFirewallRule.Update update(); + + /** The template for OutboundFirewallRule update. */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + OutboundFirewallRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + OutboundFirewallRule apply(Context context); + } + /** The OutboundFirewallRule update stages. */ + interface UpdateStages { + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + OutboundFirewallRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + OutboundFirewallRule refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRuleListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRuleListResult.java new file mode 100644 index 0000000000000..a36bfbe379d6c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRuleListResult.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.resourcemanager.sql.generated.fluent.models.OutboundFirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of outbound rules. */ +@Immutable +public final class OutboundFirewallRuleListResult { + /* + * 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/OutboundFirewallRules.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRules.java new file mode 100644 index 0000000000000..34486ae080844 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRules.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 OutboundFirewallRules. */ +public interface OutboundFirewallRules { + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn 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 an outbound firewall rule. + */ + OutboundFirewallRule get(String resourceGroupName, String serverName, String outboundRuleFqdn); + + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn 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 an outbound firewall rule along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context); + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 outboundRuleFqdn); + + /** + * Deletes a outbound firewall rule 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 outboundRuleFqdn The outboundRuleFqdn 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 outboundRuleFqdn, Context context); + + /** + * Gets all outbound firewall rules 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 outbound firewall rules on a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all outbound firewall rules 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 outbound firewall rules on a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets an outbound 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 an outbound firewall rule along with {@link Response}. + */ + OutboundFirewallRule getById(String id); + + /** + * Gets an outbound 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 an outbound firewall rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a outbound firewall rule 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 outbound firewall rule 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 OutboundFirewallRule resource. + * + * @param name resource name. + * @return the first stage of the new OutboundFirewallRule definition. + */ + OutboundFirewallRule.DefinitionStages.Blank define(String name); +} 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..3a84a76357482 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerInfo.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.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Partner server information for the failover group. */ +@Fluent +public final class PartnerInfo { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PartnerInfo.class); +} 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..d17ed00d12929 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerRegionInfo.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.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Partner region information for the failover group. */ +@Fluent +public final class PartnerRegionInfo { + /* + * 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..7f55153aa44ad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelCapability.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The performance level capability. */ +@Immutable +public final class PerformanceLevelCapability { + /* + * 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/PrincipalType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrincipalType.java new file mode 100644 index 0000000000000..dff9672411f4d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrincipalType.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 PrincipalType. */ +public final class PrincipalType extends ExpandableStringEnum { + /** Static value User for PrincipalType. */ + public static final PrincipalType USER = fromString("User"); + + /** Static value Group for PrincipalType. */ + public static final PrincipalType GROUP = fromString("Group"); + + /** Static value Application for PrincipalType. */ + public static final PrincipalType APPLICATION = fromString("Application"); + + /** + * Creates or finds a PrincipalType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrincipalType. + */ + @JsonCreator + public static PrincipalType fromString(String name) { + return fromString(name, PrincipalType.class); + } + + /** @return known PrincipalType values. */ + public static Collection values() { + return values(PrincipalType.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..64309b5ac5916 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionListResult.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.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private endpoint connections. */ +@Immutable +public final class PrivateEndpointConnectionListResult { + /* + * 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/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..9871b84a8b8ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionRequestStatus.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the private endpoint connection requests status. */ +@Immutable +public final class PrivateEndpointConnectionRequestStatus { + /* + * 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..4ba0ed01c9276 --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..33496a8f23378 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProperty.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PrivateEndpointProperty model. */ +@Fluent +public final class PrivateEndpointProperty { + /* + * 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..49354532d821e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceListResult.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.resourcemanager.sql.generated.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Immutable +public final class PrivateLinkResourceListResult { + /* + * 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..038222205a104 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceProperties.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.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a private link resource. */ +@Immutable +public final class PrivateLinkResourceProperties { + /* + * 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; + + /* + * The private link resource required zone names. + */ + @JsonProperty(value = "requiredZoneNames", access = JsonProperty.Access.WRITE_ONLY) + private List requiredZoneNames; + + /** + * 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; + } + + /** + * Get the requiredZoneNames property: The private link resource required zone names. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * 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..bdb4a73c54934 --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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..bf00c3244a08f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateProperty.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.JsonProperty; + +/** The PrivateLinkServiceConnectionStateProperty model. */ +@Fluent +public final class PrivateLinkServiceConnectionStateProperty { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkServiceConnectionStateProperty.class); +} 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/ProxyResourceWithWritableName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ProxyResourceWithWritableName.java new file mode 100644 index 0000000000000..d082058fe9be3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ProxyResourceWithWritableName.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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; + +/** ARM proxy resource. */ +@Fluent +public class ProxyResourceWithWritableName extends ResourceWithWritableName { + /** {@inheritDoc} */ + @Override + public ProxyResourceWithWritableName withName(String name) { + super.withName(name); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} 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..de8b82e93e13a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricInterval.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.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a query metrics interval. */ +@Fluent +public final class QueryMetricInterval { + /* + * 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..b0282ab77fd82 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricProperties.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.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a topquery metric in one interval. */ +@Immutable +public final class QueryMetricProperties { + /* + * 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/QueryStatistics.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryStatistics.java new file mode 100644 index 0000000000000..fdad1531c8781 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryStatistics.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.QueryStatisticsInner; +import java.util.List; + +/** An immutable client-side representation of QueryStatistics. */ +public interface QueryStatistics { + /** + * 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: Database name of the database in which this query was executed. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the queryId property: Unique query id (unique within one database). + * + * @return the queryId value. + */ + String queryId(); + + /** + * 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 intervals property: List of intervals with appropriate metric data. + * + * @return the intervals value. + */ + List intervals(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsInner object. + * + * @return the inner object. + */ + QueryStatisticsInner innerModel(); +} 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..ae99afb2d91c7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadScaleCapability.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.fasterxml.jackson.annotation.JsonProperty; + +/** The read scale capability. */ +@Fluent +public final class ReadScaleCapability { + /* + * 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/RecommendedAction.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedAction.java new file mode 100644 index 0000000000000..dac9f7a62ab71 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedAction.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.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of RecommendedAction. */ +public interface RecommendedAction { + /** + * 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 location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the recommendationReason property: Gets the reason for recommending this action. e.g., DuplicateIndex. + * + * @return the recommendationReason value. + */ + String recommendationReason(); + + /** + * Gets the validSince property: Gets the time since when this recommended action is valid. + * + * @return the validSince value. + */ + OffsetDateTime validSince(); + + /** + * Gets the lastRefresh property: Gets time when this recommended action was last refreshed. + * + * @return the lastRefresh value. + */ + OffsetDateTime lastRefresh(); + + /** + * Gets the state property: Gets the info of the current state the recommended action is in. + * + * @return the state value. + */ + RecommendedActionStateInfo state(); + + /** + * Gets the isExecutableAction property: Gets if this recommended action is actionable by user. + * + * @return the isExecutableAction value. + */ + Boolean isExecutableAction(); + + /** + * Gets the isRevertableAction property: Gets if changes applied by this recommended action can be reverted by user. + * + * @return the isRevertableAction value. + */ + Boolean isRevertableAction(); + + /** + * Gets the isArchivedAction property: Gets if this recommended action was suggested some time ago but user chose to + * ignore this and system added a new recommended action again. + * + * @return the isArchivedAction value. + */ + Boolean isArchivedAction(); + + /** + * Gets the executeActionStartTime property: Gets the time when system started applying this recommended action on + * the user resource. e.g., index creation start time. + * + * @return the executeActionStartTime value. + */ + OffsetDateTime executeActionStartTime(); + + /** + * Gets the executeActionDuration property: Gets the time taken for applying this recommended action on user + * resource. e.g., time taken for index creation. + * + * @return the executeActionDuration value. + */ + String executeActionDuration(); + + /** + * Gets the revertActionStartTime property: Gets the time when system started reverting changes of this recommended + * action on user resource. e.g., time when index drop is executed. + * + * @return the revertActionStartTime value. + */ + OffsetDateTime revertActionStartTime(); + + /** + * Gets the revertActionDuration property: Gets the time taken for reverting changes of this recommended action on + * user resource. e.g., time taken for dropping the created index. + * + * @return the revertActionDuration value. + */ + String revertActionDuration(); + + /** + * Gets the executeActionInitiatedBy property: Gets if approval for applying this recommended action was given by + * user/system. + * + * @return the executeActionInitiatedBy value. + */ + RecommendedActionInitiatedBy executeActionInitiatedBy(); + + /** + * Gets the executeActionInitiatedTime property: Gets the time when this recommended action was approved for + * execution. + * + * @return the executeActionInitiatedTime value. + */ + OffsetDateTime executeActionInitiatedTime(); + + /** + * Gets the revertActionInitiatedBy property: Gets if approval for reverting this recommended action was given by + * user/system. + * + * @return the revertActionInitiatedBy value. + */ + RecommendedActionInitiatedBy revertActionInitiatedBy(); + + /** + * Gets the revertActionInitiatedTime property: Gets the time when this recommended action was approved for revert. + * + * @return the revertActionInitiatedTime value. + */ + OffsetDateTime revertActionInitiatedTime(); + + /** + * Gets the score property: Gets the impact of this recommended action. Possible values are 1 - Low impact, 2 - + * Medium Impact and 3 - High Impact. + * + * @return the score value. + */ + Integer score(); + + /** + * Gets the implementationDetails property: Gets the implementation details of this recommended action for user to + * apply it manually. + * + * @return the implementationDetails value. + */ + RecommendedActionImplementationInfo implementationDetails(); + + /** + * Gets the errorDetails property: Gets the error details if and why this recommended action is put to error state. + * + * @return the errorDetails value. + */ + RecommendedActionErrorInfo errorDetails(); + + /** + * Gets the estimatedImpact property: Gets the estimated impact info for this recommended action e.g., Estimated CPU + * gain, Estimated Disk Space change. + * + * @return the estimatedImpact value. + */ + List estimatedImpact(); + + /** + * Gets the observedImpact property: Gets the observed/actual impact info for this recommended action e.g., Actual + * CPU gain, Actual Disk Space change. + * + * @return the observedImpact value. + */ + List observedImpact(); + + /** + * Gets the timeSeries property: Gets the time series info of metrics for this recommended action e.g., CPU + * consumption time series. + * + * @return the timeSeries value. + */ + List timeSeries(); + + /** + * Gets the linkedObjects property: Gets the linked objects, if any. + * + * @return the linkedObjects value. + */ + List linkedObjects(); + + /** + * Gets the details property: Gets additional details specific to this recommended action. + * + * @return the details value. + */ + Map details(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner object. + * + * @return the inner object. + */ + RecommendedActionInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionCurrentState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionCurrentState.java new file mode 100644 index 0000000000000..5dfe72b4d9cfe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionCurrentState.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RecommendedActionCurrentState. */ +public final class RecommendedActionCurrentState extends ExpandableStringEnum { + /** Static value Active for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState ACTIVE = fromString("Active"); + + /** Static value Pending for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState PENDING = fromString("Pending"); + + /** Static value Executing for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState EXECUTING = fromString("Executing"); + + /** Static value Verifying for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState VERIFYING = fromString("Verifying"); + + /** Static value PendingRevert for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState PENDING_REVERT = fromString("PendingRevert"); + + /** Static value RevertCancelled for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState REVERT_CANCELLED = fromString("RevertCancelled"); + + /** Static value Reverting for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState REVERTING = fromString("Reverting"); + + /** Static value Reverted for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState REVERTED = fromString("Reverted"); + + /** Static value Ignored for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState IGNORED = fromString("Ignored"); + + /** Static value Expired for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState EXPIRED = fromString("Expired"); + + /** Static value Monitoring for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState MONITORING = fromString("Monitoring"); + + /** Static value Resolved for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState RESOLVED = fromString("Resolved"); + + /** Static value Success for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState SUCCESS = fromString("Success"); + + /** Static value Error for RecommendedActionCurrentState. */ + public static final RecommendedActionCurrentState ERROR = fromString("Error"); + + /** + * Creates or finds a RecommendedActionCurrentState from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecommendedActionCurrentState. + */ + @JsonCreator + public static RecommendedActionCurrentState fromString(String name) { + return fromString(name, RecommendedActionCurrentState.class); + } + + /** @return known RecommendedActionCurrentState values. */ + public static Collection values() { + return values(RecommendedActionCurrentState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionErrorInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionErrorInfo.java new file mode 100644 index 0000000000000..b96a6c2b2915e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionErrorInfo.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.fasterxml.jackson.annotation.JsonProperty; + +/** Contains error information for an Azure SQL Database, Server or Elastic Pool Recommended Action. */ +@Immutable +public final class RecommendedActionErrorInfo { + /* + * Gets the reason why the recommended action was put to error state. e.g., + * DatabaseHasQdsOff, IndexAlreadyExists + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private String errorCode; + + /* + * Gets whether the error could be ignored and recommended action could be + * retried. Possible values are: Yes/No + */ + @JsonProperty(value = "isRetryable", access = JsonProperty.Access.WRITE_ONLY) + private IsRetryable isRetryable; + + /** + * Get the errorCode property: Gets the reason why the recommended action was put to error state. e.g., + * DatabaseHasQdsOff, IndexAlreadyExists. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Get the isRetryable property: Gets whether the error could be ignored and recommended action could be retried. + * Possible values are: Yes/No. + * + * @return the isRetryable value. + */ + public IsRetryable isRetryable() { + return this.isRetryable; + } + + /** + * 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/RecommendedActionImpactRecord.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionImpactRecord.java new file mode 100644 index 0000000000000..2f638eaf260f2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionImpactRecord.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.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information of estimated or observed impact on various metrics for an Azure SQL Database, Server or Elastic + * Pool Recommended Action. + */ +@Immutable +public final class RecommendedActionImpactRecord { + /* + * Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, + * NumberOfQueriesAffected. + */ + @JsonProperty(value = "dimensionName", access = JsonProperty.Access.WRITE_ONLY) + private String dimensionName; + + /* + * Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, + * NumberOfQueriesAffected. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /* + * Gets the absolute value of this dimension if applicable. e.g., Number of + * Queries affected + */ + @JsonProperty(value = "absoluteValue", access = JsonProperty.Access.WRITE_ONLY) + private Double absoluteValue; + + /* + * Gets the absolute change in the value of this dimension. e.g., Absolute + * Disk space change in Megabytes + */ + @JsonProperty(value = "changeValueAbsolute", access = JsonProperty.Access.WRITE_ONLY) + private Double changeValueAbsolute; + + /* + * Gets the relative change in the value of this dimension. e.g., Relative + * Disk space change in Percentage + */ + @JsonProperty(value = "changeValueRelative", access = JsonProperty.Access.WRITE_ONLY) + private Double changeValueRelative; + + /** + * Get the dimensionName property: Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, + * NumberOfQueriesAffected. + * + * @return the dimensionName value. + */ + public String dimensionName() { + return this.dimensionName; + } + + /** + * Get the unit property: Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, + * NumberOfQueriesAffected. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the absoluteValue property: Gets the absolute value of this dimension if applicable. e.g., Number of Queries + * affected. + * + * @return the absoluteValue value. + */ + public Double absoluteValue() { + return this.absoluteValue; + } + + /** + * Get the changeValueAbsolute property: Gets the absolute change in the value of this dimension. e.g., Absolute + * Disk space change in Megabytes. + * + * @return the changeValueAbsolute value. + */ + public Double changeValueAbsolute() { + return this.changeValueAbsolute; + } + + /** + * Get the changeValueRelative property: Gets the relative change in the value of this dimension. e.g., Relative + * Disk space change in Percentage. + * + * @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/RecommendedActionImplementationInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionImplementationInfo.java new file mode 100644 index 0000000000000..e2aea17f1f122 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionImplementationInfo.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information for manual implementation for an Azure SQL Database, Server or Elastic Pool Recommended Action. + */ +@Immutable +public final class RecommendedActionImplementationInfo { + /* + * Gets the method in which this recommended action can be manually + * implemented. e.g., TSql, AzurePowerShell. + */ + @JsonProperty(value = "method", access = JsonProperty.Access.WRITE_ONLY) + private ImplementationMethod method; + + /* + * Gets the manual implementation script. e.g., T-SQL script that could be + * executed on the database. + */ + @JsonProperty(value = "script", access = JsonProperty.Access.WRITE_ONLY) + private String script; + + /** + * Get the method property: Gets the method in which this recommended action can be manually implemented. e.g., + * TSql, AzurePowerShell. + * + * @return the method value. + */ + public ImplementationMethod method() { + return this.method; + } + + /** + * Get the script property: Gets the manual implementation script. e.g., T-SQL script that could be executed on the + * database. + * + * @return the script value. + */ + public String script() { + return this.script; + } + + /** + * 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/RecommendedActionInitiatedBy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionInitiatedBy.java new file mode 100644 index 0000000000000..aad9e4add63e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionInitiatedBy.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 RecommendedActionInitiatedBy. */ +public enum RecommendedActionInitiatedBy { + /** Enum value User. */ + USER("User"), + + /** Enum value System. */ + SYSTEM("System"); + + /** The actual serialized value for a RecommendedActionInitiatedBy instance. */ + private final String value; + + RecommendedActionInitiatedBy(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedActionInitiatedBy instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedActionInitiatedBy object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedActionInitiatedBy fromString(String value) { + RecommendedActionInitiatedBy[] items = RecommendedActionInitiatedBy.values(); + for (RecommendedActionInitiatedBy 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/RecommendedActionMetricInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionMetricInfo.java new file mode 100644 index 0000000000000..5b6e51fde1488 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionMetricInfo.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** + * Contains time series of various impacted metrics for an Azure SQL Database, Server or Elastic Pool Recommended + * Action. + */ +@Immutable +public final class RecommendedActionMetricInfo { + /* + * Gets the name of the metric. e.g., CPU, Number of Queries. + */ + @JsonProperty(value = "metricName", access = JsonProperty.Access.WRITE_ONLY) + private String metricName; + + /* + * Gets the unit in which metric is measured. e.g., DTU, Frequency + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /* + * Gets the duration of time interval for the value given by this + * MetricInfo. e.g., PT1H (1 hour) + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /* + * Gets the start time of time interval given by this MetricInfo. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * Gets the value of the metric in the time interval given by this + * MetricInfo. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Double value; + + /** + * Get the metricName property: Gets the name of the metric. e.g., CPU, Number of Queries. + * + * @return the metricName value. + */ + public String metricName() { + return this.metricName; + } + + /** + * Get the unit property: Gets the unit in which metric is measured. e.g., DTU, Frequency. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the timeGrain property: Gets the duration of time interval for the value given by this MetricInfo. e.g., PT1H + * (1 hour). + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the startTime property: Gets the start time of time interval given by this MetricInfo. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the value property: Gets the value of the metric in the time interval given by this MetricInfo. + * + * @return the value value. + */ + public Double value() { + return this.value; + } + + /** + * 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/RecommendedActionStateInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionStateInfo.java new file mode 100644 index 0000000000000..a476a2c04134d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionStateInfo.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Contains information of current state for an Azure SQL Database, Server or Elastic Pool Recommended Action. */ +@Fluent +public final class RecommendedActionStateInfo { + /* + * Current state the recommended action is in. Some commonly used states + * are: Active -> recommended action is active and no action has been + * taken yet. Pending -> recommended action is approved for and is + * awaiting execution. Executing -> recommended action is being applied + * on the user database. Verifying -> recommended action was applied and + * is being verified of its usefulness by the system. Success -> + * recommended action was applied and improvement found during + * verification. Pending Revert -> verification found little or no + * improvement so recommended action is queued for revert or user has + * manually reverted. Reverting -> changes made while applying + * recommended action are being reverted on the user database. Reverted + * -> successfully reverted the changes made by recommended action on user + * database. Ignored -> user explicitly ignored/discarded the + * recommended action. + */ + @JsonProperty(value = "currentValue", required = true) + private RecommendedActionCurrentState currentValue; + + /* + * Gets who initiated the execution of this recommended action. Possible + * Value are: User -> When user explicity notified system to apply the + * recommended action. System -> When auto-execute status of this advisor + * was set to 'Enabled', in which case the system applied it. + */ + @JsonProperty(value = "actionInitiatedBy", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedActionInitiatedBy actionInitiatedBy; + + /* + * Gets the time when the state was last modified + */ + @JsonProperty(value = "lastModified", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastModified; + + /** + * Get the currentValue property: Current state the recommended action is in. Some commonly used states are: Active + * -> recommended action is active and no action has been taken yet. Pending -> recommended action is approved + * for and is awaiting execution. Executing -> recommended action is being applied on the user database. + * Verifying -> recommended action was applied and is being verified of its usefulness by the system. Success + * -> recommended action was applied and improvement found during verification. Pending Revert -> verification + * found little or no improvement so recommended action is queued for revert or user has manually reverted. + * Reverting -> changes made while applying recommended action are being reverted on the user database. Reverted + * -> successfully reverted the changes made by recommended action on user database. Ignored -> user + * explicitly ignored/discarded the recommended action. + * + * @return the currentValue value. + */ + public RecommendedActionCurrentState currentValue() { + return this.currentValue; + } + + /** + * Set the currentValue property: Current state the recommended action is in. Some commonly used states are: Active + * -> recommended action is active and no action has been taken yet. Pending -> recommended action is approved + * for and is awaiting execution. Executing -> recommended action is being applied on the user database. + * Verifying -> recommended action was applied and is being verified of its usefulness by the system. Success + * -> recommended action was applied and improvement found during verification. Pending Revert -> verification + * found little or no improvement so recommended action is queued for revert or user has manually reverted. + * Reverting -> changes made while applying recommended action are being reverted on the user database. Reverted + * -> successfully reverted the changes made by recommended action on user database. Ignored -> user + * explicitly ignored/discarded the recommended action. + * + * @param currentValue the currentValue value to set. + * @return the RecommendedActionStateInfo object itself. + */ + public RecommendedActionStateInfo withCurrentValue(RecommendedActionCurrentState currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * Get the actionInitiatedBy property: Gets who initiated the execution of this recommended action. Possible Value + * are: User -> When user explicity notified system to apply the recommended action. System -> When + * auto-execute status of this advisor was set to 'Enabled', in which case the system applied it. + * + * @return the actionInitiatedBy value. + */ + public RecommendedActionInitiatedBy actionInitiatedBy() { + return this.actionInitiatedBy; + } + + /** + * Get the lastModified property: Gets the time when the state was last modified. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + return this.lastModified; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (currentValue() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property currentValue in model RecommendedActionStateInfo")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RecommendedActionStateInfo.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdate.java new file mode 100644 index 0000000000000..b268311b6b1fb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdate.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.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedSensitivityLabelUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A recommended sensitivity label update operation. */ +@Fluent +public final class RecommendedSensitivityLabelUpdate extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private RecommendedSensitivityLabelUpdateProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private RecommendedSensitivityLabelUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the op property: The op property. + * + * @return the op value. + */ + public RecommendedSensitivityLabelUpdateKind op() { + return this.innerProperties() == null ? null : this.innerProperties().op(); + } + + /** + * Set the op property: The op property. + * + * @param op the op value to set. + * @return the RecommendedSensitivityLabelUpdate object itself. + */ + public RecommendedSensitivityLabelUpdate withOp(RecommendedSensitivityLabelUpdateKind op) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendedSensitivityLabelUpdateProperties(); + } + this.innerProperties().withOp(op); + return this; + } + + /** + * Get the schema property: Schema name of the column to update. + * + * @return the schema value. + */ + public String schema() { + return this.innerProperties() == null ? null : this.innerProperties().schema(); + } + + /** + * Set the schema property: Schema name of the column to update. + * + * @param schema the schema value to set. + * @return the RecommendedSensitivityLabelUpdate object itself. + */ + public RecommendedSensitivityLabelUpdate withSchema(String schema) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendedSensitivityLabelUpdateProperties(); + } + this.innerProperties().withSchema(schema); + return this; + } + + /** + * Get the table property: Table name of the column to update. + * + * @return the table value. + */ + public String table() { + return this.innerProperties() == null ? null : this.innerProperties().table(); + } + + /** + * Set the table property: Table name of the column to update. + * + * @param table the table value to set. + * @return the RecommendedSensitivityLabelUpdate object itself. + */ + public RecommendedSensitivityLabelUpdate withTable(String table) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendedSensitivityLabelUpdateProperties(); + } + this.innerProperties().withTable(table); + return this; + } + + /** + * Get the column property: Column name to update. + * + * @return the column value. + */ + public String column() { + return this.innerProperties() == null ? null : this.innerProperties().column(); + } + + /** + * Set the column property: Column name to update. + * + * @param column the column value to set. + * @return the RecommendedSensitivityLabelUpdate object itself. + */ + public RecommendedSensitivityLabelUpdate withColumn(String column) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendedSensitivityLabelUpdateProperties(); + } + this.innerProperties().withColumn(column); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdateKind.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdateKind.java new file mode 100644 index 0000000000000..3002ed26015fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdateKind.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 RecommendedSensitivityLabelUpdateKind. */ +public enum RecommendedSensitivityLabelUpdateKind { + /** Enum value enable. */ + ENABLE("enable"), + + /** Enum value disable. */ + DISABLE("disable"); + + /** The actual serialized value for a RecommendedSensitivityLabelUpdateKind instance. */ + private final String value; + + RecommendedSensitivityLabelUpdateKind(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedSensitivityLabelUpdateKind instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedSensitivityLabelUpdateKind object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedSensitivityLabelUpdateKind fromString(String value) { + RecommendedSensitivityLabelUpdateKind[] items = RecommendedSensitivityLabelUpdateKind.values(); + for (RecommendedSensitivityLabelUpdateKind 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/RecommendedSensitivityLabelUpdateList.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdateList.java new file mode 100644 index 0000000000000..f14f320be187d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdateList.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.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of recommended sensitivity label update operations. */ +@Fluent +public final class RecommendedSensitivityLabelUpdateList { + /* + * The operations property. + */ + @JsonProperty(value = "operations") + private List operations; + + /** + * Get the operations property: The operations property. + * + * @return the operations value. + */ + public List operations() { + return this.operations; + } + + /** + * Set the operations property: The operations property. + * + * @param operations the operations value to set. + * @return the RecommendedSensitivityLabelUpdateList object itself. + */ + public RecommendedSensitivityLabelUpdateList withOperations(List operations) { + this.operations = operations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operations() != null) { + operations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabels.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabels.java new file mode 100644 index 0000000000000..bdd25d5a8ef54 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabels.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.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RecommendedSensitivityLabels. */ +public interface RecommendedSensitivityLabels { + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 update( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters); + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update 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 the {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context); +} 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..aae2bd2418018 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabaseListResult.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.RecoverableDatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list recoverable databases request. */ +@Fluent +public final class RecoverableDatabaseListResult { + /* + * 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()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RecoverableDatabaseListResult.class); +} 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..800b1eaaee2db --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabases.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.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 along with {@link + * Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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..83ad80a2f3475 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabaseListResult.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.resourcemanager.sql.generated.fluent.models.RecoverableManagedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of recoverable managed databases. */ +@Immutable +public final class RecoverableManagedDatabaseListResult { + /* + * 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..c66337d093d98 --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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..6aebedb59a3cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLink.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.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 partnerServer property: Resource partner server. + * + * @return the partnerServer value. + */ + String partnerServer(); + + /** + * Gets the partnerDatabase property: Resource partner database. + * + * @return the partnerDatabase value. + */ + String partnerDatabase(); + + /** + * Gets the partnerLocation property: Resource partner location. + * + * @return the partnerLocation value. + */ + String partnerLocation(); + + /** + * Gets the role property: Local replication role. + * + * @return the role value. + */ + ReplicationRole role(); + + /** + * Gets the partnerRole property: Partner replication role. + * + * @return the partnerRole value. + */ + ReplicationRole partnerRole(); + + /** + * Gets the replicationMode property: Replication mode. + * + * @return the replicationMode value. + */ + String replicationMode(); + + /** + * Gets the startTime property: Time at which the link was created. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the percentComplete property: Seeding completion percentage for the link. + * + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * Gets the replicationState property: Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). + * + * @return the replicationState value. + */ + ReplicationState replicationState(); + + /** + * Gets the isTerminationAllowed property: Whether the user is currently allowed to terminate the link. + * + * @return the isTerminationAllowed value. + */ + Boolean isTerminationAllowed(); + + /** + * Gets the linkType property: Link type (GEO, NAMED). + * + * @return the linkType value. + */ + ReplicationLinkType linkType(); + + /** + * 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..3add5e855f9bd --- /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.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of replication links. */ +@Immutable +public final class ReplicationLinkListResult { + /* + * 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/ReplicationLinkType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinkType.java new file mode 100644 index 0000000000000..992445ae8e193 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinkType.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 ReplicationLinkType. */ +public final class ReplicationLinkType extends ExpandableStringEnum { + /** Static value GEO for ReplicationLinkType. */ + public static final ReplicationLinkType GEO = fromString("GEO"); + + /** Static value NAMED for ReplicationLinkType. */ + public static final ReplicationLinkType NAMED = fromString("NAMED"); + + /** + * Creates or finds a ReplicationLinkType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReplicationLinkType. + */ + @JsonCreator + public static ReplicationLinkType fromString(String name) { + return fromString(name, ReplicationLinkType.class); + } + + /** @return known ReplicationLinkType values. */ + public static Collection values() { + return values(ReplicationLinkType.class); + } +} 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..fa3753ed28306 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinks.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.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 {@link Response}. + */ + Response deleteWithResponse( + 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); + + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 replication links on database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 replication links on database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a 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. + * @param linkId The name of the 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 a replication link. + */ + ReplicationLink get(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Gets a 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. + * @param linkId The name of the 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 a replication link along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Gets a list of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedIterable}. + */ + 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/ReplicationMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationMode.java new file mode 100644 index 0000000000000..20e9551acad72 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationMode.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 ReplicationMode. */ +public final class ReplicationMode extends ExpandableStringEnum { + /** Static value Async for ReplicationMode. */ + public static final ReplicationMode ASYNC = fromString("Async"); + + /** Static value Sync for ReplicationMode. */ + public static final ReplicationMode SYNC = fromString("Sync"); + + /** + * Creates or finds a ReplicationMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReplicationMode. + */ + @JsonCreator + public static ReplicationMode fromString(String name) { + return fromString(name, ReplicationMode.class); + } + + /** @return known ReplicationMode values. */ + public static Collection values() { + return values(ReplicationMode.class); + } +} 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/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..d33d27cc8ac1c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceIdentity.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Azure Active Directory identity configuration for a resource. */ +@Fluent +public class ResourceIdentity { + /* + * The resource ids of the user assigned identities to use + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /* + * 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 userAssignedIdentities property: The resource ids of the user assigned identities to use. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The resource ids of the user assigned identities to use. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ResourceIdentity object itself. + */ + public ResourceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * 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() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .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/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..796c90043cf72 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceMoveDefinition.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.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform a resource move (rename). */ +@Fluent +public final class ResourceMoveDefinition { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceMoveDefinition.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceWithWritableName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceWithWritableName.java new file mode 100644 index 0000000000000..10f23e83e44e1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceWithWritableName.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.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** ARM resource. */ +@Fluent +public class ResourceWithWritableName extends ProxyResource { + /* + * Resource name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name property: Resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Resource name. + * + * @param name the name value to set. + * @return the ResourceWithWritableName object itself. + */ + public ResourceWithWritableName withName(String name) { + this.name = name; + 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/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..16f73abf07659 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabase.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.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** 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 sku property: The name and tier of the SKU. + * + * @return the sku value. + */ + Sku sku(); + + /** + * 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 databaseName property: The name of the database. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @return the maxSizeBytes value. + */ + Long maxSizeBytes(); + + /** + * 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 backupStorageRedundancy property: The storage account type used to store backups for this database. + * + * @return the backupStorageRedundancy value. + */ + BackupStorageRedundancy backupStorageRedundancy(); + + /** + * 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..aa5a341accc8a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabaseListResult.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.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of restorable dropped databases. */ +@Immutable +public final class RestorableDroppedDatabaseListResult { + /* + * 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/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..b57c0150b3702 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabases.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 RestorableDroppedDatabases. */ +public interface RestorableDroppedDatabases { + /** + * Gets a list of restorable dropped 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 restorable dropped databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of restorable dropped 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 restorable dropped databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @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 database. + */ + RestorableDroppedDatabase get(String resourceGroupName, String serverName, String restorableDroppedDatabaseId); + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @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 database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId, 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..4306fc6cad015 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabaseListResult.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.resourcemanager.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of restorable dropped managed databases. */ +@Immutable +public final class RestorableDroppedManagedDatabaseListResult { + /* + * 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..4bdfaf58279c5 --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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..af1da8a052279 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointListResult.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.resourcemanager.sql.generated.fluent.models.RestorePointInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention backups. */ +@Immutable +public final class RestorePointListResult { + /* + * 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..40a44e1815e22 --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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/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..aecf52b50fb1e --- /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/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/SecurityAlertsPolicyState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertsPolicyState.java new file mode 100644 index 0000000000000..1847d74ad6eb4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertsPolicyState.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 SecurityAlertsPolicyState. */ +public enum SecurityAlertsPolicyState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SecurityAlertsPolicyState instance. */ + private final String value; + + SecurityAlertsPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityAlertsPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityAlertsPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static SecurityAlertsPolicyState fromString(String value) { + SecurityAlertsPolicyState[] items = SecurityAlertsPolicyState.values(); + for (SecurityAlertsPolicyState 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/SecurityEvent.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEvent.java new file mode 100644 index 0000000000000..beef7616ba444 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEvent.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.resourcemanager.sql.generated.fluent.models.SecurityEventInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of SecurityEvent. */ +public interface SecurityEvent { + /** + * 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 eventTime property: The time when the security event occurred. + * + * @return the eventTime value. + */ + OffsetDateTime eventTime(); + + /** + * Gets the securityEventType property: The type of the security event. + * + * @return the securityEventType value. + */ + SecurityEventType securityEventType(); + + /** + * Gets the subscription property: The subscription name. + * + * @return the subscription value. + */ + String subscription(); + + /** + * Gets the server property: The server name. + * + * @return the server value. + */ + String server(); + + /** + * Gets the database property: The database name. + * + * @return the database value. + */ + String database(); + + /** + * Gets the clientIp property: The IP address of the client who executed the statement. + * + * @return the clientIp value. + */ + String clientIp(); + + /** + * Gets the applicationName property: The application used to execute the statement. + * + * @return the applicationName value. + */ + String applicationName(); + + /** + * Gets the principalName property: The principal user who executed the statement. + * + * @return the principalName value. + */ + String principalName(); + + /** + * Gets the securityEventSqlInjectionAdditionalProperties property: The sql injection additional properties, + * populated only if the type of the security event is sql injection. + * + * @return the securityEventSqlInjectionAdditionalProperties value. + */ + SecurityEventSqlInjectionAdditionalProperties securityEventSqlInjectionAdditionalProperties(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SecurityEventInner object. + * + * @return the inner object. + */ + SecurityEventInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventCollection.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventCollection.java new file mode 100644 index 0000000000000..8a08c6e5a095f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventCollection.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.resourcemanager.sql.generated.fluent.models.SecurityEventInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of security events. */ +@Immutable +public final class SecurityEventCollection { + /* + * 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/SecurityEventSqlInjectionAdditionalProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventSqlInjectionAdditionalProperties.java new file mode 100644 index 0000000000000..ff47d5d41b5b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventSqlInjectionAdditionalProperties.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.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a security event sql injection additional properties. */ +@Immutable +public final class SecurityEventSqlInjectionAdditionalProperties { + /* + * The threat ID. + */ + @JsonProperty(value = "threatId", access = JsonProperty.Access.WRITE_ONLY) + private String threatId; + + /* + * The statement + */ + @JsonProperty(value = "statement", access = JsonProperty.Access.WRITE_ONLY) + private String statement; + + /* + * The statement highlight offset + */ + @JsonProperty(value = "statementHighlightOffset", access = JsonProperty.Access.WRITE_ONLY) + private Integer statementHighlightOffset; + + /* + * The statement highlight length + */ + @JsonProperty(value = "statementHighlightLength", access = JsonProperty.Access.WRITE_ONLY) + private Integer statementHighlightLength; + + /* + * The sql error code + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The sql error severity + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * The sql error message + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * Get the threatId property: The threat ID. + * + * @return the threatId value. + */ + public String threatId() { + return this.threatId; + } + + /** + * Get the statement property: The statement. + * + * @return the statement value. + */ + public String statement() { + return this.statement; + } + + /** + * Get the statementHighlightOffset property: The statement highlight offset. + * + * @return the statementHighlightOffset value. + */ + public Integer statementHighlightOffset() { + return this.statementHighlightOffset; + } + + /** + * Get the statementHighlightLength property: The statement highlight length. + * + * @return the statementHighlightLength value. + */ + public Integer statementHighlightLength() { + return this.statementHighlightLength; + } + + /** + * Get the errorCode property: The sql error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the errorSeverity property: The sql error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the errorMessage property: The sql error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * 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/SecurityEventType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventType.java new file mode 100644 index 0000000000000..f0757d039773c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventType.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 SecurityEventType. */ +public enum SecurityEventType { + /** Enum value Undefined. */ + UNDEFINED("Undefined"), + + /** Enum value SqlInjectionVulnerability. */ + SQL_INJECTION_VULNERABILITY("SqlInjectionVulnerability"), + + /** Enum value SqlInjectionExploit. */ + SQL_INJECTION_EXPLOIT("SqlInjectionExploit"); + + /** The actual serialized value for a SecurityEventType instance. */ + private final String value; + + SecurityEventType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityEventType instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityEventType object, or null if unable to parse. + */ + @JsonCreator + public static SecurityEventType fromString(String value) { + SecurityEventType[] items = SecurityEventType.values(); + for (SecurityEventType 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..6896f7b8bec65 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabel.java @@ -0,0 +1,338 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.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 managedBy property: Resource that manages the sensitivity label. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the schemaName property: The schema name. + * + * @return the schemaName value. + */ + String schemaName(); + + /** + * Gets the tableName property: The table name. + * + * @return the tableName value. + */ + String tableName(); + + /** + * Gets the columnName property: The column name. + * + * @return the columnName value. + */ + String columnName(); + + /** + * 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, managedInstanceName, 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 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. + * @return the next definition stage. + */ + WithCreate withExistingColumn( + String resourceGroupName, + String managedInstanceName, + 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); + } + } + /** + * Disables sensitivity recommendations on a given column. + * + * @throws com.azure.core.management.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(); + + /** + * Disables sensitivity recommendations on a given 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 {@link Response}. + */ + Response disableRecommendationWithResponse(Context context); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @throws com.azure.core.management.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(); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response enableRecommendationWithResponse(Context context); +} 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..697810dfc62c7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelListResult.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.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sensitivity labels. */ +@Immutable +public final class SensitivityLabelListResult { + /* + * 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/SensitivityLabelUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdate.java new file mode 100644 index 0000000000000..514d6e5eb776d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdate.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.SensitivityLabelUpdateInner; + +/** An immutable client-side representation of SensitivityLabelUpdate. */ +public interface SensitivityLabelUpdate { + /** + * 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 op property: The op property. + * + * @return the op value. + */ + SensitivityLabelUpdateKind op(); + + /** + * Gets the schema property: Schema name of the column to update. + * + * @return the schema value. + */ + String schema(); + + /** + * Gets the table property: Table name of the column to update. + * + * @return the table value. + */ + String table(); + + /** + * Gets the column property: Column name to update. + * + * @return the column value. + */ + String column(); + + /** + * Gets the sensitivityLabel property: The sensitivity label information to apply on a column. + * + * @return the sensitivityLabel value. + */ + SensitivityLabel sensitivityLabel(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner object. + * + * @return the inner object. + */ + SensitivityLabelUpdateInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateKind.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateKind.java new file mode 100644 index 0000000000000..369a5c87b5b42 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateKind.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 SensitivityLabelUpdateKind. */ +public enum SensitivityLabelUpdateKind { + /** Enum value set. */ + SET("set"), + + /** Enum value remove. */ + REMOVE("remove"); + + /** The actual serialized value for a SensitivityLabelUpdateKind instance. */ + private final String value; + + SensitivityLabelUpdateKind(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SensitivityLabelUpdateKind instance. + * + * @param value the serialized value to parse. + * @return the parsed SensitivityLabelUpdateKind object, or null if unable to parse. + */ + @JsonCreator + public static SensitivityLabelUpdateKind fromString(String value) { + SensitivityLabelUpdateKind[] items = SensitivityLabelUpdateKind.values(); + for (SensitivityLabelUpdateKind 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/SensitivityLabelUpdateList.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateList.java new file mode 100644 index 0000000000000..d16aff9fff299 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateList.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.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sensitivity label update operations. */ +@Fluent +public final class SensitivityLabelUpdateList { + /* + * The operations property. + */ + @JsonProperty(value = "operations") + private List operations; + + /** + * Get the operations property: The operations property. + * + * @return the operations value. + */ + public List operations() { + return this.operations; + } + + /** + * Set the operations property: The operations property. + * + * @param operations the operations value to set. + * @return the SensitivityLabelUpdateList object itself. + */ + public SensitivityLabelUpdateList withOperations(List operations) { + this.operations = operations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operations() != null) { + operations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateProperties.java new file mode 100644 index 0000000000000..3e37925f6110e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateProperties.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.SensitivityLabelUpdatePropertiesInner; + +/** An immutable client-side representation of SensitivityLabelUpdateProperties. */ +public interface SensitivityLabelUpdateProperties { + /** + * Gets the op property: The op property. + * + * @return the op value. + */ + SensitivityLabelUpdateKind op(); + + /** + * Gets the schema property: Schema name of the column to update. + * + * @return the schema value. + */ + String schema(); + + /** + * Gets the table property: Table name of the column to update. + * + * @return the table value. + */ + String table(); + + /** + * Gets the column property: Column name to update. + * + * @return the column value. + */ + String column(); + + /** + * Gets the sensitivityLabel property: The sensitivity label information to apply on a column. + * + * @return the sensitivityLabel value. + */ + SensitivityLabel sensitivityLabel(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdatePropertiesInner + * object. + * + * @return the inner object. + */ + SensitivityLabelUpdatePropertiesInner innerModel(); +} 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..e0774c1f908d1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabels.java @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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 as paginated response with {@link PagedIterable}. + */ + 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 skipToken The skipToken parameter. + * @param count The count 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable listCurrentByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 update( + String resourceGroupName, String serverName, String databaseName, SensitivityLabelUpdateList parameters); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update 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 the {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SensitivityLabelUpdateList parameters, + 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 as paginated response with {@link PagedIterable}. + */ + 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 skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @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 as paginated response with {@link PagedIterable}. + */ + PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + 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 {@link 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 {@link 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 along with {@link Response}. + */ + 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. + */ + SensitivityLabel 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 along with {@link Response}. + */ + 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. + */ + 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 {@link Response}. + */ + 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/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..8e623aa14d61e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Server.java @@ -0,0 +1,569 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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; +import java.util.UUID; + +/** 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. + */ + ServerNetworkAccessFlag publicNetworkAccess(); + + /** + * Gets the workspaceFeature property: Whether or not existing server has a workspace created and if it allows + * connection from workspace. + * + * @return the workspaceFeature value. + */ + ServerWorkspaceFeature workspaceFeature(); + + /** + * Gets the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + String primaryUserAssignedIdentityId(); + + /** + * Gets the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @return the federatedClientId value. + */ + UUID federatedClientId(); + + /** + * Gets the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + String keyId(); + + /** + * Gets the administrators property: The Azure Active Directory identity of the server. + * + * @return the administrators value. + */ + ServerExternalAdministrator administrators(); + + /** + * Gets the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the restrictOutboundNetworkAccess value. + */ + ServerNetworkAccessFlag restrictOutboundNetworkAccess(); + + /** + * 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, + DefinitionStages.WithPrimaryUserAssignedIdentityId, + DefinitionStages.WithFederatedClientId, + DefinitionStages.WithKeyId, + DefinitionStages.WithAdministrators, + DefinitionStages.WithRestrictOutboundNetworkAccess { + /** + * 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(ServerNetworkAccessFlag publicNetworkAccess); + } + /** The stage of the Server definition allowing to specify primaryUserAssignedIdentityId. */ + interface WithPrimaryUserAssignedIdentityId { + /** + * Specifies the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be + * used by default.. + * + * @param primaryUserAssignedIdentityId The resource id of a user assigned identity to be used by default. + * @return the next definition stage. + */ + WithCreate withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId); + } + /** The stage of the Server definition allowing to specify federatedClientId. */ + interface WithFederatedClientId { + /** + * Specifies the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @param federatedClientId The Client id used for cross tenant CMK scenario. + * @return the next definition stage. + */ + WithCreate withFederatedClientId(UUID federatedClientId); + } + /** The stage of the Server definition allowing to specify keyId. */ + interface WithKeyId { + /** + * Specifies the keyId property: A CMK URI of the key to use for encryption.. + * + * @param keyId A CMK URI of the key to use for encryption. + * @return the next definition stage. + */ + WithCreate withKeyId(String keyId); + } + /** The stage of the Server definition allowing to specify administrators. */ + interface WithAdministrators { + /** + * Specifies the administrators property: The Azure Active Directory identity of the server.. + * + * @param administrators The Azure Active Directory identity of the server. + * @return the next definition stage. + */ + WithCreate withAdministrators(ServerExternalAdministrator administrators); + } + /** The stage of the Server definition allowing to specify restrictOutboundNetworkAccess. */ + interface WithRestrictOutboundNetworkAccess { + /** + * Specifies the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access + * for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param restrictOutboundNetworkAccess Whether or not to restrict outbound network access for this server. + * Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * @return the next definition stage. + */ + WithCreate withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag restrictOutboundNetworkAccess); + } + } + /** + * 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.WithIdentity, + UpdateStages.WithAdministratorLoginPassword, + UpdateStages.WithVersion, + UpdateStages.WithMinimalTlsVersion, + UpdateStages.WithPublicNetworkAccess, + UpdateStages.WithPrimaryUserAssignedIdentityId, + UpdateStages.WithFederatedClientId, + UpdateStages.WithKeyId, + UpdateStages.WithRestrictOutboundNetworkAccess { + /** + * 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 identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Server identity. + * + * @param identity Server identity. + * @return the next definition stage. + */ + Update withIdentity(ResourceIdentity identity); + } + /** 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(ServerNetworkAccessFlag publicNetworkAccess); + } + /** The stage of the Server update allowing to specify primaryUserAssignedIdentityId. */ + interface WithPrimaryUserAssignedIdentityId { + /** + * Specifies the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be + * used by default.. + * + * @param primaryUserAssignedIdentityId The resource id of a user assigned identity to be used by default. + * @return the next definition stage. + */ + Update withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId); + } + /** The stage of the Server update allowing to specify federatedClientId. */ + interface WithFederatedClientId { + /** + * Specifies the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @param federatedClientId The Client id used for cross tenant CMK scenario. + * @return the next definition stage. + */ + Update withFederatedClientId(UUID federatedClientId); + } + /** The stage of the Server update allowing to specify keyId. */ + interface WithKeyId { + /** + * Specifies the keyId property: A CMK URI of the key to use for encryption.. + * + * @param keyId A CMK URI of the key to use for encryption. + * @return the next definition stage. + */ + Update withKeyId(String keyId); + } + /** The stage of the Server update allowing to specify restrictOutboundNetworkAccess. */ + interface WithRestrictOutboundNetworkAccess { + /** + * Specifies the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access + * for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param restrictOutboundNetworkAccess Whether or not to restrict outbound network access for this server. + * Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * @return the next definition stage. + */ + Update withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag restrictOutboundNetworkAccess); + } + } + /** + * 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); + + /** + * Imports a bacpac into a new 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 importDatabase(ImportNewDatabaseDefinition parameters); + + /** + * Imports a bacpac into a new 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 importDatabase(ImportNewDatabaseDefinition parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvisors.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvisors.java new file mode 100644 index 0000000000000..7c13e9021ff1d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvisors.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.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import java.util.List; + +/** Resource collection API of ServerAdvisors. */ +public interface ServerAdvisors { + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The name of the resource group that 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 advisors. + */ + List listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of server advisors. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors along with {@link Response}. + */ + Response> listByServerWithResponse( + String resourceGroupName, String serverName, String expand, Context context); + + /** + * Gets a server 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 advisorName The name of the Server 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 server advisor. + */ + Advisor get(String resourceGroupName, String serverName, String advisorName); + + /** + * Gets a server 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 advisorName The name of the Server 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 server advisor along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String serverName, String advisorName, Context context); + + /** + * Updates a server 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 advisorName The name of the Server Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor. + */ + Advisor update(String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters); + + /** + * Updates a server 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 advisorName The name of the Server Advisor. + * @param parameters The requested advisor 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, Server or Elastic Pool Advisor along with {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters, 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..649a57c1ff6ae --- /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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..9588a9c07fa26 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrators.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 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 along with {@link Response}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..5aca7ec900f20 --- /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..16da2fee54cb7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentications.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 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 along with {@link Response}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..6ae001fc70bfb --- /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 { + /** + * 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, 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 com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + */ + Response getWithResponse(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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..f95cdd03b5aba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicy.java @@ -0,0 +1,808 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs + * will be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be 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 isDevopsAuditEnabled value. + */ + Boolean isDevopsAuditEnabled(); + + /** + * 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 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 isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + Boolean isManagedIdentityInUse(); + + /** + * 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.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.WithIsDevopsAuditEnabled, + DefinitionStages.WithRetentionDays, + DefinitionStages.WithAuditActionsAndGroups, + DefinitionStages.WithIsStorageSecondaryKeyInUse, + DefinitionStages.WithIsAzureMonitorTargetEnabled, + DefinitionStages.WithQueueDelayMs, + DefinitionStages.WithIsManagedIdentityInUse, + DefinitionStages.WithState, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithStorageAccountSubscriptionId { + /** + * 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 isDevopsAuditEnabled. */ + interface WithIsDevopsAuditEnabled { + /** + * Specifies the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, + * devops logs will be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' + * as 'Enabled', 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should also be 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 isDevopsAuditEnabled Specifies the state of devops audit. If state is Enabled, devops logs will be + * sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should also be 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 withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled); + } + /** 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + WithCreate withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the ServerBlobAuditingPolicy 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 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 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 ServerBlobAuditingPolicy resource. + * + * @return the stage of resource update. + */ + ServerBlobAuditingPolicy.Update update(); + + /** The template for ServerBlobAuditingPolicy update. */ + interface Update + extends UpdateStages.WithIsDevopsAuditEnabled, + UpdateStages.WithRetentionDays, + UpdateStages.WithAuditActionsAndGroups, + UpdateStages.WithIsStorageSecondaryKeyInUse, + UpdateStages.WithIsAzureMonitorTargetEnabled, + UpdateStages.WithQueueDelayMs, + UpdateStages.WithIsManagedIdentityInUse, + UpdateStages.WithState, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithStorageAccountSubscriptionId { + /** + * 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 isDevopsAuditEnabled. */ + interface WithIsDevopsAuditEnabled { + /** + * Specifies the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, + * devops logs will be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' + * as 'Enabled', 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should also be 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 isDevopsAuditEnabled Specifies the state of devops audit. If state is Enabled, devops logs will be + * sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should also be 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 withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled); + } + /** 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + Update withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the ServerBlobAuditingPolicy 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 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 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. + */ + 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..05e330b75eda6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicyListResult.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.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server auditing settings. */ +@Immutable +public final class ServerBlobAuditingPolicyListResult { + /* + * 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..4eab3644587cb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLink.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.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 { + /** + * 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 { + } + /** + * 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..39803c9833fc1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinkListResult.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.resourcemanager.sql.generated.fluent.models.ServerCommunicationLinkInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server communication links. */ +@Fluent +public final class ServerCommunicationLinkListResult { + /* + * 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..75b83ecba25a5 --- /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 {@link 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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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..c7250c1dccfd7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicies.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 ServerConnectionPolicies. */ +public interface ServerConnectionPolicies { + /** + * Gets a server 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 a server connection policy. + */ + ServerConnectionPolicy get(String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName); + + /** + * Gets a server 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 a server connection policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName, Context context); + + /** + * Lists 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 connection policy objects as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 connection policy objects as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a server 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 a server connection policy along with {@link Response}. + */ + ServerConnectionPolicy getById(String id); + + /** + * Gets a server 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 a server connection policy along with {@link Response}. + */ + 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..2a2af81b4e122 --- /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 location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the kind property: Metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * 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/ServerConnectionPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicyListResult.java new file mode 100644 index 0000000000000..b370a82d849f7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicyListResult.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.resourcemanager.sql.generated.fluent.models.ServerConnectionPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server connection policy objects. */ +@Immutable +public final class ServerConnectionPolicyListResult { + /* + * 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/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..44c07ccdd8325 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionType.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 ServerConnectionType. */ +public final class ServerConnectionType extends ExpandableStringEnum { + /** Static value Default for ServerConnectionType. */ + public static final ServerConnectionType DEFAULT = fromString("Default"); + + /** Static value Redirect for ServerConnectionType. */ + public static final ServerConnectionType REDIRECT = fromString("Redirect"); + + /** Static value Proxy for ServerConnectionType. */ + public static final ServerConnectionType PROXY = fromString("Proxy"); + + /** + * Creates or finds a ServerConnectionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerConnectionType. + */ + @JsonCreator + public static ServerConnectionType fromString(String name) { + return fromString(name, ServerConnectionType.class); + } + + /** @return known ServerConnectionType values. */ + public static Collection values() { + return values(ServerConnectionType.class); + } +} 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..f2cfdbbbac978 --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..c86725413dea5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettingsListResult.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.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server DevOps audit settings. */ +@Immutable +public final class ServerDevOpsAuditSettingsListResult { + /* + * 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..edb063e858861 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasAcquisition.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.JsonProperty; + +/** A server dns alias acquisition request. */ +@Fluent +public final class ServerDnsAliasAcquisition { + /* + * The id of the server alias that will be acquired to point to this server + * instead. + */ + @JsonProperty(value = "oldServerDnsAliasId", required = true) + 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() { + if (oldServerDnsAliasId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property oldServerDnsAliasId in model ServerDnsAliasAcquisition")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerDnsAliasAcquisition.class); +} 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..bbe2af24b9811 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasListResult.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.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server DNS aliases. */ +@Immutable +public final class ServerDnsAliasListResult { + /* + * 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..0c3136f25a0ef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliases.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 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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 a server DNS alias. + */ + ServerDnsAlias 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. + * @return a server DNS alias. + */ + ServerDnsAlias 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/ServerExternalAdministrator.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerExternalAdministrator.java new file mode 100644 index 0000000000000..6d1fc8282bbc2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerExternalAdministrator.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Properties of a active directory administrator. */ +@Fluent +public final class ServerExternalAdministrator { + /* + * Type of the sever administrator. + */ + @JsonProperty(value = "administratorType") + private AdministratorType administratorType; + + /* + * Principal Type of the sever administrator. + */ + @JsonProperty(value = "principalType") + private PrincipalType principalType; + + /* + * Login name of the server administrator. + */ + @JsonProperty(value = "login") + private String login; + + /* + * SID (object ID) of the server administrator. + */ + @JsonProperty(value = "sid") + private UUID sid; + + /* + * Tenant ID of the administrator. + */ + @JsonProperty(value = "tenantId") + private UUID tenantId; + + /* + * Azure Active Directory only Authentication enabled. + */ + @JsonProperty(value = "azureADOnlyAuthentication") + 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 ServerExternalAdministrator object itself. + */ + public ServerExternalAdministrator withAdministratorType(AdministratorType administratorType) { + this.administratorType = administratorType; + return this; + } + + /** + * Get the principalType property: Principal Type of the sever administrator. + * + * @return the principalType value. + */ + public PrincipalType principalType() { + return this.principalType; + } + + /** + * Set the principalType property: Principal Type of the sever administrator. + * + * @param principalType the principalType value to set. + * @return the ServerExternalAdministrator object itself. + */ + public ServerExternalAdministrator withPrincipalType(PrincipalType principalType) { + this.principalType = principalType; + 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 ServerExternalAdministrator object itself. + */ + public ServerExternalAdministrator 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 ServerExternalAdministrator object itself. + */ + public ServerExternalAdministrator 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 ServerExternalAdministrator object itself. + */ + public ServerExternalAdministrator 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; + } + + /** + * Set the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @param azureADOnlyAuthentication the azureADOnlyAuthentication value to set. + * @return the ServerExternalAdministrator object itself. + */ + public ServerExternalAdministrator 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/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..2c90d5c857c38 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerInfo.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.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Server info for the server trust group. */ +@Fluent +public final class ServerInfo { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerInfo.class); +} 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..7aaed7a4755e9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKey.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.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. If the ServerKeyType is AzureKeyVault, then the URI is + * required. + * + * @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 autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + Boolean autoRotationEnabled(); + + /** + * 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.WithServerKeyType, DefinitionStages.WithUri { + /** + * 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 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. If the ServerKeyType is AzureKeyVault, then the + * URI is required.. + * + * @param uri The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * @return the next definition stage. + */ + WithCreate withUri(String uri); + } + } + /** + * Begins update for the ServerKey resource. + * + * @return the stage of resource update. + */ + ServerKey.Update update(); + + /** The template for ServerKey update. */ + interface Update { + /** + * 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 { + } + /** + * 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..38ea1491cc5b4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyListResult.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.resourcemanager.sql.generated.fluent.models.ServerKeyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server keys. */ +@Immutable +public final class ServerKeyListResult { + /* + * 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..61d60cbe11c9a --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..20cb9e95b62f6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerListResult.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.resourcemanager.sql.generated.fluent.models.ServerInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of servers. */ +@Immutable +public final class ServerListResult { + /* + * 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/ServerNetworkAccessFlag.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerNetworkAccessFlag.java new file mode 100644 index 0000000000000..8125bd1d6fbb2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerNetworkAccessFlag.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 ServerNetworkAccessFlag. */ +public final class ServerNetworkAccessFlag extends ExpandableStringEnum { + /** Static value Enabled for ServerNetworkAccessFlag. */ + public static final ServerNetworkAccessFlag ENABLED = fromString("Enabled"); + + /** Static value Disabled for ServerNetworkAccessFlag. */ + public static final ServerNetworkAccessFlag DISABLED = fromString("Disabled"); + + /** + * Creates or finds a ServerNetworkAccessFlag from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerNetworkAccessFlag. + */ + @JsonCreator + public static ServerNetworkAccessFlag fromString(String name) { + return fromString(name, ServerNetworkAccessFlag.class); + } + + /** @return known ServerNetworkAccessFlag values. */ + public static Collection values() { + return values(ServerNetworkAccessFlag.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperation.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperation.java new file mode 100644 index 0000000000000..2f220f9aa4a82 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperation.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.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerOperationInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ServerOperation. */ +public interface ServerOperation { + /** + * 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 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.ServerOperationInner object. + * + * @return the inner object. + */ + ServerOperationInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperationListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperationListResult.java new file mode 100644 index 0000000000000..e32e8efab7060 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperationListResult.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.resourcemanager.sql.generated.fluent.models.ServerOperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list server operations request. */ +@Immutable +public final class ServerOperationListResult { + /* + * 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/ServerOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperations.java new file mode 100644 index 0000000000000..e80fa66133a7c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperations.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 ServerOperations. */ +public interface ServerOperations { + /** + * Gets a list of operations performed on the server. + * + * @param resourceGroupName The name of the resource group that 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 operations performed on the server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of operations performed on the server. + * + * @param resourceGroupName The name of the resource group that contains 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 operations performed on the server as paginated response with {@link PagedIterable}. + */ + 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/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..ef9974aa066f7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerPrivateEndpointConnection.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.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection under a server. */ +@Immutable +public final class ServerPrivateEndpointConnection { + /* + * 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/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..ef1dcfc10efce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicies.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 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, SecurityAlertPolicyName 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 along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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(SecurityAlertPolicyName 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..f96d6c9fa36dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicy.java @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.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 systemData property: SystemData of SecurityAlertPolicyResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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. + */ + SecurityAlertsPolicyState 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, Brute_Force. + * + * @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(SecurityAlertsPolicyState 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, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @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(SecurityAlertsPolicyState 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, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @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/ServerTrustCertificate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificate.java new file mode 100644 index 0000000000000..2e4701df39121 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificate.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.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustCertificateInner; + +/** An immutable client-side representation of ServerTrustCertificate. */ +public interface ServerTrustCertificate { + /** + * 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 publicBlob property: The certificate public blob. + * + * @return the publicBlob value. + */ + String publicBlob(); + + /** + * Gets the thumbprint property: The certificate thumbprint. + * + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * Gets the certificateName property: The certificate name. + * + * @return the certificateName value. + */ + String certificateName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustCertificateInner object. + * + * @return the inner object. + */ + ServerTrustCertificateInner innerModel(); + + /** The entirety of the ServerTrustCertificate definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerTrustCertificate definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerTrustCertificate definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerTrustCertificate 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 ServerTrustCertificate 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.WithPublicBlob { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerTrustCertificate create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerTrustCertificate create(Context context); + } + /** The stage of the ServerTrustCertificate definition allowing to specify publicBlob. */ + interface WithPublicBlob { + /** + * Specifies the publicBlob property: The certificate public blob. + * + * @param publicBlob The certificate public blob. + * @return the next definition stage. + */ + WithCreate withPublicBlob(String publicBlob); + } + } + /** + * Begins update for the ServerTrustCertificate resource. + * + * @return the stage of resource update. + */ + ServerTrustCertificate.Update update(); + + /** The template for ServerTrustCertificate update. */ + interface Update extends UpdateStages.WithPublicBlob { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerTrustCertificate apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerTrustCertificate apply(Context context); + } + /** The ServerTrustCertificate update stages. */ + interface UpdateStages { + /** The stage of the ServerTrustCertificate update allowing to specify publicBlob. */ + interface WithPublicBlob { + /** + * Specifies the publicBlob property: The certificate public blob. + * + * @param publicBlob The certificate public blob. + * @return the next definition stage. + */ + Update withPublicBlob(String publicBlob); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerTrustCertificate refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerTrustCertificate refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificates.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificates.java new file mode 100644 index 0000000000000..8ed53d07e1b1f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificates.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.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 ServerTrustCertificates. */ +public interface ServerTrustCertificates { + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 server trust certificate that was uploaded from box to Sql Managed Instance. + */ + ServerTrustCertificate get(String resourceGroupName, String managedInstanceName, String certificateName); + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 server trust certificate that was uploaded from box to Sql Managed Instance along with {@link + * Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String certificateName, Context context); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 managedInstanceName, String certificateName); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate 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 managedInstanceName, String certificateName, Context context); + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 server trust certificate that was uploaded from box to Sql Managed Instance along with {@link + * Response}. + */ + ServerTrustCertificate getById(String id); + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 server trust certificate that was uploaded from box to Sql Managed Instance along with {@link + * Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 server trust certificate that was uploaded from box to Sql 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 ServerTrustCertificate resource. + * + * @param name resource name. + * @return the first stage of the new ServerTrustCertificate definition. + */ + ServerTrustCertificate.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificatesListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificatesListResult.java new file mode 100644 index 0000000000000..80c7d38da07bb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificatesListResult.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.resourcemanager.sql.generated.fluent.models.ServerTrustCertificateInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server trust certificates in instance. */ +@Immutable +public final class ServerTrustCertificatesListResult { + /* + * 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/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..409f76639509d --- /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..3dc3e0ccf6b10 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroupListResult.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.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server trust groups. */ +@Immutable +public final class ServerTrustGroupListResult { + /* + * 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/ServerTrustGroupPropertiesTrustScopesItem.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroupPropertiesTrustScopesItem.java new file mode 100644 index 0000000000000..a29f1a98cabe1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroupPropertiesTrustScopesItem.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerTrustGroupPropertiesTrustScopesItem. */ +public final class ServerTrustGroupPropertiesTrustScopesItem + extends ExpandableStringEnum { + /** Static value GlobalTransactions for ServerTrustGroupPropertiesTrustScopesItem. */ + public static final ServerTrustGroupPropertiesTrustScopesItem GLOBAL_TRANSACTIONS = + fromString("GlobalTransactions"); + + /** Static value ServiceBroker for ServerTrustGroupPropertiesTrustScopesItem. */ + public static final ServerTrustGroupPropertiesTrustScopesItem SERVICE_BROKER = fromString("ServiceBroker"); + + /** + * Creates or finds a ServerTrustGroupPropertiesTrustScopesItem from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerTrustGroupPropertiesTrustScopesItem. + */ + @JsonCreator + public static ServerTrustGroupPropertiesTrustScopesItem fromString(String name) { + return fromString(name, ServerTrustGroupPropertiesTrustScopesItem.class); + } + + /** @return known ServerTrustGroupPropertiesTrustScopesItem values. */ + public static Collection values() { + return values(ServerTrustGroupPropertiesTrustScopesItem.class); + } +} 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..cd28f6a78bd4c --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..2c3058e76f26a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUpdate.java @@ -0,0 +1,372 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.resourcemanager.sql.generated.fluent.models.ServerProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** An update request for an Azure SQL Database server. */ +@Fluent +public final class ServerUpdate { + /* + * Server identity + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the identity property: Server identity. + * + * @return the identity value. + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Server identity. + * + * @param identity the identity value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAdministratorLogin(administratorLogin); + return this; + } + + /** + * Get the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + /** + * Get the version property: The version of the server. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the state property: The state of the server. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().fullyQualifiedDomainName(); + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a server. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withMinimalTlsVersion(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 ServerNetworkAccessFlag publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().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(ServerNetworkAccessFlag publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the workspaceFeature property: Whether or not existing server has a workspace created and if it allows + * connection from workspace. + * + * @return the workspaceFeature value. + */ + public ServerWorkspaceFeature workspaceFeature() { + return this.innerProperties() == null ? null : this.innerProperties().workspaceFeature(); + } + + /** + * Get the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + public String primaryUserAssignedIdentityId() { + return this.innerProperties() == null ? null : this.innerProperties().primaryUserAssignedIdentityId(); + } + + /** + * Set the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } + + /** + * Get the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @return the federatedClientId value. + */ + public UUID federatedClientId() { + return this.innerProperties() == null ? null : this.innerProperties().federatedClientId(); + } + + /** + * Set the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withFederatedClientId(UUID federatedClientId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withFederatedClientId(federatedClientId); + return this; + } + + /** + * Get the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + public String keyId() { + return this.innerProperties() == null ? null : this.innerProperties().keyId(); + } + + /** + * Set the keyId property: A CMK URI of the key to use for encryption. + * + * @param keyId the keyId value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withKeyId(String keyId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withKeyId(keyId); + return this; + } + + /** + * Get the administrators property: The Azure Active Directory identity of the server. + * + * @return the administrators value. + */ + public ServerExternalAdministrator administrators() { + return this.innerProperties() == null ? null : this.innerProperties().administrators(); + } + + /** + * Set the administrators property: The Azure Active Directory identity of the server. + * + * @param administrators the administrators value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withAdministrators(ServerExternalAdministrator administrators) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAdministrators(administrators); + return this; + } + + /** + * Get the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the restrictOutboundNetworkAccess value. + */ + public ServerNetworkAccessFlag restrictOutboundNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().restrictOutboundNetworkAccess(); + } + + /** + * Set the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param restrictOutboundNetworkAccess the restrictOutboundNetworkAccess value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag restrictOutboundNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withRestrictOutboundNetworkAccess(restrictOutboundNetworkAccess); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().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..b598522c0bd7a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsageListResult.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.azure.resourcemanager.sql.generated.fluent.models.ServerUsageInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a list server metrics request. */ +@Fluent +public final class ServerUsageListResult { + /* + * 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()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerUsageListResult.class); +} 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..84aa678dfb6ac --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsages.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 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 as paginated response with {@link + * PagedIterable}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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..c93a41967d9fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVersionCapability.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.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The server capability. */ +@Fluent +public final class ServerVersionCapability { + /* + * 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..6d668a7cbe7b0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessment.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.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 write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, + * StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @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. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @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 write access + * to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet + * or a firewall. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. Applies only if the storage account is not behind a + * Vnet or a firewall. + * @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. Applies only if the storage account is not behind a Vnet or a + * firewall. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. Applies only if the storage account is not behind a Vnet or a firewall. + * @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 write access + * to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. Applies only if the storage account is not behind a Vnet + * or a firewall. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. Applies only if the storage account is not behind a + * Vnet or a firewall. + * @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. Applies only if the storage account is not behind a Vnet or a + * firewall. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. Applies only if the storage account is not behind a Vnet or a firewall. + * @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..fc9b6c2af60ba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessmentListResult.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.resourcemanager.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the server's vulnerability assessments. */ +@Immutable +public final class ServerVulnerabilityAssessmentListResult { + /* + * 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..f661077ff378b --- /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 along with {@link Response}. + */ + 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 {@link 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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/ServerWorkspaceFeature.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerWorkspaceFeature.java new file mode 100644 index 0000000000000..b013c8d8a24aa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerWorkspaceFeature.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 ServerWorkspaceFeature. */ +public final class ServerWorkspaceFeature extends ExpandableStringEnum { + /** Static value Connected for ServerWorkspaceFeature. */ + public static final ServerWorkspaceFeature CONNECTED = fromString("Connected"); + + /** Static value Disconnected for ServerWorkspaceFeature. */ + public static final ServerWorkspaceFeature DISCONNECTED = fromString("Disconnected"); + + /** + * Creates or finds a ServerWorkspaceFeature from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerWorkspaceFeature. + */ + @JsonCreator + public static ServerWorkspaceFeature fromString(String name) { + return fromString(name, ServerWorkspaceFeature.class); + } + + /** @return known ServerWorkspaceFeature values. */ + public static Collection values() { + return values(ServerWorkspaceFeature.class); + } +} 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..0b9f3f4dd6bf9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Servers.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.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 as paginated response with {@link PagedIterable}. + */ + 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String expand, 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String serverName, String expand, 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 as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets a list of all servers in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String expand, 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); + + /** + * 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 along with {@link Response}. + */ + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest 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 along with {@link Response}. + */ + Server getById(String id); + + /** + * Gets a server. + * + * @param id the resource ID. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server along with {@link Response}. + */ + Response getByIdWithResponse(String id, String expand, 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..3f745ca129d9f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveCapability.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** The service objectives capability. */ +@Fluent +public final class ServiceObjectiveCapability { + /* + * 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..2c5340b50bf23 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveListResult.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.ServiceObjectiveInner; +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 { + /* + * 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()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServiceObjectiveListResult.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..6961a5aa431b6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectives.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 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 along with {@link Response}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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 as paginated response with {@link + * PagedIterable}. + */ + 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/ServicePrincipal.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServicePrincipal.java new file mode 100644 index 0000000000000..1596df514d833 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServicePrincipal.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The managed instance's service principal configuration for a resource. */ +@Fluent +public final class ServicePrincipal { + /* + * The Azure Active Directory application object id. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The Azure Active Directory application client id. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /* + * The Azure Active Directory tenant id. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * Service principal type. + */ + @JsonProperty(value = "type") + private ServicePrincipalType type; + + /** + * Get the principalId property: The Azure Active Directory application object id. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The Azure Active Directory application client id. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Get the tenantId property: The Azure Active Directory tenant id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Service principal type. + * + * @return the type value. + */ + public ServicePrincipalType type() { + return this.type; + } + + /** + * Set the type property: Service principal type. + * + * @param type the type value to set. + * @return the ServicePrincipal object itself. + */ + public ServicePrincipal withType(ServicePrincipalType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServicePrincipalType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServicePrincipalType.java new file mode 100644 index 0000000000000..e7b86b22f219b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServicePrincipalType.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 ServicePrincipalType. */ +public final class ServicePrincipalType extends ExpandableStringEnum { + /** Static value None for ServicePrincipalType. */ + public static final ServicePrincipalType NONE = fromString("None"); + + /** Static value SystemAssigned for ServicePrincipalType. */ + public static final ServicePrincipalType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Creates or finds a ServicePrincipalType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServicePrincipalType. + */ + @JsonCreator + public static ServicePrincipalType fromString(String name) { + return fromString(name, ServicePrincipalType.class); + } + + /** @return known ServicePrincipalType values. */ + public static Collection values() { + return values(ServicePrincipalType.class); + } +} 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..13bd430e08d42 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Sku.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.JsonProperty; + +/** An ARM Resource SKU. */ +@Fluent +public final class Sku { + /* + * 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Sku.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgentConfiguration.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgentConfiguration.java new file mode 100644 index 0000000000000..6a2b15a8b7edf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgentConfiguration.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.SqlAgentConfigurationInner; + +/** An immutable client-side representation of SqlAgentConfiguration. */ +public interface SqlAgentConfiguration { + /** + * 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: The state of Sql Agent. + * + * @return the state value. + */ + SqlAgentConfigurationPropertiesState state(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner object. + * + * @return the inner object. + */ + SqlAgentConfigurationInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgentConfigurationPropertiesState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgentConfigurationPropertiesState.java new file mode 100644 index 0000000000000..e764f5344eb87 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgentConfigurationPropertiesState.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 SqlAgentConfigurationPropertiesState. */ +public final class SqlAgentConfigurationPropertiesState + extends ExpandableStringEnum { + /** Static value Enabled for SqlAgentConfigurationPropertiesState. */ + public static final SqlAgentConfigurationPropertiesState ENABLED = fromString("Enabled"); + + /** Static value Disabled for SqlAgentConfigurationPropertiesState. */ + public static final SqlAgentConfigurationPropertiesState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a SqlAgentConfigurationPropertiesState from its string representation. + * + * @param name a name to look for. + * @return the corresponding SqlAgentConfigurationPropertiesState. + */ + @JsonCreator + public static SqlAgentConfigurationPropertiesState fromString(String name) { + return fromString(name, SqlAgentConfigurationPropertiesState.class); + } + + /** @return known SqlAgentConfigurationPropertiesState values. */ + public static Collection values() { + return values(SqlAgentConfigurationPropertiesState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgents.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgents.java new file mode 100644 index 0000000000000..50ba311b03875 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgents.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; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner; + +/** Resource collection API of SqlAgents. */ +public interface SqlAgents { + /** + * Gets current instance sql agent 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 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 current instance sql agent configuration. + */ + SqlAgentConfiguration get(String resourceGroupName, String managedInstanceName); + + /** + * Gets current instance sql agent 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 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 current instance sql agent configuration along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Puts new sql agent configuration to 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 A recoverable managed database 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 recoverable managed database resource. + */ + SqlAgentConfiguration createOrUpdate( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters); + + /** + * Puts new sql agent configuration to 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 A recoverable managed database 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 recoverable managed database resource along with {@link Response}. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters, Context context); +} 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..50d503534ab36 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapability.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.fasterxml.jackson.annotation.JsonProperty; + +/** The storage account type capability. */ +@Fluent +public final class StorageCapability { + /* + * 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..2e632d42d8fae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsageListResult.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.resourcemanager.sql.generated.fluent.models.SubscriptionUsageInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of subscription usage metrics in a location. */ +@Immutable +public final class SubscriptionUsageListResult { + /* + * 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..2a1c1f4ff0999 --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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..06ad95b7003cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgent.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.http.rest.Response; +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); + + /** + * Generates a sync agent key. + * + * @throws com.azure.core.management.exception.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(); + + /** + * Generates a sync agent key. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 along with {@link Response}. + */ + Response generateKeyWithResponse(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..96dc520e448b5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabaseListResult.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.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync agent linked databases. */ +@Immutable +public final class SyncAgentLinkedDatabaseListResult { + /* + * 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..cc899b0b29d27 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentListResult.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.resourcemanager.sql.generated.fluent.models.SyncAgentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync agents. */ +@Immutable +public final class SyncAgentListResult { + /* + * 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..dc7e0dc541c0a --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..8c4b27c4813b9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdListResult.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.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync database ID properties. */ +@Immutable +public final class SyncDatabaseIdListResult { + /* + * 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..95afa9d58aad2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaPropertiesListResult.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.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync schema properties. */ +@Immutable +public final class SyncFullSchemaPropertiesListResult { + /* + * 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..04b745b906696 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTable.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of the table in the database full schema. */ +@Immutable +public final class SyncFullSchemaTable { + /* + * 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..507f8ca801707 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTableColumn.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.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the column in the table of database full schema. */ +@Immutable +public final class SyncFullSchemaTableColumn { + /* + * 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..4f7e8619f5f1f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroup.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.models; + +import com.azure.core.http.rest.Response; +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 sku property: The name and capacity of the SKU. + * + * @return the sku value. + */ + Sku sku(); + + /** + * 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 enableConflictLogging property: If conflict logging is enabled. + * + * @return the enableConflictLogging value. + */ + Boolean enableConflictLogging(); + + /** + * Gets the conflictLoggingRetentionInDays property: Conflict logging retention period. + * + * @return the conflictLoggingRetentionInDays value. + */ + Integer conflictLoggingRetentionInDays(); + + /** + * 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.WithSku, + DefinitionStages.WithInterval, + DefinitionStages.WithConflictResolutionPolicy, + DefinitionStages.WithSyncDatabaseId, + DefinitionStages.WithHubDatabaseUsername, + DefinitionStages.WithHubDatabasePassword, + DefinitionStages.WithSchema, + DefinitionStages.WithEnableConflictLogging, + DefinitionStages.WithConflictLoggingRetentionInDays, + 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 sku. */ + interface WithSku { + /** + * Specifies the sku property: The name and capacity of the SKU.. + * + * @param sku The name and capacity of the SKU. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** 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 enableConflictLogging. */ + interface WithEnableConflictLogging { + /** + * Specifies the enableConflictLogging property: If conflict logging is enabled.. + * + * @param enableConflictLogging If conflict logging is enabled. + * @return the next definition stage. + */ + WithCreate withEnableConflictLogging(Boolean enableConflictLogging); + } + /** The stage of the SyncGroup definition allowing to specify conflictLoggingRetentionInDays. */ + interface WithConflictLoggingRetentionInDays { + /** + * Specifies the conflictLoggingRetentionInDays property: Conflict logging retention period.. + * + * @param conflictLoggingRetentionInDays Conflict logging retention period. + * @return the next definition stage. + */ + WithCreate withConflictLoggingRetentionInDays(Integer conflictLoggingRetentionInDays); + } + /** 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.WithSku, + UpdateStages.WithInterval, + UpdateStages.WithConflictResolutionPolicy, + UpdateStages.WithSyncDatabaseId, + UpdateStages.WithHubDatabaseUsername, + UpdateStages.WithHubDatabasePassword, + UpdateStages.WithSchema, + UpdateStages.WithEnableConflictLogging, + UpdateStages.WithConflictLoggingRetentionInDays, + 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 sku. */ + interface WithSku { + /** + * Specifies the sku property: The name and capacity of the SKU.. + * + * @param sku The name and capacity of the SKU. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** 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 enableConflictLogging. */ + interface WithEnableConflictLogging { + /** + * Specifies the enableConflictLogging property: If conflict logging is enabled.. + * + * @param enableConflictLogging If conflict logging is enabled. + * @return the next definition stage. + */ + Update withEnableConflictLogging(Boolean enableConflictLogging); + } + /** The stage of the SyncGroup update allowing to specify conflictLoggingRetentionInDays. */ + interface WithConflictLoggingRetentionInDays { + /** + * Specifies the conflictLoggingRetentionInDays property: Conflict logging retention period.. + * + * @param conflictLoggingRetentionInDays Conflict logging retention period. + * @return the next definition stage. + */ + Update withConflictLoggingRetentionInDays(Integer conflictLoggingRetentionInDays); + } + /** 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); + + /** + * Refreshes a hub database schema. + * + * @throws com.azure.core.management.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(); + + /** + * Refreshes a hub database schema. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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(Context context); + + /** + * Cancels a sync group synchronization. + * + * @throws com.azure.core.management.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(); + + /** + * Cancels a sync group synchronization. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response cancelSyncWithResponse(Context context); + + /** + * Triggers a sync group synchronization. + * + * @throws com.azure.core.management.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(); + + /** + * Triggers a sync group synchronization. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response triggerSyncWithResponse(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..997ddc5d095e3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupListResult.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.resourcemanager.sql.generated.fluent.models.SyncGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync groups. */ +@Immutable +public final class SyncGroupListResult { + /* + * 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..898020fab31d7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogListResult.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.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync group log properties. */ +@Immutable +public final class SyncGroupLogListResult { + /* + * 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..ab8b6fa81ed3e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchema.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.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of sync group schema. */ +@Fluent +public final class SyncGroupSchema { + /* + * 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..f74265a1542c0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTable.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.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of table in sync group schema. */ +@Fluent +public final class SyncGroupSchemaTable { + /* + * 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..b01dded0d0399 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTableColumn.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.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of column in sync group table. */ +@Fluent +public final class SyncGroupSchemaTableColumn { + /* + * 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..147449bdceb05 --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 {@link 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 {@link 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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..7a1dd44640133 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMember.java @@ -0,0 +1,455 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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); + + /** + * Refreshes a sync member database schema. + * + * @throws com.azure.core.management.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(); + + /** + * Refreshes a sync member database schema. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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(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..b4dd7b4f2f54e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberListResult.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.resourcemanager.sql.generated.fluent.models.SyncMemberInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Azure SQL Database sync members. */ +@Immutable +public final class SyncMemberListResult { + /* + * 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..be7de5effd02c --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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/TableTemporalType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TableTemporalType.java new file mode 100644 index 0000000000000..151baa7d4e6ba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TableTemporalType.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 TableTemporalType. */ +public final class TableTemporalType extends ExpandableStringEnum { + /** Static value NonTemporalTable for TableTemporalType. */ + public static final TableTemporalType NON_TEMPORAL_TABLE = fromString("NonTemporalTable"); + + /** Static value HistoryTable for TableTemporalType. */ + public static final TableTemporalType HISTORY_TABLE = fromString("HistoryTable"); + + /** Static value SystemVersionedTemporalTable for TableTemporalType. */ + public static final TableTemporalType SYSTEM_VERSIONED_TEMPORAL_TABLE = fromString("SystemVersionedTemporalTable"); + + /** + * Creates or finds a TableTemporalType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TableTemporalType. + */ + @JsonCreator + public static TableTemporalType fromString(String name) { + return fromString(name, TableTemporalType.class); + } + + /** @return known TableTemporalType values. */ + public static Collection values() { + return values(TableTemporalType.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..594cfa171b090 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificate.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.fluent.models.TdeCertificateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A TDE certificate that can be uploaded into a server. */ +@Fluent +public final class TdeCertificate extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private TdeCertificateProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private TdeCertificateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateBlob property: The base64 encoded certificate private blob. + * + * @return the privateBlob value. + */ + public String privateBlob() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new TdeCertificateProperties(); + } + this.innerProperties().withPrivateBlob(privateBlob); + return this; + } + + /** + * Get the certPassword property: The certificate password. + * + * @return the certPassword value. + */ + public String certPassword() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new TdeCertificateProperties(); + } + this.innerProperties().withCertPassword(certPassword); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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/TimeZone.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZone.java new file mode 100644 index 0000000000000..238ffb58a9882 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZone.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.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.TimeZoneInner; + +/** An immutable client-side representation of TimeZone. */ +public interface TimeZone { + /** + * 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 timeZoneId property: The time zone id. + * + * @return the timeZoneId value. + */ + String timeZoneId(); + + /** + * Gets the displayName property: The time zone display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.TimeZoneInner object. + * + * @return the inner object. + */ + TimeZoneInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZoneListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZoneListResult.java new file mode 100644 index 0000000000000..8c5b6f3c48dca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZoneListResult.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.resourcemanager.sql.generated.fluent.models.TimeZoneInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of time zones. */ +@Immutable +public final class TimeZoneListResult { + /* + * 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/TimeZones.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZones.java new file mode 100644 index 0000000000000..662cd08885ec9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZones.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 TimeZones. */ +public interface TimeZones { + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName 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 managed instance time zones by location as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String locationName); + + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName 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 managed instance time zones by location as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String locationName, Context context); + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId 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 managed instance time zone. + */ + TimeZone get(String locationName, String timeZoneId); + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId 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 managed instance time zone along with {@link Response}. + */ + Response getWithResponse(String locationName, String timeZoneId, 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..f406f36e07bce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueries.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsProperties; +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..1f37fd3ea5958 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueriesListResult.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.resourcemanager.sql.generated.fluent.models.TopQueriesInner; +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 { + /* + * 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/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/TransparentDataEncryptionState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionState.java new file mode 100644 index 0000000000000..0d67051fc15eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionState.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 TransparentDataEncryptionState. */ +public enum TransparentDataEncryptionState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a TransparentDataEncryptionState instance. */ + private final String value; + + TransparentDataEncryptionState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TransparentDataEncryptionState instance. + * + * @param value the serialized value to parse. + * @return the parsed TransparentDataEncryptionState object, or null if unable to parse. + */ + @JsonCreator + public static TransparentDataEncryptionState fromString(String value) { + TransparentDataEncryptionState[] items = TransparentDataEncryptionState.values(); + for (TransparentDataEncryptionState 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..8b8fa30ea85e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptions.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.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TransparentDataEncryptions. */ +public interface TransparentDataEncryptions { + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName 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 logical database's transparent data encryption. + */ + LogicalDatabaseTransparentDataEncryption get( + String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionName tdeName); + + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName 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 logical database's transparent data encryption along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context); + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption 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 logical database's transparent data encryption as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption 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 logical database's transparent data encryption as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a logical database's transparent data encryption. + * + * @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 logical database's transparent data encryption along with {@link Response}. + */ + LogicalDatabaseTransparentDataEncryption getById(String id); + + /** + * Gets a logical database's transparent data encryption. + * + * @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 logical database's transparent data encryption along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new LogicalDatabaseTransparentDataEncryption resource. + * + * @param name resource name. + * @return the first stage of the new LogicalDatabaseTransparentDataEncryption definition. + */ + LogicalDatabaseTransparentDataEncryption.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..4296cdcde60cf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnlinkParameters.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents the parameters for Unlink Replication Link request. */ +@Fluent +public final class UnlinkParameters { + /* + * 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..9b57555cd15f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateLongTermRetentionBackupParameters.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.UpdateLongTermRetentionBackupParametersProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform long term retention backup update operation. */ +@Fluent +public final class UpdateLongTermRetentionBackupParameters { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private UpdateLongTermRetentionBackupParametersProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private UpdateLongTermRetentionBackupParametersProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().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( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + if (this.innerProperties() == null) { + this.innerProperties = new UpdateLongTermRetentionBackupParametersProperties(); + } + this.innerProperties().withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateManagedInstanceDnsServersOperation.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateManagedInstanceDnsServersOperation.java new file mode 100644 index 0000000000000..5c5f3a92c160a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateManagedInstanceDnsServersOperation.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.UpdateManagedInstanceDnsServersOperationInner; + +/** An immutable client-side representation of UpdateManagedInstanceDnsServersOperation. */ +public interface UpdateManagedInstanceDnsServersOperation { + /** + * 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: The status of the DNS refresh operation. + * + * @return the status value. + */ + DnsRefreshConfigurationPropertiesStatus status(); + + /** + * Gets the inner + * com.azure.resourcemanager.sql.generated.fluent.models.UpdateManagedInstanceDnsServersOperationInner object. + * + * @return the inner object. + */ + UpdateManagedInstanceDnsServersOperationInner innerModel(); +} 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..3363775aa311b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationParameters.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** The UpsertManagedServerOperationParameters model. */ +@Fluent +public final class UpsertManagedServerOperationParameters { + /* + * 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..5a276ae02c232 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStep.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.fasterxml.jackson.annotation.JsonProperty; + +/** The UpsertManagedServerOperationStep model. */ +@Fluent +public final class UpsertManagedServerOperationStep { + /* + * 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..2638863a1eb22 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UsageListResult.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.resourcemanager.sql.generated.fluent.models.UsageInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of usages. */ +@Immutable +public final class UsageListResult { + /* + * 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..d48ad3b225259 --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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/UserIdentity.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UserIdentity.java new file mode 100644 index 0000000000000..e9862b373f4b3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UserIdentity.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Azure Active Directory identity configuration for a resource. */ +@Immutable +public class UserIdentity { + /* + * The Azure Active Directory principal id. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The Azure Active Directory client id. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** + * Get the principalId property: The Azure Active Directory principal id. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The Azure Active Directory client id. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * 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/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..37c4d4b900d0c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualCluster.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.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 maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this virtual + * cluster. + * + * @return the maintenanceConfigurationId value. + */ + String maintenanceConfigurationId(); + + /** + * 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..551045f14ec4b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterListResult.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.resourcemanager.sql.generated.fluent.models.VirtualClusterInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of virtual clusters. */ +@Immutable +public final class VirtualClusterListResult { + /* + * 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..e9fc9ad032c18 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterUpdate.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.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An update request for an Azure SQL Database virtual cluster. */ +@Fluent +public final class VirtualClusterUpdate { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private VirtualClusterProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VirtualClusterProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualClusterProperties(); + } + this.innerProperties().withFamily(family); + return this; + } + + /** + * Get the childResources property: List of resources in this virtual cluster. + * + * @return the childResources value. + */ + public List childResources() { + return this.innerProperties() == null ? null : this.innerProperties().childResources(); + } + + /** + * Get the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this virtual + * cluster. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceConfigurationId(); + } + + /** + * Set the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this virtual + * cluster. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the VirtualClusterUpdate object itself. + */ + public VirtualClusterUpdate withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualClusterProperties(); + } + this.innerProperties().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/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..36994adab9032 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusters.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.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 { + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 recoverable managed database resource. + */ + UpdateManagedInstanceDnsServersOperation updateDnsServers(String resourceGroupName, String virtualClusterName); + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 recoverable managed database resource along with {@link Response}. + */ + Response updateDnsServersWithResponse( + String resourceGroupName, String virtualClusterName, Context context); + + /** + * 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 virtual cluster 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 virtual cluster 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..d7383db9c1f1f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleListResult.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.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of virtual network rules. */ +@Immutable +public final class VirtualNetworkRuleListResult { + /* + * 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..6ec868019275f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleState.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 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 Failed for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState FAILED = fromString("Failed"); + + /** 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..f8b0548c5b217 --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..2df0a7eef9588 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentRecurringScansProperties.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.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a Vulnerability Assessment recurring scans. */ +@Fluent +public final class VulnerabilityAssessmentRecurringScansProperties { + /* + * 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..e80f1f671d235 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanError.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a vulnerability assessment scan error. */ +@Immutable +public final class VulnerabilityAssessmentScanError { + /* + * 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..1c900bfc965b5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecordListResult.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.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of vulnerability assessment scan records. */ +@Immutable +public final class VulnerabilityAssessmentScanRecordListResult { + /* + * 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..5b1dbd0d78473 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifierListResult.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.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of workload classifiers for a workload group. */ +@Immutable +public final class WorkloadClassifierListResult { + /* + * 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..724e6469158a6 --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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..c6c45bd688df9 --- /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. + */ + int minResourcePercent(); + + /** + * Gets the maxResourcePercent property: The workload group cap percentage resource. + * + * @return the maxResourcePercent value. + */ + int 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(int 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(int 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(int 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(int 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..d29d253c2390b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroupListResult.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.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of workload groups. */ +@Immutable +public final class WorkloadGroupListResult { + /* + * 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..762d166e2bed8 --- /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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..006a878496b38 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.DiffBackupIntervalInHours; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +/** Samples for BackupShortTermRetentionPolicies CreateOrUpdate. */ +public final class BackupShortTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/UpdateShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .backupShortTermRetentionPolicies() + .define(ShortTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("resourceGroup", "testsvr", "testdb") + .withRetentionDays(7) + .withDiffBackupIntervalInHours(DiffBackupIntervalInHours.TWO_FOUR) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesGetSamples.java new file mode 100644 index 0000000000000..343afd4307cec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +/** Samples for BackupShortTermRetentionPolicies Get. */ +public final class BackupShortTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetShortTermRetentionPolicy.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .backupShortTermRetentionPolicies() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testsvr", "testdb", ShortTermRetentionPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..452992631a9a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for BackupShortTermRetentionPolicies ListByDatabase. */ +public final class BackupShortTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListShortTermRetentionPoliciesByDatabase.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .backupShortTermRetentionPolicies() + .listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesUpdateSamples.java new file mode 100644 index 0000000000000..db82238ac2b49 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.DiffBackupIntervalInHours; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +/** Samples for BackupShortTermRetentionPolicies Update. */ +public final class BackupShortTermRetentionPoliciesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/UpdateShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + BackupShortTermRetentionPolicy resource = + manager + .backupShortTermRetentionPolicies() + .getWithResponse( + "resourceGroup", "testsvr", "testdb", ShortTermRetentionPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withRetentionDays(7) + .withDiffBackupIntervalInHours(DiffBackupIntervalInHours.TWO_FOUR) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/CapabilitiesListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/CapabilitiesListByLocationSamples.java new file mode 100644 index 0000000000000..65795b2c4df2b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/CapabilitiesListByLocationSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Capabilities ListByLocation. */ +public final class CapabilitiesListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LocationCapabilityListByLocation.json + */ + /** + * Sample code: List subscription capabilities in the given location. + * + * @param manager Entry point to SqlManager. + */ + public static void listSubscriptionCapabilitiesInTheGivenLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.capabilities().listByLocationWithResponse("eastus", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..899dd1dfbbefe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingPoliciesCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.DataMaskingState; + +/** Samples for DataMaskingPolicies CreateOrUpdate. */ +public final class DataMaskingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyCreateOrUpdateMin.json + */ + /** + * Sample code: Create or update data masking policy min. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateDataMaskingPolicyMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingPolicies() + .define() + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withDataMaskingState(DataMaskingState.ENABLED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyCreateOrUpdateMax.json + */ + /** + * Sample code: Create or update data masking policy max. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateDataMaskingPolicyMax(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingPolicies() + .define() + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withDataMaskingState(DataMaskingState.ENABLED) + .withExemptPrincipals("testuser;") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingPoliciesGetSamples.java new file mode 100644 index 0000000000000..4b072ed497648 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingPoliciesGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for DataMaskingPolicies Get. */ +public final class DataMaskingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyGet.json + */ + /** + * Sample code: Get data masking policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getDataMaskingPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingPolicies() + .getWithResponse("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingRulesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d6ec95f823cec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingRulesCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.DataMaskingFunction; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRuleState; + +/** Samples for DataMaskingRules CreateOrUpdate. */ +public final class DataMaskingRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateDefaultMin.json + */ + /** + * Sample code: Create/Update data masking rule for default min. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForDefaultMin( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateDefaultMax.json + */ + /** + * Sample code: Create/Update data masking rule for default max. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForDefaultMax( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withAliasName("nickname") + .withRuleState(DataMaskingRuleState.ENABLED) + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateText.json + */ + /** + * Sample code: Create/Update data masking rule for text. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForText(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.TEXT) + .withPrefixSize("1") + .withSuffixSize("0") + .withReplacementString("asdf") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateNumber.json + */ + /** + * Sample code: Create/Update data masking rule for numbers. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForNumbers( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.NUMBER) + .withNumberFrom("0") + .withNumberTo("2") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingRulesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingRulesListByDatabaseSamples.java new file mode 100644 index 0000000000000..dcd37974b4286 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingRulesListByDatabaseSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for DataMaskingRules ListByDatabase. */ +public final class DataMaskingRulesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleList.json + */ + /** + * Sample code: List data masking rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listDataMaskingRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .listByDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataWarehouseUserActivitiesOperationGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataWarehouseUserActivitiesOperationGetSamples.java new file mode 100644 index 0000000000000..a69540b6a5148 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataWarehouseUserActivitiesOperationGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivityName; + +/** Samples for DataWarehouseUserActivitiesOperation Get. */ +public final class DataWarehouseUserActivitiesOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetDataWarehouseUserActivities.json + */ + /** + * Sample code: Get the list of the user activities of a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheListOfTheUserActivitiesOfADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataWarehouseUserActivitiesOperations() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testsvr", "testdb", DataWarehouseUserActivityName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataWarehouseUserActivitiesOperationListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataWarehouseUserActivitiesOperationListByDatabaseSamples.java new file mode 100644 index 0000000000000..4298d96a326d0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataWarehouseUserActivitiesOperationListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DataWarehouseUserActivitiesOperation ListByDatabase. */ +public final class DataWarehouseUserActivitiesOperationListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListDataWarehouseUserActivities.json + */ + /** + * Sample code: List of the user activities of a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfTheUserActivitiesOfADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataWarehouseUserActivitiesOperations() + .listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsGetSamples.java new file mode 100644 index 0000000000000..845b6d10643f0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAdvisors Get. */ +public final class DatabaseAdvisorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorGet.json + */ + /** + * Sample code: Get database advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .getWithResponse("workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "CreateIndex", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsListByDatabaseSamples.java new file mode 100644 index 0000000000000..65cede458a8a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsListByDatabaseSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAdvisors ListByDatabase. */ +public final class DatabaseAdvisorsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorList.json + */ + /** + * Sample code: List of database advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfDatabaseAdvisors(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .listByDatabaseWithResponse( + "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionListExpand.json + */ + /** + * Sample code: List of database recommended actions for all advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfDatabaseRecommendedActionsForAllAdvisors( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .listByDatabaseWithResponse( + "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "recommendedActions", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsUpdateSamples.java new file mode 100644 index 0000000000000..d95de52526518 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatus; + +/** Samples for DatabaseAdvisors Update. */ +public final class DatabaseAdvisorsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorUpdate.json + */ + /** + * Sample code: Update database advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void updateDatabaseAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .updateWithResponse( + "workloadinsight-demos", + "misosisvr", + "IndexAdvisor_test_3", + "CreateIndex", + new AdvisorInner().withAutoExecuteStatus(AutoExecuteStatus.DISABLED), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAutomaticTuningGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAutomaticTuningGetSamples.java new file mode 100644 index 0000000000000..493131ef94e50 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAutomaticTuningGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAutomaticTuning Get. */ +public final class DatabaseAutomaticTuningGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningGet.json + */ + /** + * Sample code: Get a database's automatic tuning settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSAutomaticTuningSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseAutomaticTunings().getWithResponse("default-sql-onebox", "testsvr11", "db1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAutomaticTuningUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAutomaticTuningUpdateSamples.java new file mode 100644 index 0000000000000..dba62118f244a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAutomaticTuningUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptionModeDesired; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptions; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DatabaseAutomaticTuning Update. */ +public final class DatabaseAutomaticTuningUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningUpdateMax.json + */ + /** + * Sample code: Updates database automatic tuning settings with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesDatabaseAutomaticTuningSettingsWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + "db1", + new DatabaseAutomaticTuningInner() + .withDesiredState(AutomaticTuningMode.AUTO) + .withOptions( + mapOf( + "createIndex", + new AutomaticTuningOptions().withDesiredState(AutomaticTuningOptionModeDesired.OFF), + "dropIndex", + new AutomaticTuningOptions().withDesiredState(AutomaticTuningOptionModeDesired.ON), + "forceLastGoodPlan", + new AutomaticTuningOptions().withDesiredState(AutomaticTuningOptionModeDesired.DEFAULT))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningUpdateMin.json + */ + /** + * Sample code: Updates database automatic tuning settings with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesDatabaseAutomaticTuningSettingsWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + "db1", + new DatabaseAutomaticTuningInner().withDesiredState(AutomaticTuningMode.AUTO), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5ba15b597dc07 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for DatabaseBlobAuditingPolicies CreateOrUpdate. */ +public final class DatabaseBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAzureMonitorAuditingCreateMin.json + */ + /** + * Sample code: Create or update a database's azure monitor auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateADatabaseSAzureMonitorAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withIsAzureMonitorTargetEnabled(true) + .withState(BlobAuditingPolicyState.ENABLED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingCreateMax.json + */ + /** + * Sample code: Create or update a database's blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateADatabaseSBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "DATABASE_LOGOUT_GROUP", + "DATABASE_ROLE_MEMBER_CHANGE_GROUP", + "UPDATE on database::TestDatabaseName by public")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingCreateMin.json + */ + /** + * Sample code: Create or update a database's blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateADatabaseSBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesGetSamples.java new file mode 100644 index 0000000000000..0d8dd7a91b9d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseBlobAuditingPolicies Get. */ +public final class DatabaseBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingGet.json + */ + /** + * Sample code: Get a database's blob auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSBlobAuditingPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .getWithResponse("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..c358322ca8ade --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesListByDatabaseSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseBlobAuditingPolicies ListByDatabase. */ +public final class DatabaseBlobAuditingPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAuditingSettingsList.json + */ + /** + * Sample code: List audit settings of a database. + * + * @param manager Entry point to SqlManager. + */ + public static void listAuditSettingsOfADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .listByDatabase("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsGetSamples.java new file mode 100644 index 0000000000000..6a019910b9f00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseColumns Get. */ +public final class DatabaseColumnsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseColumnGet.json + */ + /** + * Sample code: Get database column. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseColumn(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseColumns() + .getWithResponse("myRG", "serverName", "myDatabase", "dbo", "table1", "column1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsListByDatabaseSamples.java new file mode 100644 index 0000000000000..f185b3a042788 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsListByDatabaseSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.Arrays; + +/** Samples for DatabaseColumns ListByDatabase. */ +public final class DatabaseColumnsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnsListByDatabaseMax.json + */ + /** + * Sample code: Filter database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void filterDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseColumns() + .listByDatabase( + "myRG", + "serverName", + "myDatabase", + Arrays.asList("dbo"), + Arrays.asList("customer", "address"), + Arrays.asList("username"), + Arrays.asList("schema asc", "table", "column desc"), + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnsListByDatabaseMin.json + */ + /** + * Sample code: List database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseColumns() + .listByDatabase("myRG", "serverName", "myDatabase", null, null, null, null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsListByTableSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsListByTableSamples.java new file mode 100644 index 0000000000000..ffa4025759f5a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsListByTableSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseColumns ListByTable. */ +public final class DatabaseColumnsListByTableSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseColumnListByTable.json + */ + /** + * Sample code: List database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseColumns().listByTable("myRG", "serverName", "myDatabase", "dbo", "table1", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..0b10d5af07625 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.OperationMode; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for DatabaseExtensionsOperation CreateOrUpdate. */ +public final class DatabaseExtensionsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CreateOrUpdateDatabaseExtensions.json + */ + /** + * Sample code: Create or Update database extensions. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateDatabaseExtensions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseExtensionsOperations() + .define("polybaseimport") + .withExistingDatabase( + "rg_20cbe0f0-c2d9-4522-9177-5469aad53029", + "srv_1ffd1cf8-9951-47fb-807d-a9c384763849", + "878e303f-1ea0-4f17-aa3d-a22ac5e9da08") + .withOperationMode(OperationMode.POLYBASE_IMPORT) + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") + .withStorageUri("https://teststorage.blob.core.windows.net/testcontainer/Manifest.xml") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationGetSamples.java new file mode 100644 index 0000000000000..0b572135bb528 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationGetSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseExtensionsOperation Get. */ +public final class DatabaseExtensionsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetDatabaseExtensions.json + */ + /** + * Sample code: Get database extensions. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseExtensions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseExtensionsOperations() + .getWithResponse( + "rg_a1f9d6f8-30d5-4228-9504-8a364361bca3", + "srv_65858e0f-b1d1-4bdc-8351-a7da86ca4939", + "11aa6c5e-58ed-4693-b303-3b8e3131deaa", + "polybaseimport", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationListByDatabaseSamples.java new file mode 100644 index 0000000000000..10e2b687a99a0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationListByDatabaseSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseExtensionsOperation ListByDatabase. */ +public final class DatabaseExtensionsOperationListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListDatabaseExtensions.json + */ + /** + * Sample code: List database extensions. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseExtensions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseExtensionsOperations() + .listByDatabase( + "rg_4007c5a9-b3b0-41e1-bd46-9eef38768a4a", + "srv_3b67ec2a-519b-43a7-8533-fb62dce3431e", + "719d8fa4-bf0f-48fc-8cd3-ef40fe6ba1fe", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseOperationsCancelSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseOperationsCancelSamples.java new file mode 100644 index 0000000000000..f8220cbac596f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseOperationsCancelSamples.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.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for DatabaseOperations Cancel. */ +public final class DatabaseOperationsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CancelDatabaseOperation.json + */ + /** + * Sample code: Cancel the database management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelTheDatabaseManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseOperations() + .cancelWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-6661", + "testdb", + UUID.fromString("f779414b-e748-4925-8cfe-c8598f7660ae"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseOperationsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseOperationsListByDatabaseSamples.java new file mode 100644 index 0000000000000..4a4a264654e37 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseOperationsListByDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseOperations ListByDatabase. */ +public final class DatabaseOperationsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListDatabaseOperations.json + */ + /** + * Sample code: List the database management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheDatabaseManagementOperations(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseOperations().listByDatabase("sqlcrudtest-7398", "sqlcrudtest-4645", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsGetSamples.java new file mode 100644 index 0000000000000..700f54e5bc553 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsGetSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseRecommendedActions Get. */ +public final class DatabaseRecommendedActionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionGet.json + */ + /** + * Sample code: Get database recommended action. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseRecommendedAction(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseRecommendedActions() + .getWithResponse( + "workloadinsight-demos", + "misosisvr", + "IndexAdvisor_test_3", + "CreateIndex", + "IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsListByDatabaseAdvisorSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsListByDatabaseAdvisorSamples.java new file mode 100644 index 0000000000000..bb829923cef4c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsListByDatabaseAdvisorSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseRecommendedActions ListByDatabaseAdvisor. */ +public final class DatabaseRecommendedActionsListByDatabaseAdvisorSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionList.json + */ + /** + * Sample code: List of database recommended actions. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfDatabaseRecommendedActions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseRecommendedActions() + .listByDatabaseAdvisorWithResponse( + "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "CreateIndex", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsUpdateSamples.java new file mode 100644 index 0000000000000..13925e7994f35 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionCurrentState; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionStateInfo; + +/** Samples for DatabaseRecommendedActions Update. */ +public final class DatabaseRecommendedActionsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionUpdate.json + */ + /** + * Sample code: Update database recommended action. + * + * @param manager Entry point to SqlManager. + */ + public static void updateDatabaseRecommendedAction(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseRecommendedActions() + .updateWithResponse( + "workloadinsight-demos", + "misosisvr", + "IndexAdvisor_test_3", + "CreateIndex", + "IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB", + new RecommendedActionInner() + .withState( + new RecommendedActionStateInfo().withCurrentValue(RecommendedActionCurrentState.PENDING)), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSchemasGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSchemasGetSamples.java new file mode 100644 index 0000000000000..f0b4fb8acb6eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSchemasGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseSchemas Get. */ +public final class DatabaseSchemasGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSchemaGet.json + */ + /** + * Sample code: Get database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseSchemas().getWithResponse("myRG", "serverName", "myDatabase", "dbo", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSchemasListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSchemasListByDatabaseSamples.java new file mode 100644 index 0000000000000..37be490f09ce7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSchemasListByDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseSchemas ListByDatabase. */ +public final class DatabaseSchemasListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSchemaListByDatabase.json + */ + /** + * Sample code: List database schemas. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseSchemas(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseSchemas().listByDatabase("myRG", "serverName", "myDatabase", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..cbb577f9ccb9d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import java.util.Arrays; + +/** Samples for DatabaseSecurityAlertPolicies CreateOrUpdate. */ +public final class DatabaseSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertCreateMax.json + */ + /** + * Sample code: Update a database's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DatabaseSecurityAlertPolicy resource = + manager + .databaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertsPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Sql_Injection", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("test@microsoft.com", "user@microsoft.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(6) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertCreateMin.json + */ + /** + * Sample code: Update a database's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DatabaseSecurityAlertPolicy resource = + manager + .databaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertsPolicyState.ENABLED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesGetSamples.java new file mode 100644 index 0000000000000..9a71f7ecc45e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for DatabaseSecurityAlertPolicies Get. */ +public final class DatabaseSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertGet.json + */ + /** + * Sample code: Get a database's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSThreatDetectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-6852", "securityalert-2080", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..7fdaacc927643 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseSecurityAlertPolicies ListByDatabase. */ +public final class DatabaseSecurityAlertPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertListByDatabase.json + */ + /** + * Sample code: Get the database's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheDatabaseSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSecurityAlertPolicies() + .listByDatabase("securityalert-6852", "securityalert-2080", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseTablesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseTablesGetSamples.java new file mode 100644 index 0000000000000..4a0f6a86ac57e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseTablesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseTables Get. */ +public final class DatabaseTablesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseTableGet.json + */ + /** + * Sample code: Get database table. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseTable(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseTables().getWithResponse("myRG", "serverName", "myDatabase", "dbo", "table1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseTablesListBySchemaSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseTablesListBySchemaSamples.java new file mode 100644 index 0000000000000..046cb732da989 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseTablesListBySchemaSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseTables ListBySchema. */ +public final class DatabaseTablesListBySchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseTableListBySchema.json + */ + /** + * Sample code: List database tables. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseTables(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseTables().listBySchema("myRG", "serverName", "myDatabase", "dbo", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseUsagesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseUsagesListByDatabaseSamples.java new file mode 100644 index 0000000000000..b0f2c583d3e54 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseUsagesListByDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseUsages ListByDatabase. */ +public final class DatabaseUsagesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetDatabaseUsages.json + */ + /** + * Sample code: Gets database usages. + * + * @param manager Entry point to SqlManager. + */ + public static void getsDatabaseUsages(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseUsages().listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..0900a4efeb711 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.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.generated; + +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.Arrays; + +/** Samples for DatabaseVulnerabilityAssessmentRuleBaselines CreateOrUpdate. */ +public final class DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineCreate.json + */ + /** + * Sample code: Creates or updates a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentRuleBaselines() + .define(VulnerabilityAssessmentPolicyBaselineName.DEFAULT) + .withExistingRule( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001") + .withBaselineResults( + Arrays + .asList( + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userA", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userB", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userC", "SELECT", "tableId_4")))) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples.java new file mode 100644 index 0000000000000..3ecd8607e4e1d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for DatabaseVulnerabilityAssessmentRuleBaselines Delete. */ +public final class DatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineDelete.json + */ + /** + * Sample code: Removes a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void removesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentRuleBaselines() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesGetSamples.java new file mode 100644 index 0000000000000..ade02b546919a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesGetSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for DatabaseVulnerabilityAssessmentRuleBaselines Get. */ +public final class DatabaseVulnerabilityAssessmentRuleBaselinesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineGet.json + */ + /** + * Sample code: Gets a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.MASTER, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansExportSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansExportSamples.java new file mode 100644 index 0000000000000..febe7ce360490 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansExportSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans Export. */ +public final class DatabaseVulnerabilityAssessmentScansExportSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanExport.json + */ + /** + * Sample code: Export a database's vulnerability assessment scan results. + * + * @param manager Entry point to SqlManager. + */ + public static void exportADatabaseSVulnerabilityAssessmentScanResults( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .exportWithResponse( + "vulnerabilityassessmenttest-4799", + "vulnerabilityassessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansGetSamples.java new file mode 100644 index 0000000000000..1dad5cf5376f8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansGetSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans Get. */ +public final class DatabaseVulnerabilityAssessmentScansGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanRecordsGet.json + */ + /** + * Sample code: Gets a database vulnerability assessment scan record by scan ID. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseVulnerabilityAssessmentScanRecordByScanID( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansInitiateScanSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansInitiateScanSamples.java new file mode 100644 index 0000000000000..f2fdeb5f9a313 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansInitiateScanSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans InitiateScan. */ +public final class DatabaseVulnerabilityAssessmentScansInitiateScanSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScansExecute.json + */ + /** + * Sample code: Executes a database's vulnerability assessment scan. + * + * @param manager Entry point to SqlManager. + */ + public static void executesADatabaseSVulnerabilityAssessmentScan( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .initiateScan( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan01", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansListByDatabaseSamples.java new file mode 100644 index 0000000000000..186e2f841947e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansListByDatabaseSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans ListByDatabase. */ +public final class DatabaseVulnerabilityAssessmentScansListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanRecordsListByDatabase.json + */ + /** + * Sample code: Gets the list of a database vulnerability assessment scan records. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheListOfADatabaseVulnerabilityAssessmentScanRecords( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .listByDatabase( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..f2beb86618c00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for DatabaseVulnerabilityAssessments CreateOrUpdate. */ +public final class DatabaseVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateContainerSasKeyMin.json + */ + /** + * Sample code: Create a database's vulnerability assessment with minimal parameters, when storageContainerSasKey is + * specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createADatabaseSVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingDatabase("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a database's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createADatabaseSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingDatabase("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateStorageAccessKeyMin.json + */ + /** + * Sample code: Create a database's vulnerability assessment with minimal parameters, when storageAccountAccessKey + * is specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createADatabaseSVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingDatabase("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsDeleteSamples.java new file mode 100644 index 0000000000000..8561514b6a407 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsDeleteSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessments Delete. */ +public final class DatabaseVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsGetSamples.java new file mode 100644 index 0000000000000..50855e68b719c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsGetSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessments Get. */ +public final class DatabaseVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsListByDatabaseSamples.java new file mode 100644 index 0000000000000..4ee5e55ec9171 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsListByDatabaseSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseVulnerabilityAssessments ListByDatabase. */ +public final class DatabaseVulnerabilityAssessmentsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentListByDatabase.json + */ + /** + * Sample code: Get the database's vulnerability assessment policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheDatabaseSVulnerabilityAssessmentPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .listByDatabase( + "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..fd529fc7cecbe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CreateMode; +import com.azure.resourcemanager.sql.generated.models.SecondaryType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.time.OffsetDateTime; + +/** Samples for Databases CreateOrUpdate. */ +public final class DatabasesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseConfiguredBackupStorageRedundancy.json + */ + /** + * Sample code: Creates a database with specified backup storage redundancy. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithSpecifiedBackupStorageRedundancy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.ZONE) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseDefaultMode.json + */ + /** + * Sample code: Creates a database with default mode. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithDefaultMode(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S0").withTier("Standard")) + .withCreateMode(CreateMode.DEFAULT) + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withMaxSizeBytes(1073741824L) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateVCoreDatabaseByServiceObjective.json + */ + /** + * Sample code: Creates a VCore database by specifying service objective name. + * + * @param manager Entry point to SqlManager. + */ + public static void createsAVCoreDatabaseBySpecifyingServiceObjectiveName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("BC").withFamily("Gen4").withCapacity(2)) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseMin.json + */ + /** + * Sample code: Creates a database with minimum number of parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithMinimumNumberOfParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionRecovery.json + */ + /** + * Sample code: Creates a data warehouse database as a cross-subscription restore from a geo-backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromAGeoBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdw") + .withRegion("westus") + .withExistingServer("Default-SQL-WestUS", "testsvr") + .withCreateMode(CreateMode.RECOVERY) + .withSourceResourceId( + "/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-EastUS/providers/Microsoft.Sql/servers/srcsvr/recoverabledatabases/srcdw") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseMaintenanceConfiguration.json + */ + /** + * Sample code: Creates a database with preferred maintenance window. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithPreferredMaintenanceWindow( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S2").withTier("Standard")) + .withCreateMode(CreateMode.DEFAULT) + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withMaxSizeBytes(1073741824L) + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseCopyMode.json + */ + /** + * Sample code: Creates a database as a copy. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseAsACopy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("dbcopy") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S0").withTier("Standard")) + .withCreateMode(CreateMode.COPY) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabasePITRMode.json + */ + /** + * Sample code: Creates a database from PointInTimeRestore. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseFromPointInTimeRestore( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("dbpitr") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SoutheastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb") + .withRestorePointInTime(OffsetDateTime.parse("2020-10-22T05:35:31.503Z")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseLedger.json + */ + /** + * Sample code: Creates a database with ledger on. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithLedgerOn(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withIsLedgerOn(true) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionPITR.json + */ + /** + * Sample code: Creates a data warehouse database as a cross-subscription restore from a restore point of an + * existing database. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromARestorePointOfAnExistingDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdw") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) + .withRestorePointInTime(OffsetDateTime.parse("2022-01-22T05:35:31.503Z")) + .withSourceResourceId( + "/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/srcsvr/databases/srcdw") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateVCoreDatabaseBySkuNameCapacity.json + */ + /** + * Sample code: Creates a VCore database by specifying sku name and capacity. + * + * @param manager Entry point to SqlManager. + */ + public static void createsAVCoreDatabaseBySpecifyingSkuNameAndCapacity( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("BC_Gen4").withCapacity(2)) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionRestore.json + */ + /** + * Sample code: Creates a data warehouse database as a cross-subscription restore from a backup of a dropped + * database. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromABackupOfADroppedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdw") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withCreateMode(CreateMode.RESTORE) + .withSourceResourceId( + "/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/srcsvr/restorableDroppedDatabases/srcdw,131403269876900000") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseNamedReplica.json + */ + /** + * Sample code: Creates a database as named replica secondary. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseAsNamedReplicaSecondary( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("HS_Gen4").withTier("Hyperscale").withCapacity(2)) + .withCreateMode(CreateMode.SECONDARY) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-NorthEurope/providers/Microsoft.Sql/servers/testsvr1/databases/primarydb") + .withSecondaryType(SecondaryType.NAMED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/CreateDatabaseSecondaryMode.json + */ + /** + * Sample code: Creates a database as an on-line secondary. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseAsAnOnLineSecondary(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S0").withTier("Standard")) + .withCreateMode(CreateMode.SECONDARY) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-NorthEurope/providers/Microsoft.Sql/servers/testsvr1/databases/testdb") + .withSecondaryType(SecondaryType.GEO) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesDeleteSamples.java new file mode 100644 index 0000000000000..c586fb676b6a8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases Delete. */ +public final class DatabasesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/DeleteDatabase.json + */ + /** + * Sample code: Deletes a database. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().delete("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesExportSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesExportSamples.java new file mode 100644 index 0000000000000..376ac96faa19f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesExportSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ExportDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.NetworkIsolationSettings; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for Databases Export. */ +public final class DatabasesExportSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ExportDatabase.json + */ + /** + * Sample code: Exports a database. + * + * @param manager Entry point to SqlManager. + */ + public static void exportsADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .export( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ExportDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey( + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("password") + .withAuthenticationType("Sql"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ExportDatabaseWithNetworkIsolation.json + */ + /** + * Sample code: Exports a database, using private link to communicate with SQL server and storage account. + * + * @param manager Entry point to SqlManager. + */ + public static void exportsADatabaseUsingPrivateLinkToCommunicateWithSQLServerAndStorageAccount( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .export( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ExportDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey( + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("password") + .withAuthenticationType("Sql") + .withNetworkIsolation( + new NetworkIsolationSettings() + .withStorageAccountResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink") + .withSqlServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr")), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesFailoverSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesFailoverSamples.java new file mode 100644 index 0000000000000..9d73b18c11e4e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesFailoverSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; + +/** Samples for Databases Failover. */ +public final class DatabasesFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/FailoverDatabase.json + */ + /** + * Sample code: Failover an database. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAnDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().failover("group1", "testServer", "testDatabase", ReplicaType.PRIMARY, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesGetSamples.java new file mode 100644 index 0000000000000..b1e9fe858d332 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases Get. */ +public final class DatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetVCoreDatabase.json + */ + /** + * Sample code: Gets a database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesImportMethodSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesImportMethodSamples.java new file mode 100644 index 0000000000000..a9bc8f2172dfe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesImportMethodSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ImportExistingDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.NetworkIsolationSettings; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for Databases ImportMethod. */ +public final class DatabasesImportMethodSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ImportDatabase.json + */ + /** + * Sample code: Imports to an existing empty database. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToAnExistingEmptyDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .importMethod( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ImportExistingDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey( + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("password") + .withAuthenticationType("Sql"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ImportDatabaseWithNetworkIsolation.json + */ + /** + * Sample code: Imports to an existing empty database, using private link to communicate with SQL server and storage + * account. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToAnExistingEmptyDatabaseUsingPrivateLinkToCommunicateWithSQLServerAndStorageAccount( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .importMethod( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ImportExistingDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey( + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("password") + .withAuthenticationType("Sql") + .withNetworkIsolation( + new NetworkIsolationSettings() + .withStorageAccountResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink") + .withSqlServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr")), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListByElasticPoolSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListByElasticPoolSamples.java new file mode 100644 index 0000000000000..56c4d32560a92 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListByElasticPoolSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases ListByElasticPool. */ +public final class DatabasesListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListDatabasesByElasticPool.json + */ + /** + * Sample code: Gets a list of databases in an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabasesInAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listByElasticPool("Default-SQL-SouthEastAsia", "testsvr", "pool1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListByServerSamples.java new file mode 100644 index 0000000000000..a7773fca210f1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases ListByServer. */ +public final class DatabasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListVCoreDatabasesByServer.json + */ + /** + * Sample code: Gets a list of databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listByServer("Default-SQL-SouthEastAsia", "testsvr", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListInaccessibleByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListInaccessibleByServerSamples.java new file mode 100644 index 0000000000000..188260897eed3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListInaccessibleByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases ListInaccessibleByServer. */ +public final class DatabasesListInaccessibleByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListVCoreInaccessibleDatabasesByServer.json + */ + /** + * Sample code: Gets a list of inaccessible databases in a logical server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfInaccessibleDatabasesInALogicalServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listInaccessibleByServer("Default-SQL-SouthEastAsia", "testsvr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListMetricDefinitionsSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListMetricDefinitionsSamples.java new file mode 100644 index 0000000000000..35a96bba25efc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListMetricDefinitionsSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases ListMetricDefinitions. */ +public final class DatabasesListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DatabaseMetricsDefinitionsList.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listMetricDefinitions("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListMetricsSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListMetricsSamples.java new file mode 100644 index 0000000000000..7e1704253e8b0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListMetricsSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases ListMetrics. */ +public final class DatabasesListMetricsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DatabaseMetricsListWithFilter.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .listMetrics( + "sqlcrudtest-6730", + "sqlcrudtest-9007", + "3481", + "name/value eq 'cpu_percent' and timeGrain eq '00:10:00' and startTime eq '2017-06-02T18:35:00Z' and" + + " endTime eq '2017-06-02T18:55:00Z'", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesPauseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesPauseSamples.java new file mode 100644 index 0000000000000..34b9acb71990b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesPauseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases Pause. */ +public final class DatabasesPauseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/PauseDatabase.json + */ + /** + * Sample code: Pauses a database. + * + * @param manager Entry point to SqlManager. + */ + public static void pausesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().pause("Default-SQL-SouthEastAsia", "testsvr", "testdwdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesRenameSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesRenameSamples.java new file mode 100644 index 0000000000000..4c2c9f6584e71 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesRenameSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ResourceMoveDefinition; + +/** Samples for Databases Rename. */ +public final class DatabasesRenameSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/RenameDatabase.json + */ + /** + * Sample code: Renames a database. + * + * @param manager Entry point to SqlManager. + */ + public static void renamesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .renameWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ResourceMoveDefinition() + .withId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/newtestdb"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesResumeSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesResumeSamples.java new file mode 100644 index 0000000000000..56744c2797057 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesResumeSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases Resume. */ +public final class DatabasesResumeSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResumeDatabase.json + */ + /** + * Sample code: Resumes a database. + * + * @param manager Entry point to SqlManager. + */ + public static void resumesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().resume("Default-SQL-SouthEastAsia", "testsvr", "testdwdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesUpdateSamples.java new file mode 100644 index 0000000000000..f156d54a8eb06 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.Database; +import com.azure.resourcemanager.sql.generated.models.DatabaseLicenseType; +import com.azure.resourcemanager.sql.generated.models.Sku; + +/** Samples for Databases Update. */ +public final class DatabasesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/PatchVCoreDatabaseAssignMaintenanceConfiguration.json + */ + /** + * Sample code: Assigns maintenance window to a database. + * + * @param manager Entry point to SqlManager. + */ + public static void assignsMaintenanceWindowToADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen5_4")) + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/PatchVCoreDatabaseResetMaintenanceConfiguration.json + */ + /** + * Sample code: Resets maintenance window of a database to default. + * + * @param manager Entry point to SqlManager. + */ + public static void resetsMaintenanceWindowOfADatabaseToDefault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen5_4")) + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/PatchVCoreDatabase.json + */ + /** + * Sample code: Updates a database. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen4_4")) + .withMaxSizeBytes(1073741824L) + .withLicenseType(DatabaseLicenseType.LICENSE_INCLUDED) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesUpgradeDataWarehouseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesUpgradeDataWarehouseSamples.java new file mode 100644 index 0000000000000..c87a53ee72dcf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesUpgradeDataWarehouseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases UpgradeDataWarehouse. */ +public final class DatabasesUpgradeDataWarehouseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/UpgradeDataWarehouse.json + */ + /** + * Sample code: Upgrades a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void upgradesADataWarehouse(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().upgradeDataWarehouse("Default-SQL-SouthEastAsia", "testsvr", "testdwdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersGetSamples.java new file mode 100644 index 0000000000000..d3f39a0cdd1fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DeletedServers Get. */ +public final class DeletedServersGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerGet.json + */ + /** + * Sample code: Get deleted server. + * + * @param manager Entry point to SqlManager. + */ + public static void getDeletedServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().getWithResponse("japaneast", "sqlcrudtest-d-1414", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersListByLocationSamples.java new file mode 100644 index 0000000000000..ca629f3144fde --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersListByLocationSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DeletedServers ListByLocation. */ +public final class DeletedServersListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerList.json + */ + /** + * Sample code: List deleted servers. + * + * @param manager Entry point to SqlManager. + */ + public static void listDeletedServers(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().listByLocation("japaneast", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersListSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersListSamples.java new file mode 100644 index 0000000000000..b19ce9720df23 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DeletedServers List. */ +public final class DeletedServersListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerListBySubscription.json + */ + /** + * Sample code: List deleted servers in a subscription. + * + * @param manager Entry point to SqlManager. + */ + public static void listDeletedServersInASubscription(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().list(Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersRecoverSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersRecoverSamples.java new file mode 100644 index 0000000000000..99d86f09218ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersRecoverSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DeletedServers Recover. */ +public final class DeletedServersRecoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerRecover.json + */ + /** + * Sample code: Recover deleted server. + * + * @param manager Entry point to SqlManager. + */ + public static void recoverDeletedServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().recover("japaneast", "sqlcrudtest-d-1414", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e14ba332d03a0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for DistributedAvailabilityGroups CreateOrUpdate. */ +public final class DistributedAvailabilityGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsCreate.json + */ + /** + * Sample code: Create a distributed availability group. + * + * @param manager Entry point to SqlManager. + */ + public static void createADistributedAvailabilityGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .distributedAvailabilityGroups() + .define("dag") + .withExistingManagedInstance("testrg", "testcl") + .withTargetDatabase("testdb") + .withSourceEndpoint("TCP://SERVER:7022") + .withPrimaryAvailabilityGroupName("BoxLocalAg1") + .withSecondaryAvailabilityGroupName("testcl") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsDeleteSamples.java new file mode 100644 index 0000000000000..5c0eef6737c3e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DistributedAvailabilityGroups Delete. */ +public final class DistributedAvailabilityGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsDelete.json + */ + /** + * Sample code: Initiate a distributed availability group drop. + * + * @param manager Entry point to SqlManager. + */ + public static void initiateADistributedAvailabilityGroupDrop( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.distributedAvailabilityGroups().delete("testrg", "testcl", "dag", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsGetSamples.java new file mode 100644 index 0000000000000..1ac09153ce0ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DistributedAvailabilityGroups Get. */ +public final class DistributedAvailabilityGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsGet.json + */ + /** + * Sample code: Gets the distributed availability group info. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheDistributedAvailabilityGroupInfo( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.distributedAvailabilityGroups().getWithResponse("testrg", "testcl", "dag", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsListByInstanceSamples.java new file mode 100644 index 0000000000000..5e280226a1390 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsListByInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DistributedAvailabilityGroups ListByInstance. */ +public final class DistributedAvailabilityGroupsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsListByInstance.json + */ + /** + * Sample code: Lists all distributed availability groups in instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listsAllDistributedAvailabilityGroupsInInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.distributedAvailabilityGroups().listByInstance("testrg", "testcl", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsUpdateSamples.java new file mode 100644 index 0000000000000..51bfcfcbfe472 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DistributedAvailabilityGroup; +import com.azure.resourcemanager.sql.generated.models.ReplicationMode; + +/** Samples for DistributedAvailabilityGroups Update. */ +public final class DistributedAvailabilityGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsUpdate.json + */ + /** + * Sample code: Update the distributed availability group replication mode before deleting it. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheDistributedAvailabilityGroupReplicationModeBeforeDeletingIt( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DistributedAvailabilityGroup resource = + manager.distributedAvailabilityGroups().getWithResponse("testrg", "testcl", "dag", Context.NONE).getValue(); + resource.update().withReplicationMode(ReplicationMode.SYNC).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolActivitiesListByElasticPoolSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolActivitiesListByElasticPoolSamples.java new file mode 100644 index 0000000000000..f4c30a4e3bc59 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolActivitiesListByElasticPoolSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPoolActivities ListByElasticPool. */ +public final class ElasticPoolActivitiesListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ElasticPoolActivityList.json + */ + /** + * Sample code: List Elastic pool activity. + * + * @param manager Entry point to SqlManager. + */ + public static void listElasticPoolActivity(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPoolActivities().listByElasticPool("sqlcrudtest-4291", "sqlcrudtest-6574", "8749", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolDatabaseActivitiesListByElasticPoolSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolDatabaseActivitiesListByElasticPoolSamples.java new file mode 100644 index 0000000000000..8aa502901aa00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolDatabaseActivitiesListByElasticPoolSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPoolDatabaseActivities ListByElasticPool. */ +public final class ElasticPoolDatabaseActivitiesListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ElasticPoolDatabaseActivityList.json + */ + /** + * Sample code: List elastic pool database activity. + * + * @param manager Entry point to SqlManager. + */ + public static void listElasticPoolDatabaseActivity(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPoolDatabaseActivities() + .listByElasticPool("sqlcrudtest-4673", "sqlcrudtest-603", "7537", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolOperationsCancelSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolOperationsCancelSamples.java new file mode 100644 index 0000000000000..d6a105c111d28 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolOperationsCancelSamples.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.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for ElasticPoolOperations Cancel. */ +public final class ElasticPoolOperationsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelElasticPoolOperation.json + */ + /** + * Sample code: Cancel the elastic pool management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelTheElasticPoolManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPoolOperations() + .cancelWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-6661", + "testpool", + UUID.fromString("f779414b-e748-4925-8cfe-c8598f7660ae"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolOperationsListByElasticPoolSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolOperationsListByElasticPoolSamples.java new file mode 100644 index 0000000000000..5a66fd58017fb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolOperationsListByElasticPoolSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPoolOperations ListByElasticPool. */ +public final class ElasticPoolOperationsListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListElasticPoolOperations.json + */ + /** + * Sample code: List the elastic pool management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheElasticPoolManagementOperations( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPoolOperations() + .listByElasticPool("sqlcrudtestgroup", "sqlcrudtestserver", "testpool", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..4742a31b5b8ee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.ElasticPoolPerDatabaseSettings; +import com.azure.resourcemanager.sql.generated.models.Sku; + +/** Samples for ElasticPools CreateOrUpdate. */ +public final class ElasticPoolsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateMax.json + */ + /** + * Sample code: Create or update elastic pool with all parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateElasticPoolWithAllParameter( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .withSku(new Sku().withName("GP_Gen4_2").withTier("GeneralPurpose").withCapacity(2)) + .withPerDatabaseSettings(new ElasticPoolPerDatabaseSettings().withMinCapacity(0.25).withMaxCapacity(2.0)) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolCreateOrUpdateSetHighAvailabilityReplicaCount.json + */ + /** + * Sample code: Create or update Hyperscale elastic pool with high availability replica count parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateHyperscaleElasticPoolWithHighAvailabilityReplicaCountParameter( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .withSku(new Sku().withName("HS_Gen5_4")) + .withHighAvailabilityReplicaCount(2) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateSetMaintenanceConfiguration.json + */ + /** + * Sample code: Create or update elastic pool with maintenance configuration parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateElasticPoolWithMaintenanceConfigurationParameter( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_1") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateMin.json + */ + /** + * Sample code: Create or update elastic pool with minimum parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateElasticPoolWithMinimumParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsDeleteSamples.java new file mode 100644 index 0000000000000..581ed3a32ffe4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPools Delete. */ +public final class ElasticPoolsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolDelete.json + */ + /** + * Sample code: Delete an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().delete("sqlcrudtest-3129", "sqlcrudtest-228", "sqlcrudtest-3851", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsFailoverSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsFailoverSamples.java new file mode 100644 index 0000000000000..adec50298a93a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsFailoverSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPools Failover. */ +public final class ElasticPoolsFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/FailoverElasticPool.json + */ + /** + * Sample code: Failover an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().failover("group1", "testServer", "testElasticPool", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsGetSamples.java new file mode 100644 index 0000000000000..ae56788a85fbe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPools Get. */ +public final class ElasticPoolsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolGet.json + */ + /** + * Sample code: Get a Hyperscale elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getAHyperscaleElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolGet.json + */ + /** + * Sample code: Get an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListByServerSamples.java new file mode 100644 index 0000000000000..fd911d22f68c2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPools ListByServer. */ +public final class ElasticPoolsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolListByServer.json + */ + /** + * Sample code: Get all elastic pools in a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllElasticPoolsInAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().listByServer("sqlcrudtest-2369", "sqlcrudtest-8069", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListMetricDefinitionsSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListMetricDefinitionsSamples.java new file mode 100644 index 0000000000000..106dc48759c12 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListMetricDefinitionsSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPools ListMetricDefinitions. */ +public final class ElasticPoolsListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ElasticPoolMetricsDefinitionsList.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().listMetricDefinitions("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListMetricsSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListMetricsSamples.java new file mode 100644 index 0000000000000..55efe17882d43 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListMetricsSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPools ListMetrics. */ +public final class ElasticPoolsListMetricsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ElasticPoolMetricsListWithFilter.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .listMetrics( + "sqlcrudtest-6730", + "sqlcrudtest-9007", + "3481", + "name/value eq 'cpu_percent' and timeGrain eq '00:10:00' and startTime eq '2017-06-02T18:35:00Z' and" + + " endTime eq '2017-06-02T18:55:00Z'", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsUpdateSamples.java new file mode 100644 index 0000000000000..f9454264d3528 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsUpdateSamples.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.generated; + +import com.azure.core.util.Context; +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.Sku; + +/** Samples for ElasticPools Update. */ +public final class ElasticPoolsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateMax.json + */ + /** + * Sample code: Update an elastic pool with all parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnElasticPoolWithAllParameter(com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen4").withTier("BusinessCritical").withCapacity(2)) + .withPerDatabaseSettings(new ElasticPoolPerDatabaseSettings().withMinCapacity(0.25).withMaxCapacity(1.0)) + .withZoneRedundant(true) + .withLicenseType(ElasticPoolLicenseType.LICENSE_INCLUDED) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolUpdateSetHighAvailabilityReplicaCount.json + */ + /** + * Sample code: Update high availability replica count of a Hyperscale elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void updateHighAvailabilityReplicaCountOfAHyperscaleElasticPool( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource.update().withHighAvailabilityReplicaCount(2).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateMin.json + */ + /** + * Sample code: Update an elastic pool with minimum parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnElasticPoolWithMinimumParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource.update().apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateAssignMaintenanceConfiguration.json + */ + /** + * Sample code: Assigns maintenance configuration to an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void assignsMaintenanceConfigurationToAnElasticPool( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_1") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateResetMaintenanceConfiguration.json + */ + /** + * Sample code: Resets maintenance configuration of an elastic pool to default. + * + * @param manager Entry point to SqlManager. + */ + public static void resetsMaintenanceConfigurationOfAnElasticPoolToDefault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default") + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..535e5b3d6c1b4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtector; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for EncryptionProtectors CreateOrUpdate. */ +public final class EncryptionProtectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorCreateOrUpdateKeyVault.json + */ + /** + * Sample code: Update the encryption protector to key vault. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToKeyVault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + EncryptionProtector resource = + manager + .encryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource + .update() + .withServerKeyName("someVault_someKey_01234567890123456789012345678901") + .withAutoRotationEnabled(false) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorCreateOrUpdateServiceManaged.json + */ + /** + * Sample code: Update the encryption protector to service managed. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToServiceManaged( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + EncryptionProtector resource = + manager + .encryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource.update().withServerKeyName("ServiceManaged").apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsGetSamples.java new file mode 100644 index 0000000000000..3d4ad0cb22d22 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for EncryptionProtectors Get. */ +public final class EncryptionProtectorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorGet.json + */ + /** + * Sample code: Get the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .encryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsListByServerSamples.java new file mode 100644 index 0000000000000..49e2dc3c033c7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for EncryptionProtectors ListByServer. */ +public final class EncryptionProtectorsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorList.json + */ + /** + * Sample code: List encryption protectors by server. + * + * @param manager Entry point to SqlManager. + */ + public static void listEncryptionProtectorsByServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.encryptionProtectors().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsRevalidateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsRevalidateSamples.java new file mode 100644 index 0000000000000..7ef6356bc9a67 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsRevalidateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for EncryptionProtectors Revalidate. */ +public final class EncryptionProtectorsRevalidateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorRevalidate.json + */ + /** + * Sample code: Revalidates the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void revalidatesTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .encryptionProtectors() + .revalidate("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EndpointCertificatesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EndpointCertificatesGetSamples.java new file mode 100644 index 0000000000000..163493b8b7f1b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EndpointCertificatesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for EndpointCertificates Get. */ +public final class EndpointCertificatesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/EndpointCertificatesGet.json + */ + /** + * Sample code: Gets an endpoint certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAnEndpointCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.endpointCertificates().getWithResponse("testrg", "testcl", "DATABASE_MIRRORING", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EndpointCertificatesListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EndpointCertificatesListByInstanceSamples.java new file mode 100644 index 0000000000000..cbd60bb21aaae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EndpointCertificatesListByInstanceSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for EndpointCertificates ListByInstance. */ +public final class EndpointCertificatesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/EndpointCertificatesListByInstance.json + */ + /** + * Sample code: Get a list of endpoint certificates. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfEndpointCertificates(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.endpointCertificates().listByInstance("testrg", "testcl", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..480fe822c75a0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for ExtendedDatabaseBlobAuditingPolicies CreateOrUpdate. */ +public final class ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingCreateMin.json + */ + /** + * Sample code: Create or update an extended database's blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAnExtendedDatabaseSBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingCreateMax.json + */ + /** + * Sample code: Create or update an extended database's blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAnExtendedDatabaseSBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withPredicateExpression("statement = 'select 1'") + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "DATABASE_LOGOUT_GROUP", + "DATABASE_ROLE_MEMBER_CHANGE_GROUP", + "UPDATE on database::TestDatabaseName by public")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseAzureMonitorAuditingCreateMin.json + */ + /** + * Sample code: Create or update an extended database's azure monitor auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAnExtendedDatabaseSAzureMonitorAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withIsAzureMonitorTargetEnabled(true) + .withState(BlobAuditingPolicyState.ENABLED) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesGetSamples.java new file mode 100644 index 0000000000000..e5c73ee59a1f2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ExtendedDatabaseBlobAuditingPolicies Get. */ +public final class ExtendedDatabaseBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingGet.json + */ + /** + * Sample code: Get an extended database's blob auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAnExtendedDatabaseSBlobAuditingPolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .getWithResponse("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..476d541cdf5c1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ExtendedDatabaseBlobAuditingPolicies ListByDatabase. */ +public final class ExtendedDatabaseBlobAuditingPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseExtendedAuditingSettingsList.json + */ + /** + * Sample code: List extended auditing settings of a database. + * + * @param manager Entry point to SqlManager. + */ + public static void listExtendedAuditingSettingsOfADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .listByDatabase("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..3bb8377873fd5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ExtendedServerBlobAuditingPolicy; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for ExtendedServerBlobAuditingPolicies CreateOrUpdate. */ +public final class ExtendedServerBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingCreateMin.json + */ + /** + * Sample code: Update a server's extended blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSExtendedBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ExtendedServerBlobAuditingPolicy resource = + manager + .extendedServerBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingCreateMax.json + */ + /** + * Sample code: Update a server's extended blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSExtendedBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ExtendedServerBlobAuditingPolicy resource = + manager + .extendedServerBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withPredicateExpression("object_name = 'SensitiveData'") + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP", + "FAILED_DATABASE_AUTHENTICATION_GROUP", + "BATCH_COMPLETED_GROUP")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesGetSamples.java new file mode 100644 index 0000000000000..5812362cb9780 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ExtendedServerBlobAuditingPolicies Get. */ +public final class ExtendedServerBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingGet.json + */ + /** + * Sample code: Get a server's blob extended auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSBlobExtendedAuditingPolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedServerBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesListByServerSamples.java new file mode 100644 index 0000000000000..e5af949d97391 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesListByServerSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ExtendedServerBlobAuditingPolicies ListByServer. */ +public final class ExtendedServerBlobAuditingPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerExtendedAuditingSettingsList.json + */ + /** + * Sample code: List extended auditing settings of a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listExtendedAuditingSettingsOfAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedServerBlobAuditingPolicies() + .listByServer("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..2db34fc2d29db --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsCreateOrUpdateSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.PartnerInfo; +import com.azure.resourcemanager.sql.generated.models.ReadOnlyEndpointFailoverPolicy; +import com.azure.resourcemanager.sql.generated.models.ReadWriteEndpointFailoverPolicy; +import java.util.Arrays; + +/** Samples for FailoverGroups CreateOrUpdate. */ +public final class FailoverGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupCreateOrUpdate.json + */ + /** + * Sample code: Create failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void createFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .define("failover-group-test-3") + .withExistingServer("Default", "failover-group-primary-server") + .withReadWriteEndpoint( + new FailoverGroupReadWriteEndpoint() + .withFailoverPolicy(ReadWriteEndpointFailoverPolicy.AUTOMATIC) + .withFailoverWithDataLossGracePeriodMinutes(480)) + .withReadOnlyEndpoint( + new FailoverGroupReadOnlyEndpoint().withFailoverPolicy(ReadOnlyEndpointFailoverPolicy.DISABLED)) + .withPartnerServers( + Arrays + .asList( + new PartnerInfo() + .withId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server"))) + .withDatabases( + Arrays + .asList( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-1", + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-2")) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsDeleteSamples.java new file mode 100644 index 0000000000000..dbe2319f5eb95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsDeleteSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for FailoverGroups Delete. */ +public final class FailoverGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupDelete.json + */ + /** + * Sample code: Delete failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .delete("Default", "failover-group-primary-server", "failover-group-test-1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsFailoverSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsFailoverSamples.java new file mode 100644 index 0000000000000..2911cdb83ba62 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsFailoverSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for FailoverGroups Failover. */ +public final class FailoverGroupsFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupFailover.json + */ + /** + * Sample code: Planned failover of a failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void plannedFailoverOfAFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .failover("Default", "failover-group-secondary-server", "failover-group-test-3", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsForceFailoverAllowDataLossSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsForceFailoverAllowDataLossSamples.java new file mode 100644 index 0000000000000..fdc7247ca537a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsForceFailoverAllowDataLossSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for FailoverGroups ForceFailoverAllowDataLoss. */ +public final class FailoverGroupsForceFailoverAllowDataLossSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupForceFailoverAllowDataLoss.json + */ + /** + * Sample code: Forced failover of a failover group allowing data loss. + * + * @param manager Entry point to SqlManager. + */ + public static void forcedFailoverOfAFailoverGroupAllowingDataLoss( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .forceFailoverAllowDataLoss( + "Default", "failover-group-secondary-server", "failover-group-test-3", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsGetSamples.java new file mode 100644 index 0000000000000..c8de0a8ef503a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for FailoverGroups Get. */ +public final class FailoverGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupGet.json + */ + /** + * Sample code: Get failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void getFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .getWithResponse("Default", "failover-group-primary-server", "failover-group-test", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsListByServerSamples.java new file mode 100644 index 0000000000000..94a74f0a32e3f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for FailoverGroups ListByServer. */ +public final class FailoverGroupsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupList.json + */ + /** + * Sample code: List failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void listFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.failoverGroups().listByServer("Default", "failover-group-primary-server", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsUpdateSamples.java new file mode 100644 index 0000000000000..0991b66489e9f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.FailoverGroup; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.ReadWriteEndpointFailoverPolicy; +import java.util.Arrays; + +/** Samples for FailoverGroups Update. */ +public final class FailoverGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupUpdate.json + */ + /** + * Sample code: Update failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void updateFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + FailoverGroup resource = + manager + .failoverGroups() + .getWithResponse("Default", "failover-group-primary-server", "failover-group-test-1", Context.NONE) + .getValue(); + resource + .update() + .withReadWriteEndpoint( + new FailoverGroupReadWriteEndpoint() + .withFailoverPolicy(ReadWriteEndpointFailoverPolicy.AUTOMATIC) + .withFailoverWithDataLossGracePeriodMinutes(120)) + .withDatabases( + Arrays + .asList( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-1")) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..366302d981f61 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.FirewallRule; + +/** Samples for FirewallRules CreateOrUpdate. */ +public final class FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleCreate.json + */ + /** + * Sample code: Create a firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void createAFirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .define("firewallrulecrudtest-5370") + .withExistingServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285") + .withStartIpAddress("0.0.0.3") + .withEndIpAddress("0.0.0.3") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleUpdate.json + */ + /** + * Sample code: Update a firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAFirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + FirewallRule resource = + manager + .firewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-3927", Context.NONE) + .getValue(); + resource.update().withStartIpAddress("0.0.0.1").withEndIpAddress("0.0.0.1").apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesDeleteSamples.java new file mode 100644 index 0000000000000..b46239207f219 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallRules Delete. */ +public final class FirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleDelete.json + */ + /** + * Sample code: Delete a firewall rule. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAFirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .deleteWithResponse( + "firewallrulecrudtest-9886", "firewallrulecrudtest-2368", "firewallrulecrudtest-7011", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesGetSamples.java new file mode 100644 index 0000000000000..9e6c2a79ec1df --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallRules Get. */ +public final class FirewallRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleGet.json + */ + /** + * Sample code: Get Firewall Rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getFirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-2304", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesListByServerSamples.java new file mode 100644 index 0000000000000..3614501ace53b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallRules ListByServer. */ +public final class FirewallRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleList.json + */ + /** + * Sample code: List Firewall Rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listFirewallRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.firewallRules().listByServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesReplaceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesReplaceSamples.java new file mode 100644 index 0000000000000..8cca0b2c71695 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesReplaceSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.FirewallRuleList; +import java.util.Arrays; + +/** Samples for FirewallRules Replace. */ +public final class FirewallRulesReplaceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleReplace.json + */ + /** + * Sample code: Replace firewall rules. + * + * @param manager Entry point to SqlManager. + */ + public static void replaceFirewallRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .replaceWithResponse( + "firewallrulecrudtest-12", + "firewallrulecrudtest-6285", + new FirewallRuleList() + .withValues( + Arrays + .asList( + new FirewallRuleInner() + .withName("firewallrulecrudtest-5370 ") + .withStartIpAddress("0.0.0.0") + .withEndIpAddress("100.0.0.0"))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8017649451015 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicy; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyState; + +/** Samples for GeoBackupPolicies CreateOrUpdate. */ +public final class GeoBackupPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesCreateOrUpdate.json + */ + /** + * Sample code: Update geo backup policy. + * + * @param manager Entry point to SqlManager. + */ + public static void updateGeoBackupPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + GeoBackupPolicy resource = + manager + .geoBackupPolicies() + .getWithResponse( + "sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", GeoBackupPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(GeoBackupPolicyState.ENABLED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesGetSamples.java new file mode 100644 index 0000000000000..0729082f6bb60 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; + +/** Samples for GeoBackupPolicies Get. */ +public final class GeoBackupPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesGet.json + */ + /** + * Sample code: Get geo backup policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getGeoBackupPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .geoBackupPolicies() + .getWithResponse( + "sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", GeoBackupPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..20ed3505e556d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesListByDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GeoBackupPolicies ListByDatabase. */ +public final class GeoBackupPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesList.json + */ + /** + * Sample code: List geo backup policies. + * + * @param manager Entry point to SqlManager. + */ + public static void listGeoBackupPolicies(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.geoBackupPolicies().listByDatabase("sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..90411aa8124e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.IPv6FirewallRule; + +/** Samples for IPv6FirewallRules CreateOrUpdate. */ +public final class IPv6FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleCreate.json + */ + /** + * Sample code: Create an IPv6 firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void createAnIPv6FirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .iPv6FirewallRules() + .define("firewallrulecrudtest-5370") + .withExistingServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285") + .withStartIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0003") + .withEndIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0003") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleUpdate.json + */ + /** + * Sample code: Update an IPv6 firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnIPv6FirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + IPv6FirewallRule resource = + manager + .iPv6FirewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-3927", Context.NONE) + .getValue(); + resource + .update() + .withStartIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0001") + .withEndIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0001") + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesDeleteSamples.java new file mode 100644 index 0000000000000..ddaeefa5252bf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for IPv6FirewallRules Delete. */ +public final class IPv6FirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleDelete.json + */ + /** + * Sample code: Delete an IPv6 firewall rule. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAnIPv6FirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .iPv6FirewallRules() + .deleteWithResponse( + "firewallrulecrudtest-9886", "firewallrulecrudtest-2368", "firewallrulecrudtest-7011", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesGetSamples.java new file mode 100644 index 0000000000000..97c1b4b5ba845 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for IPv6FirewallRules Get. */ +public final class IPv6FirewallRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleGet.json + */ + /** + * Sample code: Get IPv6 Firewall Rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getIPv6FirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .iPv6FirewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-2304", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesListByServerSamples.java new file mode 100644 index 0000000000000..098cbb5d7bfd7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for IPv6FirewallRules ListByServer. */ +public final class IPv6FirewallRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleList.json + */ + /** + * Sample code: List IPv6 Firewall Rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listIPv6FirewallRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.iPv6FirewallRules().listByServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ee3350ca8aca4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePairInfo; +import com.azure.resourcemanager.sql.generated.models.PartnerRegionInfo; +import com.azure.resourcemanager.sql.generated.models.ReadOnlyEndpointFailoverPolicy; +import com.azure.resourcemanager.sql.generated.models.ReadWriteEndpointFailoverPolicy; +import java.util.Arrays; + +/** Samples for InstanceFailoverGroups CreateOrUpdate. */ +public final class InstanceFailoverGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupCreateOrUpdate.json + */ + /** + * Sample code: Create failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void createFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instanceFailoverGroups() + .define("failover-group-test-3") + .withExistingLocation("Default", "Japan East") + .withReadWriteEndpoint( + new InstanceFailoverGroupReadWriteEndpoint() + .withFailoverPolicy(ReadWriteEndpointFailoverPolicy.AUTOMATIC) + .withFailoverWithDataLossGracePeriodMinutes(480)) + .withReadOnlyEndpoint( + new InstanceFailoverGroupReadOnlyEndpoint().withFailoverPolicy(ReadOnlyEndpointFailoverPolicy.DISABLED)) + .withPartnerRegions(Arrays.asList(new PartnerRegionInfo().withLocation("Japan West"))) + .withManagedInstancePairs( + Arrays + .asList( + new ManagedInstancePairInfo() + .withPrimaryManagedInstanceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance") + .withPartnerManagedInstanceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance"))) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsDeleteSamples.java new file mode 100644 index 0000000000000..ced7f9cf81189 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups Delete. */ +public final class InstanceFailoverGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupDelete.json + */ + /** + * Sample code: Delete failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().delete("Default", "Japan East", "failover-group-test-1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsFailoverSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsFailoverSamples.java new file mode 100644 index 0000000000000..da12d292bd1be --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsFailoverSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups Failover. */ +public final class InstanceFailoverGroupsFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupFailover.json + */ + /** + * Sample code: Planned failover of a failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void plannedFailoverOfAFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().failover("Default", "Japan West", "failover-group-test-3", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsForceFailoverAllowDataLossSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsForceFailoverAllowDataLossSamples.java new file mode 100644 index 0000000000000..81310247c0352 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsForceFailoverAllowDataLossSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups ForceFailoverAllowDataLoss. */ +public final class InstanceFailoverGroupsForceFailoverAllowDataLossSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupForceFailoverAllowDataLoss.json + */ + /** + * Sample code: Forced failover of a failover group allowing data loss. + * + * @param manager Entry point to SqlManager. + */ + public static void forcedFailoverOfAFailoverGroupAllowingDataLoss( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instanceFailoverGroups() + .forceFailoverAllowDataLoss("Default", "Japan West", "failover-group-test-3", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsGetSamples.java new file mode 100644 index 0000000000000..1cdc47e76c34a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups Get. */ +public final class InstanceFailoverGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupGet.json + */ + /** + * Sample code: Get failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void getFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().getWithResponse("Default", "Japan East", "failover-group-test", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsListByLocationSamples.java new file mode 100644 index 0000000000000..8db3930f7f496 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsListByLocationSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups ListByLocation. */ +public final class InstanceFailoverGroupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupList.json + */ + /** + * Sample code: List failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void listFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().listByLocation("Default", "Japan East", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..a694b09bab109 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.InstancePoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; + +/** Samples for InstancePools CreateOrUpdate. */ +public final class InstancePoolsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateInstancePoolMax.json + */ + /** + * Sample code: Create an instance pool with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createAnInstancePoolWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instancePools() + .define("testIP") + .withRegion("japaneast") + .withExistingResourceGroup("group1") + .withTags(mapOf("a", "b")) + .withSku(new Sku().withName("GP_Gen5").withTier("GeneralPurpose").withFamily("Gen5")) + .withSubnetId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet1") + .withVCores(8) + .withLicenseType(InstancePoolLicenseType.LICENSE_INCLUDED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateInstancePoolMin.json + */ + /** + * Sample code: Create an instance pool with min properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createAnInstancePoolWithMinProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instancePools() + .define("testIP") + .withRegion("japaneast") + .withExistingResourceGroup("group1") + .withSku(new Sku().withName("GP_Gen5").withTier("GeneralPurpose").withFamily("Gen5")) + .withSubnetId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet1") + .withVCores(8) + .withLicenseType(InstancePoolLicenseType.LICENSE_INCLUDED) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsDeleteSamples.java new file mode 100644 index 0000000000000..1467554225ff2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstancePools Delete. */ +public final class InstancePoolsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteInstancePool.json + */ + /** + * Sample code: Delete an instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAnInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().delete("group1", "testIP", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsGetByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..f48091038e9a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstancePools GetByResourceGroup. */ +public final class InstancePoolsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetInstancePool.json + */ + /** + * Sample code: Get an instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getAnInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().getByResourceGroupWithResponse("group1", "testIP", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsListByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..11a657b1fe7fd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstancePools ListByResourceGroup. */ +public final class InstancePoolsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListInstancePoolsByResourceGroup.json + */ + /** + * Sample code: List instance pools by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolsByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().listByResourceGroup("group1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsListSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsListSamples.java new file mode 100644 index 0000000000000..fbe55c728d9f5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstancePools List. */ +public final class InstancePoolsListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListInstancePoolsBySubscriptionId.json + */ + /** + * Sample code: List instance pools in the subscription. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolsInTheSubscription(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().list(Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsUpdateSamples.java new file mode 100644 index 0000000000000..05b7d4d318661 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.InstancePool; +import java.util.HashMap; +import java.util.Map; + +/** Samples for InstancePools Update. */ +public final class InstancePoolsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PatchInstancePool.json + */ + /** + * Sample code: Patch an instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void patchAnInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + InstancePool resource = + manager.instancePools().getByResourceGroupWithResponse("group1", "testIP", Context.NONE).getValue(); + resource.update().withTags(mapOf("x", "y")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d7d7e0d90b764 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsCreateOrUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for JobAgents CreateOrUpdate. */ +public final class JobAgentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobAgent.json + */ + /** + * Sample code: Create or update a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobAgents() + .define("agent1") + .withRegion("southeastasia") + .withExistingServer("group1", "server1") + .withDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsDeleteSamples.java new file mode 100644 index 0000000000000..645738302f022 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobAgents Delete. */ +public final class JobAgentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobAgent.json + */ + /** + * Sample code: Delete a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobAgents().delete("group1", "server1", "agent1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsGetSamples.java new file mode 100644 index 0000000000000..ce387d3f55944 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobAgents Get. */ +public final class JobAgentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobAgent.json + */ + /** + * Sample code: Get a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobAgents().getWithResponse("group1", "server1", "agent1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsListByServerSamples.java new file mode 100644 index 0000000000000..04bdfdd0494de --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobAgents ListByServer. */ +public final class JobAgentsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobAgentsByServer.json + */ + /** + * Sample code: List job agents in a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobAgentsInAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobAgents().listByServer("group1", "server1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsUpdateSamples.java new file mode 100644 index 0000000000000..2a4c32a047571 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.JobAgent; +import java.util.HashMap; +import java.util.Map; + +/** Samples for JobAgents Update. */ +public final class JobAgentsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateJobAgent.json + */ + /** + * Sample code: Update a job agent's tags. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAJobAgentSTags(com.azure.resourcemanager.sql.generated.SqlManager manager) { + JobAgent resource = manager.jobAgents().getWithResponse("group1", "server1", "agent1", Context.NONE).getValue(); + resource.update().withTags(mapOf("mytag1", "myvalue1")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e6239c82de05d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsCreateOrUpdateSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for JobCredentials CreateOrUpdate. */ +public final class JobCredentialsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobCredential.json + */ + /** + * Sample code: Create or update a credential. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateACredential(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobCredentials() + .define("cred1") + .withExistingJobAgent("group1", "server1", "agent1") + .withUsername("myuser") + .withPassword("") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsDeleteSamples.java new file mode 100644 index 0000000000000..8f096d7447104 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobCredentials Delete. */ +public final class JobCredentialsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobCredential.json + */ + /** + * Sample code: Delete a credential. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteACredential(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobCredentials().deleteWithResponse("group1", "server1", "agent1", "cred1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsGetSamples.java new file mode 100644 index 0000000000000..b5290cb61fc4c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobCredentials Get. */ +public final class JobCredentialsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobCredential.json + */ + /** + * Sample code: Get a credential. + * + * @param manager Entry point to SqlManager. + */ + public static void getACredential(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobCredentials().getWithResponse("group1", "server1", "agent1", "cred1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsListByAgentSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsListByAgentSamples.java new file mode 100644 index 0000000000000..a080178ddbb73 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsListByAgentSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobCredentials ListByAgent. */ +public final class JobCredentialsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobCredentialsByAgent.json + */ + /** + * Sample code: List credentials in a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void listCredentialsInAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobCredentials().listByAgent("group1", "server1", "agent1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCancelSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCancelSamples.java new file mode 100644 index 0000000000000..be769fadd4535 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCancelSamples.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.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobExecutions Cancel. */ +public final class JobExecutionsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelJobExecution.json + */ + /** + * Sample code: Cancel a job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelAJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .cancelWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e2c57050b898f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobExecutions CreateOrUpdate. */ +public final class JobExecutionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobExecution.json + */ + /** + * Sample code: Create job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void createJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .createOrUpdate( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCreateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCreateSamples.java new file mode 100644 index 0000000000000..109a54272556c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCreateSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobExecutions Create. */ +public final class JobExecutionsCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateJobExecution.json + */ + /** + * Sample code: Start a job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void startAJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobExecutions().create("group1", "server1", "agent1", "job1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsGetSamples.java new file mode 100644 index 0000000000000..3704d059bd24e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsGetSamples.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.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobExecutions Get. */ +public final class JobExecutionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecution.json + */ + /** + * Sample code: Get a job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .getWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsListByAgentSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsListByAgentSamples.java new file mode 100644 index 0000000000000..9facde6e8a3ac --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsListByAgentSamples.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.generated; + +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Samples for JobExecutions ListByAgent. */ +public final class JobExecutionsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByAgent.json + */ + /** + * Sample code: List all job executions in a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void listAllJobExecutionsInAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .listByAgent("group1", "server1", "agent1", null, null, null, null, null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByAgentWithFilter.json + */ + /** + * Sample code: List all job executions in a job agent with filtering. + * + * @param manager Entry point to SqlManager. + */ + public static void listAllJobExecutionsInAJobAgentWithFiltering( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .listByAgent( + "group1", + "server1", + "agent1", + OffsetDateTime.parse("2017-03-21T19:00:00Z"), + OffsetDateTime.parse("2017-03-21T19:05:00Z"), + OffsetDateTime.parse("2017-03-21T19:20:00Z"), + OffsetDateTime.parse("2017-03-21T19:25:00Z"), + false, + null, + null, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsListByJobSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsListByJobSamples.java new file mode 100644 index 0000000000000..6f22cc761a2eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsListByJobSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for JobExecutions ListByJob. */ +public final class JobExecutionsListByJobSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByJob.json + */ + /** + * Sample code: List a job's executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listAJobSExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .listByJob("group1", "server1", "agent1", "job1", null, null, null, null, null, null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepExecutionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepExecutionsGetSamples.java new file mode 100644 index 0000000000000..118c0c3336414 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepExecutionsGetSamples.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.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobStepExecutions Get. */ +public final class JobStepExecutionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecutionStep.json + */ + /** + * Sample code: Get a job step execution. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobStepExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobStepExecutions() + .getWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + "step1", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepExecutionsListByJobExecutionSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepExecutionsListByJobExecutionSamples.java new file mode 100644 index 0000000000000..c5f09e7cf8fc8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepExecutionsListByJobExecutionSamples.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.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobStepExecutions ListByJobExecution. */ +public final class JobStepExecutionsListByJobExecutionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionSteps.json + */ + /** + * Sample code: List job step executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobStepExecutions() + .listByJobExecution( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..f9f164f6ee6fb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.JobStepAction; +import com.azure.resourcemanager.sql.generated.models.JobStepActionSource; +import com.azure.resourcemanager.sql.generated.models.JobStepActionType; +import com.azure.resourcemanager.sql.generated.models.JobStepExecutionOptions; +import com.azure.resourcemanager.sql.generated.models.JobStepOutput; +import com.azure.resourcemanager.sql.generated.models.JobStepOutputType; +import java.util.UUID; + +/** Samples for JobSteps CreateOrUpdate. */ +public final class JobStepsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobStepMin.json + */ + /** + * Sample code: Create or update a job step with minimal properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAJobStepWithMinimalPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobSteps() + .define("step1") + .withExistingJob("group1", "server1", "agent1", "job1") + .withTargetGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup0") + .withCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0") + .withAction(new JobStepAction().withValue("select 1")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobStepMax.json + */ + /** + * Sample code: Create or update a job step with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAJobStepWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobSteps() + .define("step1") + .withExistingJob("group1", "server1", "agent1", "job1") + .withStepId(1) + .withTargetGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1") + .withCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1") + .withAction( + new JobStepAction() + .withType(JobStepActionType.TSQL) + .withSource(JobStepActionSource.INLINE) + .withValue("select 2")) + .withOutput( + new JobStepOutput() + .withType(JobStepOutputType.SQL_DATABASE) + .withSubscriptionId(UUID.fromString("3501b905-a848-4b5d-96e8-b253f62d735a")) + .withResourceGroupName("group3") + .withServerName("server3") + .withDatabaseName("database3") + .withSchemaName("myschema1234") + .withTableName("mytable5678") + .withCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0")) + .withExecutionOptions( + new JobStepExecutionOptions() + .withTimeoutSeconds(1234) + .withRetryAttempts(42) + .withInitialRetryIntervalSeconds(11) + .withMaximumRetryIntervalSeconds(222) + .withRetryIntervalBackoffMultiplier(3.0f)) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsDeleteSamples.java new file mode 100644 index 0000000000000..3af13e8fc00e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobSteps Delete. */ +public final class JobStepsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobStep.json + */ + /** + * Sample code: Delete a job step. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAJobStep(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().deleteWithResponse("group1", "server1", "agent1", "job1", "step1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsGetByVersionSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsGetByVersionSamples.java new file mode 100644 index 0000000000000..58a8b7c7c98a3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsGetByVersionSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobSteps GetByVersion. */ +public final class JobStepsGetByVersionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobStepByVersion.json + */ + /** + * Sample code: Get the specified version of a job step. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheSpecifiedVersionOfAJobStep(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().getByVersionWithResponse("group1", "server1", "agent1", "job1", 1, "step1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsGetSamples.java new file mode 100644 index 0000000000000..8b2ed8d6b1f03 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobSteps Get. */ +public final class JobStepsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobStepByJob.json + */ + /** + * Sample code: Get the latest version of a job step. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLatestVersionOfAJobStep(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().getWithResponse("group1", "server1", "agent1", "job1", "step1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsListByJobSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsListByJobSamples.java new file mode 100644 index 0000000000000..a6b9c6960969d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsListByJobSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobSteps ListByJob. */ +public final class JobStepsListByJobSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobStepsByJob.json + */ + /** + * Sample code: List job steps for the latest version of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepsForTheLatestVersionOfAJob( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().listByJob("group1", "server1", "agent1", "job1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsListByVersionSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsListByVersionSamples.java new file mode 100644 index 0000000000000..60ecdd7e49775 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsListByVersionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobSteps ListByVersion. */ +public final class JobStepsListByVersionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobStepsByVersion.json + */ + /** + * Sample code: List job steps for the specified version of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepsForTheSpecifiedVersionOfAJob( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().listByVersion("group1", "server1", "agent1", "job1", 1, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsGetSamples.java new file mode 100644 index 0000000000000..5d7b8ed7f9b37 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsGetSamples.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.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobTargetExecutions Get. */ +public final class JobTargetExecutionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecutionTarget.json + */ + /** + * Sample code: Get a job step target execution. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobStepTargetExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetExecutions() + .getWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + "step1", + UUID.fromString("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsListByJobExecutionSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsListByJobExecutionSamples.java new file mode 100644 index 0000000000000..cb3ebebe64223 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsListByJobExecutionSamples.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.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobTargetExecutions ListByJobExecution. */ +public final class JobTargetExecutionsListByJobExecutionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionTargetsByExecution.json + */ + /** + * Sample code: List job step target executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepTargetExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetExecutions() + .listByJobExecution( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsListByStepSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsListByStepSamples.java new file mode 100644 index 0000000000000..f00c6b0914718 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsListByStepSamples.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.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobTargetExecutions ListByStep. */ +public final class JobTargetExecutionsListByStepSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionTargetsByStep.json + */ + /** + * Sample code: List job step target executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepTargetExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetExecutions() + .listByStep( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + "step1", + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d3dbb30bd26b3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.JobTarget; +import com.azure.resourcemanager.sql.generated.models.JobTargetGroupMembershipType; +import com.azure.resourcemanager.sql.generated.models.JobTargetType; +import java.util.Arrays; + +/** Samples for JobTargetGroups CreateOrUpdate. */ +public final class JobTargetGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobTargetGroupMin.json + */ + /** + * Sample code: Create or update a target group with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateATargetGroupWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetGroups() + .define("targetGroup1") + .withExistingJobAgent("group1", "server1", "agent1") + .withMembers(Arrays.asList()) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobTargetGroupMax.json + */ + /** + * Sample code: Create or update a target group with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateATargetGroupWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetGroups() + .define("targetGroup1") + .withExistingJobAgent("group1", "server1", "agent1") + .withMembers( + Arrays + .asList( + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.EXCLUDE) + .withType(JobTargetType.SQL_DATABASE) + .withServerName("server1") + .withDatabaseName("database1"), + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.INCLUDE) + .withType(JobTargetType.SQL_SERVER) + .withServerName("server1") + .withRefreshCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.INCLUDE) + .withType(JobTargetType.SQL_ELASTIC_POOL) + .withServerName("server2") + .withElasticPoolName("pool1") + .withRefreshCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"), + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.INCLUDE) + .withType(JobTargetType.SQL_SHARD_MAP) + .withServerName("server3") + .withShardMapName("shardMap1") + .withRefreshCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/testCredential"))) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsDeleteSamples.java new file mode 100644 index 0000000000000..7ec741d9669d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobTargetGroups Delete. */ +public final class JobTargetGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobTargetGroup.json + */ + /** + * Sample code: Delete a target group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteATargetGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobTargetGroups().deleteWithResponse("group1", "server1", "agent1", "targetGroup1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsGetSamples.java new file mode 100644 index 0000000000000..a1444623012b1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobTargetGroups Get. */ +public final class JobTargetGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobTargetGroup.json + */ + /** + * Sample code: Get a target group. + * + * @param manager Entry point to SqlManager. + */ + public static void getATargetGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobTargetGroups().getWithResponse("group1", "server1", "agent1", "targetGroup1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsListByAgentSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsListByAgentSamples.java new file mode 100644 index 0000000000000..e124ccfb615dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsListByAgentSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobTargetGroups ListByAgent. */ +public final class JobTargetGroupsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobTargetGroups.json + */ + /** + * Sample code: Get all target groups in an agent. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllTargetGroupsInAnAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobTargetGroups().listByAgent("group1", "server1", "agent1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobVersionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobVersionsGetSamples.java new file mode 100644 index 0000000000000..11b638b1ce6ec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobVersionsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobVersions Get. */ +public final class JobVersionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobVersion.json + */ + /** + * Sample code: Get a version of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void getAVersionOfAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobVersions().getWithResponse("group1", "server1", "agent1", "job1", 1, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobVersionsListByJobSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobVersionsListByJobSamples.java new file mode 100644 index 0000000000000..5ebb07ccbe1e7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobVersionsListByJobSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobVersions ListByJob. */ +public final class JobVersionsListByJobSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobVersions.json + */ + /** + * Sample code: Get all versions of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllVersionsOfAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobVersions().listByJob("group1", "server1", "agent1", "job1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..234b2d0a25337 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.JobSchedule; +import com.azure.resourcemanager.sql.generated.models.JobScheduleType; +import java.time.OffsetDateTime; + +/** Samples for Jobs CreateOrUpdate. */ +public final class JobsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobMin.json + */ + /** + * Sample code: Create a job with default properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createAJobWithDefaultProperties(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().define("job1").withExistingJobAgent("group1", "server1", "agent1").create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobMax.json + */ + /** + * Sample code: Create a job with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAJobWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobs() + .define("job1") + .withExistingJobAgent("group1", "server1", "agent1") + .withDescription("my favourite job") + .withSchedule( + new JobSchedule() + .withStartTime(OffsetDateTime.parse("2015-09-24T18:30:01Z")) + .withEndTime(OffsetDateTime.parse("2015-09-24T23:59:59Z")) + .withType(JobScheduleType.RECURRING) + .withEnabled(true) + .withInterval("PT5M")) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsDeleteSamples.java new file mode 100644 index 0000000000000..cb7a43be56337 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Jobs Delete. */ +public final class JobsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJob.json + */ + /** + * Sample code: Delete a job. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().deleteWithResponse("group1", "server1", "agent1", "job1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsGetSamples.java new file mode 100644 index 0000000000000..ee2f2bac96559 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Jobs Get. */ +public final class JobsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJob.json + */ + /** + * Sample code: Get a job. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().getWithResponse("group1", "server1", "agent1", "job1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsListByAgentSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsListByAgentSamples.java new file mode 100644 index 0000000000000..9b56eb974a9f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsListByAgentSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Jobs ListByAgent. */ +public final class JobsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobsByAgent.json + */ + /** + * Sample code: List jobs in a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobsInAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().listByAgent("group1", "server1", "agent1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5a7add9bce1cb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; + +/** Samples for LedgerDigestUploadsOperation CreateOrUpdate. */ +public final class LedgerDigestUploadsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsEnable.json + */ + /** + * Sample code: Enables ledger digest upload configuration for a database. + * + * @param manager Entry point to SqlManager. + */ + public static void enablesLedgerDigestUploadConfigurationForADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .define(LedgerDigestUploadsName.CURRENT) + .withExistingDatabase("ledgertestrg", "ledgertestserver", "testdb") + .withDigestStorageEndpoint("https://MyAccount.blob.core.windows.net") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationDisableSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationDisableSamples.java new file mode 100644 index 0000000000000..ebb67c040067d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationDisableSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; + +/** Samples for LedgerDigestUploadsOperation Disable. */ +public final class LedgerDigestUploadsOperationDisableSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsDisable.json + */ + /** + * Sample code: Disables uploading ledger digests for a database. + * + * @param manager Entry point to SqlManager. + */ + public static void disablesUploadingLedgerDigestsForADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .disable("ledgertestrg", "ledgertestserver", "testdb", LedgerDigestUploadsName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationGetSamples.java new file mode 100644 index 0000000000000..dd40c14a36b19 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; + +/** Samples for LedgerDigestUploadsOperation Get. */ +public final class LedgerDigestUploadsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsGet.json + */ + /** + * Sample code: Gets the current ledger digest upload configuration for a database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheCurrentLedgerDigestUploadConfigurationForADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .getWithResponse( + "ledgertestrg", "ledgertestserver", "testdb", LedgerDigestUploadsName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationListByDatabaseSamples.java new file mode 100644 index 0000000000000..4d766f0fcc25a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LedgerDigestUploadsOperation ListByDatabase. */ +public final class LedgerDigestUploadsOperationListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsList.json + */ + /** + * Sample code: Gets list of ledger digest upload settings on a database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfLedgerDigestUploadSettingsOnADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .listByDatabase("ledgertestrg", "ledgertestserver", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsCopyByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsCopyByResourceGroupSamples.java new file mode 100644 index 0000000000000..2131e436e1952 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsCopyByResourceGroupSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CopyLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups CopyByResourceGroup. */ +public final class LongTermRetentionBackupsCopyByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupCopy.json + */ + /** + * Sample code: Copy the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void copyTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .copyByResourceGroup( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new CopyLongTermRetentionBackupParameters() + .withTargetServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver2") + .withTargetDatabaseName("testDatabase2") + .withTargetBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsCopySamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsCopySamples.java new file mode 100644 index 0000000000000..6e851be634c41 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsCopySamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CopyLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups Copy. */ +public final class LongTermRetentionBackupsCopySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupCopy.json + */ + /** + * Sample code: Copy the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void copyTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .copy( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new CopyLongTermRetentionBackupParameters() + .withTargetServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver2") + .withTargetDatabaseName("testDatabase2") + .withTargetBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsDeleteByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsDeleteByResourceGroupSamples.java new file mode 100644 index 0000000000000..5dbc367f74398 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsDeleteByResourceGroupSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups DeleteByResourceGroup. */ +public final class LongTermRetentionBackupsDeleteByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .deleteByResourceGroup( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsDeleteSamples.java new file mode 100644 index 0000000000000..b54d874487596 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsDeleteSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups Delete. */ +public final class LongTermRetentionBackupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .delete( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsGetByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..c863da62b3aa6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsGetByResourceGroupSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups GetByResourceGroup. */ +public final class LongTermRetentionBackupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .getByResourceGroupWithResponse( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsGetSamples.java new file mode 100644 index 0000000000000..0d065fa1432a5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsGetSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups Get. */ +public final class LongTermRetentionBackupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .getWithResponse( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByDatabaseSamples.java new file mode 100644 index 0000000000000..76f509b6ee860 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByDatabase. */ +public final class LongTermRetentionBackupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByDatabase("japaneast", "testserver", "testDatabase", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByLocationSamples.java new file mode 100644 index 0000000000000..c4fa779fc306b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByLocationSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByLocation. */ +public final class LongTermRetentionBackupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionBackups().listByLocation("japaneast", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupDatabaseSamples.java new file mode 100644 index 0000000000000..c649774f5ce25 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupDatabaseSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByResourceGroupDatabase. */ +public final class LongTermRetentionBackupsListByResourceGroupDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByResourceGroupDatabase( + "testResourceGroup", "japaneast", "testserver", "testDatabase", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupLocationSamples.java new file mode 100644 index 0000000000000..b3f37fdc63302 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupLocationSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByResourceGroupLocation. */ +public final class LongTermRetentionBackupsListByResourceGroupLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByResourceGroupLocation("testResourceGroup", "japaneast", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupServerSamples.java new file mode 100644 index 0000000000000..d66c5e3e08930 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupServerSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByResourceGroupServer. */ +public final class LongTermRetentionBackupsListByResourceGroupServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByServer.json + */ + /** + * Sample code: Get all long term retention backups under the server. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByResourceGroupServer("testResourceGroup", "japaneast", "testserver", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByServerSamples.java new file mode 100644 index 0000000000000..901d87266ddf3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByServer. */ +public final class LongTermRetentionBackupsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByServer.json + */ + /** + * Sample code: Get all long term retention backups under the server. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionBackups().listByServer("japaneast", "testserver", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsUpdateByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsUpdateByResourceGroupSamples.java new file mode 100644 index 0000000000000..49bce2e1a5f3c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsUpdateByResourceGroupSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.UpdateLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups UpdateByResourceGroup. */ +public final class LongTermRetentionBackupsUpdateByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupUpdate.json + */ + /** + * Sample code: Update the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .updateByResourceGroup( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new UpdateLongTermRetentionBackupParameters() + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsUpdateSamples.java new file mode 100644 index 0000000000000..d38bc66bf1b55 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.UpdateLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups Update. */ +public final class LongTermRetentionBackupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupUpdate.json + */ + /** + * Sample code: Update the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .update( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new UpdateLongTermRetentionBackupParameters() + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupSamples.java new file mode 100644 index 0000000000000..93ea21946d1ab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups DeleteByResourceGroup. */ +public final class LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .deleteByResourceGroup( + "testResourceGroup", + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsDeleteSamples.java new file mode 100644 index 0000000000000..0b4f3d8b04723 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsDeleteSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups Delete. */ +public final class LongTermRetentionManagedInstanceBackupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .delete( + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsGetByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..6be91f1901b06 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsGetByResourceGroupSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups GetByResourceGroup. */ +public final class LongTermRetentionManagedInstanceBackupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .getByResourceGroupWithResponse( + "testResourceGroup", + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsGetSamples.java new file mode 100644 index 0000000000000..2d4cefe718a61 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsGetSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups Get. */ +public final class LongTermRetentionManagedInstanceBackupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup of a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackupOfAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .getWithResponse( + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByDatabaseSamples.java new file mode 100644 index 0000000000000..65dc2aa472c61 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByDatabase. */ +public final class LongTermRetentionManagedInstanceBackupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByDatabase("japaneast", "testInstance", "testDatabase", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByInstanceSamples.java new file mode 100644 index 0000000000000..c008aa4cf48cd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByInstanceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByInstance. */ +public final class LongTermRetentionManagedInstanceBackupsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByInstance.json + */ + /** + * Sample code: Get all long term retention backups under the managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByInstance("japaneast", "testInstance", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByLocationSamples.java new file mode 100644 index 0000000000000..e48b8523da6d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByLocationSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByLocation. */ +public final class LongTermRetentionManagedInstanceBackupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionManagedInstanceBackups().listByLocation("japaneast", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseSamples.java new file mode 100644 index 0000000000000..e17c976a2d04d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByResourceGroupDatabase. */ +public final class LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByResourceGroupDatabase( + "testResourceGroup", "japaneast", "testInstance", "testDatabase", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceSamples.java new file mode 100644 index 0000000000000..5458e6c7ec231 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByResourceGroupInstance. */ +public final class LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByInstance.json + */ + /** + * Sample code: Get all long term retention backups under the managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByResourceGroupInstance("testResourceGroup", "japaneast", "testInstance", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationSamples.java new file mode 100644 index 0000000000000..a6b60a42f8086 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByResourceGroupLocation. */ +public final class LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByResourceGroupLocation("testResourceGroup", "japaneast", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8fb136518d191 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; + +/** Samples for LongTermRetentionPolicies CreateOrUpdate. */ +public final class LongTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyCreateOrUpdate.json + */ + /** + * Sample code: Create or update the long term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateTheLongTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionPolicies() + .define(LongTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("resourceGroup", "testserver", "testDatabase") + .withWeeklyRetention("P1M") + .withMonthlyRetention("P1Y") + .withYearlyRetention("P5Y") + .withWeekOfYear(5) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesGetSamples.java new file mode 100644 index 0000000000000..279bfd451fe1d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; + +/** Samples for LongTermRetentionPolicies Get. */ +public final class LongTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyGet.json + */ + /** + * Sample code: Get the long term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionPolicies() + .getWithResponse( + "resourceGroup", "testserver", "testDatabase", LongTermRetentionPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..75c3fe63827e1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesListByDatabaseSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionPolicies ListByDatabase. */ +public final class LongTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyListByDatabase.json + */ + /** + * Sample code: Get the long term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionPolicies().listByDatabase("resourceGroup", "testserver", "testDatabase", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowOptionsOperationGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowOptionsOperationGetSamples.java new file mode 100644 index 0000000000000..a503eb6efeda6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowOptionsOperationGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MaintenanceWindowOptionsOperation Get. */ +public final class MaintenanceWindowOptionsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetMaintenanceWindowOptions.json + */ + /** + * Sample code: Gets a list of available maintenance windows for a selected database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAvailableMaintenanceWindowsForASelectedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .maintenanceWindowOptionsOperations() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", "current", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowsOperationCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowsOperationCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..4953925f961cd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowsOperationCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner; +import com.azure.resourcemanager.sql.generated.models.DayOfWeek; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import java.util.Arrays; + +/** Samples for MaintenanceWindowsOperation CreateOrUpdate. */ +public final class MaintenanceWindowsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateMaintenanceWindows.json + */ + /** + * Sample code: Sets maintenance window settings for a selected database. + * + * @param manager Entry point to SqlManager. + */ + public static void setsMaintenanceWindowSettingsForASelectedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .maintenanceWindowsOperations() + .createOrUpdateWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdwdb", + "current", + new MaintenanceWindowsInner() + .withTimeRanges( + Arrays + .asList( + new MaintenanceWindowTimeRange() + .withDayOfWeek(DayOfWeek.SATURDAY) + .withStartTime("00:00:00") + .withDuration("PT60M"))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowsOperationGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowsOperationGetSamples.java new file mode 100644 index 0000000000000..cf2d0b8ec062b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowsOperationGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MaintenanceWindowsOperation Get. */ +public final class MaintenanceWindowsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetMaintenanceWindows.json + */ + /** + * Sample code: Gets maintenance window settings for a selected database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsMaintenanceWindowSettingsForASelectedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .maintenanceWindowsOperations() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", "current", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..6c1b4e6e2f9b6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedBackupShortTermRetentionPolicies CreateOrUpdate. */ +public final class ManagedBackupShortTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedBackupShortTermRetentionPolicies() + .define(ManagedShortTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("resourceGroup", "testsvr", "testdb") + .withRetentionDays(14) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesGetSamples.java new file mode 100644 index 0000000000000..7f07c9fecee5e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesGetSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedBackupShortTermRetentionPolicies Get. */ +public final class ManagedBackupShortTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedBackupShortTermRetentionPolicies() + .getWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + ManagedShortTermRetentionPolicyName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..c5f5eab9fb1d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedBackupShortTermRetentionPolicies ListByDatabase. */ +public final class ManagedBackupShortTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetListManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Get the short term retention policy list for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyListForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedBackupShortTermRetentionPolicies() + .listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesUpdateSamples.java new file mode 100644 index 0000000000000..a8acaf9db9740 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedBackupShortTermRetentionPolicies Update. */ +public final class ManagedBackupShortTermRetentionPoliciesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedBackupShortTermRetentionPolicy resource = + manager + .managedBackupShortTermRetentionPolicies() + .getWithResponse( + "resourceGroup", "testsvr", "testdb", ManagedShortTermRetentionPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withRetentionDays(14).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsGetSamples.java new file mode 100644 index 0000000000000..d41e191e36309 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseColumns Get. */ +public final class ManagedDatabaseColumnsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnGet.json + */ + /** + * Sample code: Get managed database column. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedDatabaseColumn(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .getWithResponse("myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", "column1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsListByDatabaseSamples.java new file mode 100644 index 0000000000000..7abc252ed96e6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsListByDatabaseSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.Arrays; + +/** Samples for ManagedDatabaseColumns ListByDatabase. */ +public final class ManagedDatabaseColumnsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedColumnsListByDatabaseMin.json + */ + /** + * Sample code: List managed database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .listByDatabase("myRG", "serverName", "myDatabase", null, null, null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedColumnsListByDatabaseMax.json + */ + /** + * Sample code: Filter managed database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void filterManagedDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .listByDatabase( + "myRG", + "serverName", + "myDatabase", + Arrays.asList("dbo"), + Arrays.asList("customer", "address"), + Arrays.asList("username"), + Arrays.asList("schema asc", "table", "column desc"), + null, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsListByTableSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsListByTableSamples.java new file mode 100644 index 0000000000000..c075cd8dfb1b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsListByTableSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseColumns ListByTable. */ +public final class ManagedDatabaseColumnsListByTableSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnListByTable.json + */ + /** + * Sample code: List managed database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .listByTable("myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseQueriesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseQueriesGetSamples.java new file mode 100644 index 0000000000000..dd0d37447df5f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseQueriesGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseQueries Get. */ +public final class ManagedDatabaseQueriesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryGet.json + */ + /** + * Sample code: Obtain query properties. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryProperties(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "database_1", "42", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseQueriesListByQuerySamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseQueriesListByQuerySamples.java new file mode 100644 index 0000000000000..ae3991d41905b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseQueriesListByQuerySamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; + +/** Samples for ManagedDatabaseQueries ListByQuery. */ +public final class ManagedDatabaseQueriesListByQuerySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsListMax.json + */ + /** + * Sample code: Obtain query execution statistics. Example with all request parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryExecutionStatisticsExampleWithAllRequestParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .listByQuery( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "database_1", + "42", + "03/01/2020 16:23:09", + "03/11/2020 14:00:00", + QueryTimeGrainType.P1D, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsList.json + */ + /** + * Sample code: Obtain query execution statistics. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryExecutionStatistics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .listByQuery("sqlcrudtest-7398", "sqlcrudtest-4645", "database_1", "42", null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsListMin.json + */ + /** + * Sample code: Obtain query execution statistics. Minimal example with only mandatory request parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryExecutionStatisticsMinimalExampleWithOnlyMandatoryRequestParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .listByQuery( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "database_1", + "42", + null, + null, + QueryTimeGrainType.PT1H, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseRecommendedSensitivityLabelsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseRecommendedSensitivityLabelsUpdateSamples.java new file mode 100644 index 0000000000000..711f4cc0d7bd0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseRecommendedSensitivityLabelsUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdate; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for ManagedDatabaseRecommendedSensitivityLabels Update. */ +public final class ManagedDatabaseRecommendedSensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsRecommendedUpdate.json + */ + /** + * Sample code: Update recommended sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateRecommendedSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseRecommendedSensitivityLabels() + .updateWithResponse( + "myRG", + "myManagedInstanceName", + "myDatabase", + new RecommendedSensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.ENABLE) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.DISABLE) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.DISABLE) + .withSchema("dbo") + .withTable("Table1") + .withColumn("Column3"))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseRestoreDetailsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseRestoreDetailsGetSamples.java new file mode 100644 index 0000000000000..24bfb068d62f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseRestoreDetailsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.RestoreDetailsName; + +/** Samples for ManagedDatabaseRestoreDetails Get. */ +public final class ManagedDatabaseRestoreDetailsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseRestoreDetails.json + */ + /** + * Sample code: Managed database restore details. + * + * @param manager Entry point to SqlManager. + */ + public static void managedDatabaseRestoreDetails(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseRestoreDetails() + .getWithResponse( + "Default-SQL-SouthEastAsia", "managedInstance", "testdb", RestoreDetailsName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSchemasGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSchemasGetSamples.java new file mode 100644 index 0000000000000..8aceeed59cb7c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSchemasGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSchemas Get. */ +public final class ManagedDatabaseSchemasGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSchemaGet.json + */ + /** + * Sample code: Get managed database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSchemas() + .getWithResponse("myRG", "myManagedInstanceName", "myDatabase", "dbo", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSchemasListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSchemasListByDatabaseSamples.java new file mode 100644 index 0000000000000..20a9b7bc0b142 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSchemasListByDatabaseSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSchemas ListByDatabase. */ +public final class ManagedDatabaseSchemasListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSchemaListByDatabase.json + */ + /** + * Sample code: List managed database schemas. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseSchemas(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSchemas() + .listByDatabase("myRG", "myManagedInstanceName", "myDatabase", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..357d70b18d9d6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +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.util.Arrays; + +/** Samples for ManagedDatabaseSecurityAlertPolicies CreateOrUpdate. */ +public final class ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertCreateMax.json + */ + /** + * Sample code: Update a database's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabaseSecurityAlertPolicy resource = + manager + .managedDatabaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Sql_Injection", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("test@contoso.com", "user@contoso.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(6) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertCreateMin.json + */ + /** + * Sample code: Update a database's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabaseSecurityAlertPolicy resource = + manager + .managedDatabaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertPolicyState.ENABLED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesGetSamples.java new file mode 100644 index 0000000000000..5cf96563a6208 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for ManagedDatabaseSecurityAlertPolicies Get. */ +public final class ManagedDatabaseSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertGet.json + */ + /** + * Sample code: Get a database's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSThreatDetectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-6852", "securityalert-2080", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..6aa48ac0c012c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSecurityAlertPolicies ListByDatabase. */ +public final class ManagedDatabaseSecurityAlertPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertListByDatabase.json + */ + /** + * Sample code: Get a list of the database's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfTheDatabaseSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityAlertPolicies() + .listByDatabase("securityalert-6852", "securityalert-2080", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityEventsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityEventsListByDatabaseSamples.java new file mode 100644 index 0000000000000..37aeaa004a72b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityEventsListByDatabaseSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSecurityEvents ListByDatabase. */ +public final class ManagedDatabaseSecurityEventsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityEventsGetMin.json + */ + /** + * Sample code: Get the managed database's security events with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedDatabaseSSecurityEventsWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityEvents() + .listByDatabase("testrg", "testcl", "database1", null, null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityEventsGetMax.json + */ + /** + * Sample code: Get the managed database's security events with maximal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedDatabaseSSecurityEventsWithMaximalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityEvents() + .listByDatabase( + "testrg", + "testcl", + "database1", + "ShowServerRecords eq true", + 0, + 1, + "eyJCbG9iTmFtZURhdGVUaW1lIjoiXC9EYXRlKDE1MTIyODg4MTIwMTArMDIwMClcLyIsIkJsb2JOYW1lUm9sbG92ZXJJbmRleCI6IjAiLCJFbmREYXRlIjoiXC9EYXRlKDE1MTI0NjYyMDA1MjkpXC8iLCJJc1NraXBUb2tlblNldCI6ZmFsc2UsIklzVjJCbG9iVGltZUZvcm1hdCI6dHJ1ZSwiU2hvd1NlcnZlclJlY29yZHMiOmZhbHNlLCJTa2lwVmFsdWUiOjAsIlRha2VWYWx1ZSI6MTB9", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..dc4a11d87826e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; + +/** Samples for ManagedDatabaseSensitivityLabels CreateOrUpdate. */ +public final class ManagedDatabaseSensitivityLabelsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelCreate.json + */ + /** + * Sample code: Updates or creates a sensitivity label of a given column with all parameters in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesOrCreatesASensitivityLabelOfAGivenColumnWithAllParametersInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .define() + .withExistingColumn("myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn") + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646") + .withRank(SensitivityLabelRank.HIGH) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsDeleteSamples.java new file mode 100644 index 0000000000000..b5d3d2c685d8b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels Delete. */ +public final class ManagedDatabaseSensitivityLabelsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelDelete.json + */ + /** + * Sample code: Deletes the sensitivity label of a given column in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesTheSensitivityLabelOfAGivenColumnInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .deleteWithResponse( + "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsDisableRecommendationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsDisableRecommendationSamples.java new file mode 100644 index 0000000000000..374325c91f631 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsDisableRecommendationSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels DisableRecommendation. */ +public final class ManagedDatabaseSensitivityLabelsDisableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseRecommendedColumnSensitivityLabelDisable.json + */ + /** + * Sample code: Disables the sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void disablesTheSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .disableRecommendationWithResponse( + "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsEnableRecommendationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsEnableRecommendationSamples.java new file mode 100644 index 0000000000000..b322ce526e5a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsEnableRecommendationSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels EnableRecommendation. */ +public final class ManagedDatabaseSensitivityLabelsEnableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseRecommendedColumnSensitivityLabelEnable.json + */ + /** + * Sample code: Enables the sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void enablesTheSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .enableRecommendationWithResponse( + "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsGetSamples.java new file mode 100644 index 0000000000000..353c048778a12 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsGetSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; + +/** Samples for ManagedDatabaseSensitivityLabels Get. */ +public final class ManagedDatabaseSensitivityLabelsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelGet.json + */ + /** + * Sample code: Gets the sensitivity label of a given column in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheSensitivityLabelOfAGivenColumnInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .getWithResponse( + "myRG", + "myManagedInstanceName", + "myDatabase", + "dbo", + "myTable", + "myColumn", + SensitivityLabelSource.CURRENT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsListCurrentByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsListCurrentByDatabaseSamples.java new file mode 100644 index 0000000000000..f5bd3f95330a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsListCurrentByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels ListCurrentByDatabase. */ +public final class ManagedDatabaseSensitivityLabelsListCurrentByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsListByDatabaseCurrent.json + */ + /** + * Sample code: Gets the current sensitivity labels of a given database in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheCurrentSensitivityLabelsOfAGivenDatabaseInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .listCurrentByDatabase("myRG", "myManagedInstanceName", "myDatabase", null, null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseSamples.java new file mode 100644 index 0000000000000..3d1e8088ca579 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels ListRecommendedByDatabase. */ +public final class ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsListByDatabaseRecommended.json + */ + /** + * Sample code: Gets the recommended sensitivity labels of a given database in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheRecommendedSensitivityLabelsOfAGivenDatabaseInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .listRecommendedByDatabase("myRG", "myManagedInstanceName", "myDatabase", null, null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsUpdateSamples.java new file mode 100644 index 0000000000000..33d1623426bbd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for ManagedDatabaseSensitivityLabels Update. */ +public final class ManagedDatabaseSensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsCurrentUpdate.json + */ + /** + * Sample code: Update sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .updateWithResponse( + "myRG", + "myManagedInstanceName", + "myDatabase", + new SensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("Highly Confidential") + .withLabelId("3A477B16-9423-432B-AA97-6069B481CEC3") + .withInformationType("Financial") + .withInformationTypeId("1D3652D6-422C-4115-82F1-65DAEBC665C8")), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646")), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.REMOVE) + .withSchema("dbo") + .withTable("Table1") + .withColumn("Column3"))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTablesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTablesGetSamples.java new file mode 100644 index 0000000000000..b7d0917cd0c00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTablesGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseTables Get. */ +public final class ManagedDatabaseTablesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseTableGet.json + */ + /** + * Sample code: Get managed database table. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedDatabaseTable(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTables() + .getWithResponse("myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTablesListBySchemaSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTablesListBySchemaSamples.java new file mode 100644 index 0000000000000..c0030bf6c10b8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTablesListBySchemaSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseTables ListBySchema. */ +public final class ManagedDatabaseTablesListBySchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseTableListBySchema.json + */ + /** + * Sample code: List managed database tables. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseTables(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTables() + .listBySchema("myRG", "myManagedInstanceName", "myDatabase", "dbo", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..570d6686aa361 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; + +/** Samples for ManagedDatabaseTransparentDataEncryption CreateOrUpdate. */ +public final class ManagedDatabaseTransparentDataEncryptionCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionUpdate.json + */ + /** + * Sample code: Update a database's Transparent Data Encryption state with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSTransparentDataEncryptionStateWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedTransparentDataEncryption resource = + manager + .managedDatabaseTransparentDataEncryptions() + .getWithResponse( + "securitytde-42-rg", + "securitytde-42", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE) + .getValue(); + resource.update().withState(TransparentDataEncryptionState.ENABLED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionGetSamples.java new file mode 100644 index 0000000000000..408f4251806e9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionGetSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +/** Samples for ManagedDatabaseTransparentDataEncryption Get. */ +public final class ManagedDatabaseTransparentDataEncryptionGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionGet.json + */ + /** + * Sample code: Get a database's transparent data encryption. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSTransparentDataEncryption( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTransparentDataEncryptions() + .getWithResponse( + "security-tde-resourcegroup", + "securitytde", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionListByDatabaseSamples.java new file mode 100644 index 0000000000000..b14d7ec25c6ad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseTransparentDataEncryption ListByDatabase. */ +public final class ManagedDatabaseTransparentDataEncryptionListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionList.json + */ + /** + * Sample code: Get a list of the database's transparent data encryptions. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfTheDatabaseSTransparentDataEncryptions( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTransparentDataEncryptions() + .listByDatabase("security-tde-resourcegroup", "securitytde", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..53b3f68c8c20c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +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.Arrays; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentRuleBaselines CreateOrUpdate. */ +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineCreate.json + */ + /** + * Sample code: Creates or updates a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.DEFAULT, + new DatabaseVulnerabilityAssessmentRuleBaselineInner() + .withBaselineResults( + Arrays + .asList( + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userA", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userB", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userC", "SELECT", "tableId_4")))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples.java new file mode 100644 index 0000000000000..d7e32b4433aba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentRuleBaselines Delete. */ +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineDelete.json + */ + /** + * Sample code: Removes a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void removesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentRuleBaselines() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetSamples.java new file mode 100644 index 0000000000000..c362d027c544f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentRuleBaselines Get. */ +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineGet.json + */ + /** + * Sample code: Gets a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.MASTER, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansExportSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansExportSamples.java new file mode 100644 index 0000000000000..370da63998f8e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansExportSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans Export. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansExportSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanExport.json + */ + /** + * Sample code: Export a database's vulnerability assessment scan results. + * + * @param manager Entry point to SqlManager. + */ + public static void exportADatabaseSVulnerabilityAssessmentScanResults( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .exportWithResponse( + "vulnerabilityassessmenttest-4799", + "vulnerabilityassessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansGetSamples.java new file mode 100644 index 0000000000000..33f02a72b3e5d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansGetSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans Get. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanRecordsGet.json + */ + /** + * Sample code: Gets a database vulnerability assessment scan record by scan ID. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseVulnerabilityAssessmentScanRecordByScanID( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansInitiateScanSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansInitiateScanSamples.java new file mode 100644 index 0000000000000..f09cdbea97f00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansInitiateScanSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans InitiateScan. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansInitiateScanSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScansExecute.json + */ + /** + * Sample code: Executes a database's vulnerability assessment scan. + * + * @param manager Entry point to SqlManager. + */ + public static void executesADatabaseSVulnerabilityAssessmentScan( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .initiateScan( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan01", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseSamples.java new file mode 100644 index 0000000000000..cf9ab41bad0dd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans ListByDatabase. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanRecordsListByDatabase.json + */ + /** + * Sample code: Gets the list of a database vulnerability assessment scan records. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheListOfADatabaseVulnerabilityAssessmentScanRecords( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .listByDatabase( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..9022990b790cd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for ManagedDatabaseVulnerabilityAssessments CreateOrUpdate. */ +public final class ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a database's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createADatabaseSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + new DatabaseVulnerabilityAssessmentInner() + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentCreateMin.json + */ + /** + * Sample code: Create a database's vulnerability assessment with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createADatabaseSVulnerabilityAssessmentWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + new DatabaseVulnerabilityAssessmentInner() + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsDeleteSamples.java new file mode 100644 index 0000000000000..06a0ceb833aa2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsDeleteSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessments Delete. */ +public final class ManagedDatabaseVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsGetSamples.java new file mode 100644 index 0000000000000..2d969186c24b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsGetSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessments Get. */ +public final class ManagedDatabaseVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsListByDatabaseSamples.java new file mode 100644 index 0000000000000..ec35c6cfda2c0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsListByDatabaseSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseVulnerabilityAssessments ListByDatabase. */ +public final class ManagedDatabaseVulnerabilityAssessmentsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentListByDatabase.json + */ + /** + * Sample code: Get a database's vulnerability assessments list. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSVulnerabilityAssessmentsList( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .listByDatabase( + "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCompleteRestoreSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCompleteRestoreSamples.java new file mode 100644 index 0000000000000..0f9131ec53c56 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCompleteRestoreSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.CompleteDatabaseRestoreDefinition; + +/** Samples for ManagedDatabases CompleteRestore. */ +public final class ManagedDatabasesCompleteRestoreSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCompleteExternalRestore.json + */ + /** + * Sample code: Completes a managed database external backup restore. + * + * @param manager Entry point to SqlManager. + */ + public static void completesAManagedDatabaseExternalBackupRestore( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .completeRestore( + "myRG", + "myManagedInstanceName", + "myDatabase", + new CompleteDatabaseRestoreDefinition().withLastBackupName("testdb1_log4"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..3b98fd8063185 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseCreateMode; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedDatabases CreateOrUpdate. */ +public final class ManagedDatabasesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateRecovery.json + */ + /** + * Sample code: Creates a new managed database from restoring a geo-replicated backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseFromRestoringAGeoReplicatedBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("testdb_recovered") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "server1") + .withCreateMode(ManagedDatabaseCreateMode.RECOVERY) + .withRecoverableDatabaseId( + "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Default-SQL-WestEurope/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateRestoreExternalBackup.json + */ + /** + * Sample code: Creates a new managed database by restoring from an external backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseByRestoringFromAnExternalBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withCreateMode(ManagedDatabaseCreateMode.RESTORE_EXTERNAL_BACKUP) + .withStorageContainerUri("https://myaccountname.blob.core.windows.net/backups") + .withStorageContainerSasToken("sv=2015-12-11&sr=c&sp=rl&sig=1234") + .withAutoCompleteRestore(true) + .withLastBackupName("last_backup_name") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateMax.json + */ + /** + * Sample code: Creates a new managed database with maximal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseWithMaximalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withTags(mapOf("tagKey1", "TagValue1")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateMin.json + */ + /** + * Sample code: Creates a new managed database with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreatePointInTimeRestore.json + */ + /** + * Sample code: Creates a new managed database using point in time restore. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseUsingPointInTimeRestore( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withRestorePointInTime(OffsetDateTime.parse("2017-07-14T05:35:31.503Z")) + .withCreateMode(ManagedDatabaseCreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseCreateRestoreLtrBackup.json + */ + /** + * Sample code: Creates a new managed database from restoring a long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseFromRestoringALongTermRetentionBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withCreateMode(ManagedDatabaseCreateMode.RESTORE_EXTERNAL_BACKUP) + .withStorageContainerUri("https://myaccountname.blob.core.windows.net/backups") + .withStorageContainerSasToken("sv=2015-12-11&sr=c&sp=rl&sig=1234") + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesDeleteSamples.java new file mode 100644 index 0000000000000..42b178c8a2c32 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases Delete. */ +public final class ManagedDatabasesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseDelete.json + */ + /** + * Sample code: Delete managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteManagedDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().delete("Default-SQL-SouthEastAsia", "managedInstance", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesGetSamples.java new file mode 100644 index 0000000000000..ee57f646790e1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases Get. */ +public final class ManagedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseGet.json + */ + /** + * Sample code: Gets a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAManagedDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().getWithResponse("Test1", "managedInstance", "managedDatabase", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesListByInstanceSamples.java new file mode 100644 index 0000000000000..31eea8b845228 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesListByInstanceSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases ListByInstance. */ +public final class ManagedDatabasesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseListByManagedInstance.json + */ + /** + * Sample code: List databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabasesByManagedInstances(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().listByInstance("Test1", "managedInstance", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesListInaccessibleByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesListInaccessibleByInstanceSamples.java new file mode 100644 index 0000000000000..9889f490973b0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesListInaccessibleByInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases ListInaccessibleByInstance. */ +public final class ManagedDatabasesListInaccessibleByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InaccessibleManagedDatabaseListByManagedInstance.json + */ + /** + * Sample code: List inaccessible managed databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listInaccessibleManagedDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().listInaccessibleByInstance("testrg", "testcl", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesUpdateSamples.java new file mode 100644 index 0000000000000..29976a92da722 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabase; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedDatabases Update. */ +public final class ManagedDatabasesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseUpdateMax.json + */ + /** + * Sample code: Updates a managed database with maximal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesAManagedDatabaseWithMaximalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabase resource = + manager + .managedDatabases() + .getWithResponse("Default-SQL-SouthEastAsia", "managedInstance", "testdb", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey1", "TagValue1")).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseUpdateMin.json + */ + /** + * Sample code: Updates a managed database with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesAManagedDatabaseWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabase resource = + manager + .managedDatabases() + .getWithResponse("Default-SQL-SouthEastAsia", "managedInstance", "testdb", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey1", "TagValue1")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d38765af3a200 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministratorType; +import java.util.UUID; + +/** Samples for ManagedInstanceAdministrators CreateOrUpdate. */ +public final class ManagedInstanceAdministratorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorCreate.json + */ + /** + * Sample code: Create administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void createAdministratorOfManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .define(AdministratorName.ACTIVE_DIRECTORY) + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withAdministratorType(ManagedInstanceAdministratorType.ACTIVE_DIRECTORY) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("44444444-3333-2222-1111-000000000000")) + .withTenantId(UUID.fromString("55555555-4444-3333-2222-111111111111")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorUpdate.json + */ + /** + * Sample code: Update administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAdministratorOfManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceAdministrator resource = + manager + .managedInstanceAdministrators() + .getWithResponse( + "Default-SQL-SouthEastAsia", "managedInstance", AdministratorName.ACTIVE_DIRECTORY, Context.NONE) + .getValue(); + resource + .update() + .withAdministratorType(ManagedInstanceAdministratorType.ACTIVE_DIRECTORY) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("44444444-3333-2222-1111-000000000000")) + .withTenantId(UUID.fromString("55555555-4444-3333-2222-111111111111")) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsDeleteSamples.java new file mode 100644 index 0000000000000..b04289a2bc302 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ManagedInstanceAdministrators Delete. */ +public final class ManagedInstanceAdministratorsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorDelete.json + */ + /** + * Sample code: Delete administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAdministratorOfManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .delete("Default-SQL-SouthEastAsia", "managedInstance", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsGetSamples.java new file mode 100644 index 0000000000000..c962d7dbcda86 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ManagedInstanceAdministrators Get. */ +public final class ManagedInstanceAdministratorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorGet.json + */ + /** + * Sample code: Get administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getAdministratorOfManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .getWithResponse( + "Default-SQL-SouthEastAsia", "managedInstance", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsListByInstanceSamples.java new file mode 100644 index 0000000000000..456cfcbed938b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsListByInstanceSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceAdministrators ListByInstance. */ +public final class ManagedInstanceAdministratorsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorListByInstance.json + */ + /** + * Sample code: List administrators of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listAdministratorsOfManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .listByInstance("Default-SQL-SouthEastAsia", "managedInstance", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..62e1159c835a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications CreateOrUpdate. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .define(AuthenticationName.DEFAULT) + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withAzureADOnlyAuthentication(false) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsDeleteSamples.java new file mode 100644 index 0000000000000..cd1c44ca52d2c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications Delete. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthDelete.json + */ + /** + * Sample code: Deletes Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .delete("Default-SQL-SouthEastAsia", "managedInstance", AuthenticationName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsGetSamples.java new file mode 100644 index 0000000000000..45120ee7bb600 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications Get. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthGet.json + */ + /** + * Sample code: Gets a Azure Active Directory only authentication property. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAAzureActiveDirectoryOnlyAuthenticationProperty( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .getWithResponse("Default-SQL-SouthEastAsia", "managedInstance", AuthenticationName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsListByInstanceSamples.java new file mode 100644 index 0000000000000..c7bca916266c9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsListByInstanceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications ListByInstance. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthListByInstance.json + */ + /** + * Sample code: Gets a list of Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .listByInstance("Default-SQL-SouthEastAsia", "managedInstance", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..511f868d96529 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceEncryptionProtector; + +/** Samples for ManagedInstanceEncryptionProtectors CreateOrUpdate. */ +public final class ManagedInstanceEncryptionProtectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorCreateOrUpdateKeyVault.json + */ + /** + * Sample code: Update the encryption protector to key vault. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToKeyVault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceEncryptionProtector resource = + manager + .managedInstanceEncryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource + .update() + .withServerKeyName("someVault_someKey_01234567890123456789012345678901") + .withAutoRotationEnabled(false) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorCreateOrUpdateServiceManaged.json + */ + /** + * Sample code: Update the encryption protector to service managed. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToServiceManaged( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceEncryptionProtector resource = + manager + .managedInstanceEncryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource.update().withServerKeyName("ServiceManaged").apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsGetSamples.java new file mode 100644 index 0000000000000..2d481684307d8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for ManagedInstanceEncryptionProtectors Get. */ +public final class ManagedInstanceEncryptionProtectorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorGet.json + */ + /** + * Sample code: Get the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceEncryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsListByInstanceSamples.java new file mode 100644 index 0000000000000..d241a9f4f2799 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsListByInstanceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceEncryptionProtectors ListByInstance. */ +public final class ManagedInstanceEncryptionProtectorsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorList.json + */ + /** + * Sample code: List encryption protectors by managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listEncryptionProtectorsByManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceEncryptionProtectors() + .listByInstance("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsRevalidateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsRevalidateSamples.java new file mode 100644 index 0000000000000..1bf1b74800b12 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsRevalidateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for ManagedInstanceEncryptionProtectors Revalidate. */ +public final class ManagedInstanceEncryptionProtectorsRevalidateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorRevalidate.json + */ + /** + * Sample code: Revalidates the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void revalidatesTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceEncryptionProtectors() + .revalidate("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..97f4c03484607 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +/** Samples for ManagedInstanceKeys CreateOrUpdate. */ +public final class ManagedInstanceKeysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates a managed instance key. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAManagedInstanceKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceKeys() + .define("someVault_someKey_01234567890123456789012345678901") + .withExistingManagedInstance("sqlcrudtest-7398", "sqlcrudtest-4645") + .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) + .withUri("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysDeleteSamples.java new file mode 100644 index 0000000000000..c67250c3248db --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceKeys Delete. */ +public final class ManagedInstanceKeysDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyDelete.json + */ + /** + * Sample code: Delete the managed instance key. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheManagedInstanceKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceKeys() + .delete( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysGetSamples.java new file mode 100644 index 0000000000000..ff952d7cd160f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceKeys Get. */ +public final class ManagedInstanceKeysGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyGet.json + */ + /** + * Sample code: Get the managed instance key. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedInstanceKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceKeys() + .getWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysListByInstanceSamples.java new file mode 100644 index 0000000000000..66cedae3291f8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysListByInstanceSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceKeys ListByInstance. */ +public final class ManagedInstanceKeysListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyList.json + */ + /** + * Sample code: List the keys for a managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheKeysForAManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstanceKeys().listByInstance("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..484599cfb9707 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; + +/** Samples for ManagedInstanceLongTermRetentionPolicies CreateOrUpdate. */ +public final class ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyCreateOrUpdate.json + */ + /** + * Sample code: Create or update the LTR policy for the managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateTheLTRPolicyForTheManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceLongTermRetentionPolicies() + .define(ManagedInstanceLongTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("testResourceGroup", "testInstance", "testDatabase") + .withWeeklyRetention("P1M") + .withMonthlyRetention("P1Y") + .withYearlyRetention("P5Y") + .withWeekOfYear(5) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesGetSamples.java new file mode 100644 index 0000000000000..8a83125b7cf03 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesGetSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; + +/** Samples for ManagedInstanceLongTermRetentionPolicies Get. */ +public final class ManagedInstanceLongTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyGet.json + */ + /** + * Sample code: Get the long term retention policy for the managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPolicyForTheManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceLongTermRetentionPolicies() + .getWithResponse( + "testResourceGroup", + "testInstance", + "testDatabase", + ManagedInstanceLongTermRetentionPolicyName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..ee4b960b85e0a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceLongTermRetentionPolicies ListByDatabase. */ +public final class ManagedInstanceLongTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyListByDatabase.json + */ + /** + * Sample code: Get the long term retention policies for the managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPoliciesForTheManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceLongTermRetentionPolicies() + .listByDatabase("testResourceGroup", "testInstance", "testDatabase", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsCancelSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsCancelSamples.java new file mode 100644 index 0000000000000..db53d0d647752 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsCancelSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for ManagedInstanceOperations Cancel. */ +public final class ManagedInstanceOperationsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelManagedInstanceOperation.json + */ + /** + * Sample code: Cancel the managed instance management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelTheManagedInstanceManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceOperations() + .cancelWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + UUID.fromString("11111111-1111-1111-1111-111111111111"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsGetSamples.java new file mode 100644 index 0000000000000..b7a0a156c7e95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsGetSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for ManagedInstanceOperations Get. */ +public final class ManagedInstanceOperationsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedInstanceOperation.json + */ + /** + * Sample code: Gets the managed instance management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheManagedInstanceManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceOperations() + .getWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + UUID.fromString("00000000-1111-2222-3333-444444444444"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsListByManagedInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsListByManagedInstanceSamples.java new file mode 100644 index 0000000000000..890fc6e47a16f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsListByManagedInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceOperations ListByManagedInstance. */ +public final class ManagedInstanceOperationsListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListManagedInstanceOperations.json + */ + /** + * Sample code: List the managed instance management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheManagedInstanceManagementOperations( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstanceOperations().listByManagedInstance("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8c4c3270a745f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkServiceConnectionStateProperty; + +/** Samples for ManagedInstancePrivateEndpointConnections CreateOrUpdate. */ +public final class ManagedInstancePrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstancePrivateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingManagedInstance("Default", "test-cl") + .withPrivateLinkServiceConnectionState( + new ManagedInstancePrivateLinkServiceConnectionStateProperty() + .withStatus("Approved") + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..25c5f62d8355e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateEndpointConnections Delete. */ +public final class ManagedInstancePrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstancePrivateEndpointConnections() + .delete("Default", "test-cl", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..0cd80e0811e06 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateEndpointConnections Get. */ +public final class ManagedInstancePrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateEndpointConnection(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstancePrivateEndpointConnections() + .getWithResponse("Default", "test-cl", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsListByManagedInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsListByManagedInstanceSamples.java new file mode 100644 index 0000000000000..1b172a6fb44e7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsListByManagedInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateEndpointConnections ListByManagedInstance. */ +public final class ManagedInstancePrivateEndpointConnectionsListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstancePrivateEndpointConnections().listByManagedInstance("Default", "test-cl", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateLinkResourcesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateLinkResourcesGetSamples.java new file mode 100644 index 0000000000000..17268ecf82ee9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateLinkResourcesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateLinkResources Get. */ +public final class ManagedInstancePrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateLinkResourcesGet.json + */ + /** + * Sample code: Gets a private link resource for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAPrivateLinkResourceForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstancePrivateLinkResources().getWithResponse("Default", "test-cl", "plr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateLinkResourcesListByManagedInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateLinkResourcesListByManagedInstanceSamples.java new file mode 100644 index 0000000000000..25f0019485bb6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateLinkResourcesListByManagedInstanceSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateLinkResources ListByManagedInstance. */ +public final class ManagedInstancePrivateLinkResourcesListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateLinkResourcesList.json + */ + /** + * Sample code: Gets private link resources for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateLinkResourcesForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstancePrivateLinkResources().listByManagedInstance("Default", "test-cl", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceTdeCertificatesCreateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceTdeCertificatesCreateSamples.java new file mode 100644 index 0000000000000..a899a9849ba59 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceTdeCertificatesCreateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; + +/** Samples for ManagedInstanceTdeCertificates Create. */ +public final class ManagedInstanceTdeCertificatesCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTdeCertificate.json + */ + /** + * Sample code: Upload a TDE certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void uploadATDECertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceTdeCertificates() + .create("testtdecert", "testtdecert", new TdeCertificate().withPrivateBlob("MIIXXXXXXXX"), Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..23fdce85127af --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for ManagedInstanceVulnerabilityAssessments CreateOrUpdate. */ +public final class ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateStorageAccessKeyMin.json + */ + /** + * Sample code: Create a managed instance's vulnerability assessment with minimal parameters, when + * storageAccountAccessKey is specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createAManagedInstanceSVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingManagedInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateContainerSasKeyMin.json + */ + /** + * Sample code: Create a managed instance's vulnerability assessment with minimal parameters, when + * storageContainerSasKey is specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createAManagedInstanceSVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingManagedInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a managed instance's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createAManagedInstanceSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingManagedInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsDeleteSamples.java new file mode 100644 index 0000000000000..42a5a52e2cbe2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsDeleteSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedInstanceVulnerabilityAssessments Delete. */ +public final class ManagedInstanceVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a managed instance's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeAManagedInstanceSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsGetSamples.java new file mode 100644 index 0000000000000..5f45a8ce3974a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsGetSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedInstanceVulnerabilityAssessments Get. */ +public final class ManagedInstanceVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a managed instance's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedInstanceSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsListByInstanceSamples.java new file mode 100644 index 0000000000000..4380e0bc06e21 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsListByInstanceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceVulnerabilityAssessments ListByInstance. */ +public final class ManagedInstanceVulnerabilityAssessmentsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentListByInstance.json + */ + /** + * Sample code: Get a managed instance's vulnerability assessment policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedInstanceSVulnerabilityAssessmentPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .listByInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..be675dfe618c3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLicenseType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceProxyOverride; +import com.azure.resourcemanager.sql.generated.models.PrincipalType; +import com.azure.resourcemanager.sql.generated.models.ServicePrincipal; +import com.azure.resourcemanager.sql.generated.models.ServicePrincipalType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** Samples for ManagedInstances CreateOrUpdate. */ +public final class ManagedInstancesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceCreateMin.json + */ + /** + * Sample code: Create managed instance with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createManagedInstanceWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .define("testinstance") + .withRegion("Japan East") + .withExistingResourceGroup("testrg") + .withSku(new Sku().withName("GP_Gen4").withTier("GeneralPurpose")) + .withAdministratorLogin("dummylogin") + .withAdministratorLoginPassword("PLACEHOLDER") + .withSubnetId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1") + .withLicenseType(ManagedInstanceLicenseType.LICENSE_INCLUDED) + .withVCores(8) + .withStorageSizeInGB(1024) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceCreateMax.json + */ + /** + * Sample code: Create managed instance with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createManagedInstanceWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .define("testinstance") + .withRegion("Japan East") + .withExistingResourceGroup("testrg") + .withTags(mapOf("tagKey1", "TagValue1")) + .withSku(new Sku().withName("GP_Gen5").withTier("GeneralPurpose")) + .withAdministratorLogin("dummylogin") + .withAdministratorLoginPassword("PLACEHOLDER") + .withSubnetId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1") + .withLicenseType(ManagedInstanceLicenseType.LICENSE_INCLUDED) + .withVCores(8) + .withStorageSizeInGB(1024) + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withDnsZonePartner( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance") + .withPublicDataEndpointEnabled(false) + .withProxyOverride(ManagedInstanceProxyOverride.REDIRECT) + .withTimezoneId("UTC") + .withInstancePoolId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/instancePools/pool1") + .withMaintenanceConfigurationId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1") + .withMinimalTlsVersion("1.2") + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.GEO) + .withAdministrators( + new ManagedInstanceExternalAdministrator() + .withPrincipalType(PrincipalType.USER) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withTenantId(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withAzureADOnlyAuthentication(true)) + .withServicePrincipal(new ServicePrincipal().withType(ServicePrincipalType.SYSTEM_ASSIGNED)) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesDeleteSamples.java new file mode 100644 index 0000000000000..19a4295db2e9a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstances Delete. */ +public final class ManagedInstancesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceDelete.json + */ + /** + * Sample code: Delete managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().delete("testrg", "testinstance", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesFailoverSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesFailoverSamples.java new file mode 100644 index 0000000000000..eccdd87c75b97 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesFailoverSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; + +/** Samples for ManagedInstances Failover. */ +public final class ManagedInstancesFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/FailoverManagedInstance.json + */ + /** + * Sample code: Failover a managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().failover("group1", "instanceName", ReplicaType.PRIMARY, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesGetByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..9b878c6658b9e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesGetByResourceGroupSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstances GetByResourceGroup. */ +public final class ManagedInstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json + */ + /** + * Sample code: Get managed instance with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedInstanceWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceGet.json + */ + /** + * Sample code: Get managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByInstancePoolSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByInstancePoolSamples.java new file mode 100644 index 0000000000000..cf3ddbfdda081 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByInstancePoolSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstances ListByInstancePool. */ +public final class ManagedInstancesListByInstancePoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByInstancePool.json + */ + /** + * Sample code: List managed instances by instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByInstancePool("Test1", "pool1", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByInstancePoolWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List managed instances by instance pool with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByInstancePoolWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByInstancePool("Test1", "pool1", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByManagedInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByManagedInstanceSamples.java new file mode 100644 index 0000000000000..4da4252bf739c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByManagedInstanceSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.MetricType; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; + +/** Samples for ManagedInstances ListByManagedInstance. */ +public final class ManagedInstancesListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesList.json + */ + /** + * Sample code: Obtain list of instance's top resource consuming queries. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainListOfInstanceSTopResourceConsumingQueries( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .listByManagedInstance( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + null, + null, + null, + null, + QueryTimeGrainType.PT1H, + null, + MetricType.DURATION, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesListMax.json + */ + /** + * Sample code: Obtain list of instance's top resource consuming queries. Full-blown request and response. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainListOfInstanceSTopResourceConsumingQueriesFullBlownRequestAndResponse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .listByManagedInstance( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + null, + "db1,db2", + "2020-03-10T12:00:00Z", + "2020-03-12T12:00:00Z", + QueryTimeGrainType.P1D, + null, + MetricType.CPU, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesListMin.json + */ + /** + * Sample code: Obtain list of instance's top resource consuming queries. Minimal request and response. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainListOfInstanceSTopResourceConsumingQueriesMinimalRequestAndResponse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .listByManagedInstance( + "sqlcrudtest-7398", "sqlcrudtest-4645", null, null, null, null, null, null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..969926cce3770 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByResourceGroupSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstances ListByResourceGroup. */ +public final class ManagedInstancesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByResourceGroupWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List managed instances by resource group with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByResourceGroupWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByResourceGroup("Test1", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByResourceGroup.json + */ + /** + * Sample code: List managed instances by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByResourceGroup("Test1", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListSamples.java new file mode 100644 index 0000000000000..be86294aa621f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstances List. */ +public final class ManagedInstancesListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceList.json + */ + /** + * Sample code: List managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstances(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().list(null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List managed instances with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().list(null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesUpdateSamples.java new file mode 100644 index 0000000000000..feee899386f7e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedInstance; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLicenseType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceProxyOverride; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedInstances Update. */ +public final class ManagedInstancesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceUpdateMin.json + */ + /** + * Sample code: Update managed instance with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updateManagedInstanceWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstance resource = + manager + .managedInstances() + .getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey1", "TagValue1")).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceUpdateMax.json + */ + /** + * Sample code: Update managed instance with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updateManagedInstanceWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstance resource = + manager + .managedInstances() + .getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("tagKey1", "TagValue1")) + .withSku(new Sku().withName("GP_Gen4").withTier("GeneralPurpose").withCapacity(8)) + .withAdministratorLoginPassword("PLACEHOLDER") + .withLicenseType(ManagedInstanceLicenseType.BASE_PRICE) + .withVCores(8) + .withStorageSizeInGB(448) + .withPublicDataEndpointEnabled(false) + .withProxyOverride(ManagedInstanceProxyOverride.REDIRECT) + .withMaintenanceConfigurationId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1") + .withMinimalTlsVersion("1.2") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceRemoveMaintenanceConfiguration.json + */ + /** + * Sample code: Remove maintenance policy from managed instance (select default maintenance policy). + * + * @param manager Entry point to SqlManager. + */ + public static void removeMaintenancePolicyFromManagedInstanceSelectDefaultMaintenancePolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstance resource = + manager + .managedInstances() + .getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceConfigurationId( + "/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default") + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..56495917bb553 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies CreateOrUpdate. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Update the short term retention policy for the restorable dropped database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheRestorableDroppedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .createOrUpdate( + "resourceGroup", + "testsvr", + "testdb,131403269876900000", + ManagedShortTermRetentionPolicyName.DEFAULT, + new ManagedBackupShortTermRetentionPolicyInner().withRetentionDays(14), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetSamples.java new file mode 100644 index 0000000000000..038c372bad842 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies Get. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .getWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb,131403269876900000", + ManagedShortTermRetentionPolicyName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseS.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseS.java new file mode 100644 index 0000000000000..292facf452157 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseS.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies ListByRestorableDroppedDatabase. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseS { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetListManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Get the short term retention policy list for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyListForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .listByRestorableDroppedDatabase( + "Default-SQL-SouthEastAsia", "testsvr", "testdb,131403269876900000", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateSamples.java new file mode 100644 index 0000000000000..0aca8dd7cdc8f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies Update. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Update the short term retention policy for the restorable dropped database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheRestorableDroppedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .update( + "resourceGroup", + "testsvr", + "testdb,131403269876900000", + ManagedShortTermRetentionPolicyName.DEFAULT, + new ManagedBackupShortTermRetentionPolicyInner().withRetentionDays(14), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..61559b8458d1e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedServerSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import java.util.Arrays; + +/** Samples for ManagedServerSecurityAlertPolicies CreateOrUpdate. */ +public final class ManagedServerSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertCreateMin.json + */ + /** + * Sample code: Update a managed server's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedServerSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedServerSecurityAlertPolicy resource = + manager + .managedServerSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertsPolicyState.ENABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertCreateMax.json + */ + /** + * Sample code: Update a managed server's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedServerSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedServerSecurityAlertPolicy resource = + manager + .managedServerSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertsPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Access_Anomaly", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("testSecurityAlert@microsoft.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(5) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesGetSamples.java new file mode 100644 index 0000000000000..7509b858edfcf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for ManagedServerSecurityAlertPolicies Get. */ +public final class ManagedServerSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertGet.json + */ + /** + * Sample code: Get a managed server's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedServerSThreatDetectionPolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedServerSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesListByInstanceSamples.java new file mode 100644 index 0000000000000..4274d236cfa94 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesListByInstanceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedServerSecurityAlertPolicies ListByInstance. */ +public final class ManagedServerSecurityAlertPoliciesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertListByInstance.json + */ + /** + * Sample code: Get the managed server's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedServerSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedServerSecurityAlertPolicies() + .listByInstance("securityalert-4799", "securityalert-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..85c0f99d6b7b0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesCreateOrUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for OutboundFirewallRules CreateOrUpdate. */ +public final class OutboundFirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleCreate.json + */ + /** + * Sample code: Approve or reject a outbound firewall rule with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void approveOrRejectAOutboundFirewallRuleWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .outboundFirewallRules() + .define("server.database.windows.net") + .withExistingServer("sqlcrudtest-7398", "sqlcrudtest-4645") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesDeleteSamples.java new file mode 100644 index 0000000000000..36b79f4a2b416 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for OutboundFirewallRules Delete. */ +public final class OutboundFirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleDelete.json + */ + /** + * Sample code: Deletes a outbound firewall rule with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAOutboundFirewallRuleWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .outboundFirewallRules() + .delete("sqlcrudtest-7398", "sqlcrudtest-6661", "server.database.windows.net", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesGetSamples.java new file mode 100644 index 0000000000000..e756d2a8698df --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for OutboundFirewallRules Get. */ +public final class OutboundFirewallRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleGet.json + */ + /** + * Sample code: Gets outbound firewall rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getsOutboundFirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .outboundFirewallRules() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "server.database.windows.net", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesListByServerSamples.java new file mode 100644 index 0000000000000..bd420e31dff5f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for OutboundFirewallRules ListByServer. */ +public final class OutboundFirewallRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleList.json + */ + /** + * Sample code: Gets list of outbound firewall rules on a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfOutboundFirewallRulesOnAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.outboundFirewallRules().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..6b17996d60c2b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkServiceConnectionStateStatus; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingServer("Default", "test-svr") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty() + .withStatus(PrivateLinkServiceConnectionStateStatus.APPROVED) + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..5ec9e3475ded8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .privateEndpointConnections() + .delete("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..5737297acde46 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateEndpointConnection(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsListByServerSamples.java new file mode 100644 index 0000000000000..a6daf1882eca3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByServer. */ +public final class PrivateEndpointConnectionsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.privateEndpointConnections().listByServer("Default", "test-svr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateLinkResourcesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateLinkResourcesGetSamples.java new file mode 100644 index 0000000000000..91ade0bb18084 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateLinkResourcesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateLinkResourcesGet.json + */ + /** + * Sample code: Gets a private link resource for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAPrivateLinkResourceForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.privateLinkResources().getWithResponse("Default", "test-svr", "plr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateLinkResourcesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateLinkResourcesListByServerSamples.java new file mode 100644 index 0000000000000..27355a546cc81 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateLinkResourcesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByServer. */ +public final class PrivateLinkResourcesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateLinkResourcesList.json + */ + /** + * Sample code: Gets private link resources for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateLinkResourcesForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.privateLinkResources().listByServer("Default", "test-svr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecommendedSensitivityLabelsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecommendedSensitivityLabelsUpdateSamples.java new file mode 100644 index 0000000000000..087c1e021b0a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecommendedSensitivityLabelsUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdate; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for RecommendedSensitivityLabels Update. */ +public final class RecommendedSensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsRecommendedUpdate.json + */ + /** + * Sample code: Update recommended sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateRecommendedSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .recommendedSensitivityLabels() + .updateWithResponse( + "myRG", + "myServer", + "myDatabase", + new RecommendedSensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.ENABLE) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.ENABLE) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.DISABLE) + .withSchema("dbo") + .withTable("table1") + .withColumn("column3"))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableDatabasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableDatabasesGetSamples.java new file mode 100644 index 0000000000000..574e8eecc124d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableDatabasesGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RecoverableDatabases Get. */ +public final class RecoverableDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/RecoverableDatabaseGet.json + */ + /** + * Sample code: Get a recoverable database. + * + * @param manager Entry point to SqlManager. + */ + public static void getARecoverableDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .recoverableDatabases() + .getWithResponse( + "recoverabledatabasetest-6852", + "recoverabledatabasetest-2080", + "recoverabledatabasetest-9187", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableDatabasesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableDatabasesListByServerSamples.java new file mode 100644 index 0000000000000..fa88d41c7ffef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableDatabasesListByServerSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for RecoverableDatabases ListByServer. */ +public final class RecoverableDatabasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/RecoverableDatabaseList.json + */ + /** + * Sample code: Get list of restorable dropped databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getListOfRestorableDroppedDatabases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .recoverableDatabases() + .listByServer("recoverabledatabasetest-1234", "recoverabledatabasetest-7177", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableManagedDatabasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableManagedDatabasesGetSamples.java new file mode 100644 index 0000000000000..1fd50cabd28b3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableManagedDatabasesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RecoverableManagedDatabases Get. */ +public final class RecoverableManagedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetRecoverableManagedDatabase.json + */ + /** + * Sample code: Gets a recoverable databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void getsARecoverableDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.recoverableManagedDatabases().getWithResponse("Test1", "managedInstance", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableManagedDatabasesListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableManagedDatabasesListByInstanceSamples.java new file mode 100644 index 0000000000000..f4d9dafcd5779 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableManagedDatabasesListByInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RecoverableManagedDatabases ListByInstance. */ +public final class RecoverableManagedDatabasesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListRecoverableManagedDatabasesByServer.json + */ + /** + * Sample code: List recoverable databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listRecoverableDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.recoverableManagedDatabases().listByInstance("Test1", "managedInstance", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksDeleteSamples.java new file mode 100644 index 0000000000000..1e197dbb1078c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks Delete. */ +public final class ReplicationLinksDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ReplicationLinkDelete.json + */ + /** + * Sample code: Delete a replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .deleteWithResponse( + "sqlcrudtest-4799", "sqlcrudtest-6440", "testdb", "5b301b68-03f6-4b26-b0f4-73ebb8634238", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksFailoverAllowDataLossSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksFailoverAllowDataLossSamples.java new file mode 100644 index 0000000000000..aa938891d4318 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksFailoverAllowDataLossSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks FailoverAllowDataLoss. */ +public final class ReplicationLinksFailoverAllowDataLossSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ReplicationLinkFailover.json + */ + /** + * Sample code: Failover a replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .failoverAllowDataLoss( + "sqlcrudtest-8931", "sqlcrudtest-2137", "testdb", "f0550bf5-07ce-4270-8e4b-71737975973a", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksFailoverSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksFailoverSamples.java new file mode 100644 index 0000000000000..5707e7260d4eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksFailoverSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks Failover. */ +public final class ReplicationLinksFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ReplicationLinkFailover.json + */ + /** + * Sample code: Failover a replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .failover( + "sqlcrudtest-8931", "sqlcrudtest-2137", "testdb", "f0550bf5-07ce-4270-8e4b-71737975973a", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksGetSamples.java new file mode 100644 index 0000000000000..ad595dd3d9ccf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks Get. */ +public final class ReplicationLinksGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ReplicationLinkGet.json + */ + /** + * Sample code: Gets the replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .getWithResponse("Default", "sourcesvr", "gamma-db", "4891ca10-ebd0-47d7-9182-c722651780fb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksListByDatabaseSamples.java new file mode 100644 index 0000000000000..18f0bbd3daf4d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksListByDatabaseSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks ListByDatabase. */ +public final class ReplicationLinksListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ReplicationLinkListByDatabase.json + */ + /** + * Sample code: List replication links on server on database. + * + * @param manager Entry point to SqlManager. + */ + public static void listReplicationLinksOnServerOnDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.replicationLinks().listByDatabase("Default", "sourcesvr", "tetha-db", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksListByServerSamples.java new file mode 100644 index 0000000000000..d03df1bebccef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks ListByServer. */ +public final class ReplicationLinksListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ReplicationLinkListByServer.json + */ + /** + * Sample code: List replication links on server. + * + * @param manager Entry point to SqlManager. + */ + public static void listReplicationLinksOnServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.replicationLinks().listByServer("Default", "sourcesvr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksUnlinkSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksUnlinkSamples.java new file mode 100644 index 0000000000000..dbc9bfdd0d44a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksUnlinkSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.UnlinkParameters; + +/** Samples for ReplicationLinks Unlink. */ +public final class ReplicationLinksUnlinkSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ReplicationLinkUnlink.json + */ + /** + * Sample code: Delete replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .unlink( + "sqlcrudtest-8931", + "sqlcrudtest-2137", + "testdb", + "f0550bf5-07ce-4270-8e4b-71737975973a", + new UnlinkParameters().withForcedTermination(true), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedDatabasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedDatabasesGetSamples.java new file mode 100644 index 0000000000000..08bdb5ab00387 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedDatabasesGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedDatabases Get. */ +public final class RestorableDroppedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetRestorableDroppedDatabase.json + */ + /** + * Sample code: Gets a restorable dropped database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsARestorableDroppedDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorableDroppedDatabases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb,131403269876900000", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedDatabasesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedDatabasesListByServerSamples.java new file mode 100644 index 0000000000000..fbfb497e5c47f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedDatabasesListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedDatabases ListByServer. */ +public final class RestorableDroppedDatabasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListRestorableDroppedDatabasesByServer.json + */ + /** + * Sample code: Gets a list of restorable dropped databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfRestorableDroppedDatabases( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorableDroppedDatabases().listByServer("Default-SQL-SouthEastAsia", "testsvr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedManagedDatabasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedManagedDatabasesGetSamples.java new file mode 100644 index 0000000000000..15626ae356aef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedManagedDatabasesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedManagedDatabases Get. */ +public final class RestorableDroppedManagedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetRestorableDroppedManagedDatabase.json + */ + /** + * Sample code: Gets a restorable dropped managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsARestorableDroppedManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorableDroppedManagedDatabases() + .getWithResponse("Test1", "managedInstance", "testdb,131403269876900000", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedManagedDatabasesListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedManagedDatabasesListByInstanceSamples.java new file mode 100644 index 0000000000000..8507a5aa5d866 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedManagedDatabasesListByInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedManagedDatabases ListByInstance. */ +public final class RestorableDroppedManagedDatabasesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/RestorableDroppedManagedDatabaseListByManagedInstance.json + */ + /** + * Sample code: List restorable dropped databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listRestorableDroppedDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorableDroppedManagedDatabases().listByInstance("Test1", "managedInstance", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsCreateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsCreateSamples.java new file mode 100644 index 0000000000000..9cc1d5e5ff0b3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsCreateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.CreateDatabaseRestorePointDefinition; + +/** Samples for RestorePoints Create. */ +public final class RestorePointsCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsPost.json + */ + /** + * Sample code: Creates datawarehouse database restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void createsDatawarehouseDatabaseRestorePoint( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .create( + "Default-SQL-SouthEastAsia", + "testserver", + "testDatabase", + new CreateDatabaseRestorePointDefinition().withRestorePointLabel("mylabel"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsDeleteSamples.java new file mode 100644 index 0000000000000..e005d3e56d107 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePoints Delete. */ +public final class RestorePointsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsDelete.json + */ + /** + * Sample code: Deletes a restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesARestorePoint(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .deleteWithResponse( + "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsGetSamples.java new file mode 100644 index 0000000000000..c2e3980936732 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePoints Get. */ +public final class RestorePointsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsGet.json + */ + /** + * Sample code: Gets a database restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseRestorePoint(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DataWarehouseRestorePointsGet.json + */ + /** + * Sample code: Gets a datawarehouse database restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatawarehouseDatabaseRestorePoint( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsListByDatabaseSamples.java new file mode 100644 index 0000000000000..7af51718ef889 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsListByDatabaseSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePoints ListByDatabase. */ +public final class RestorePointsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsListByDatabase.json + */ + /** + * Sample code: List database restore points. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseRestorePoints(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorePoints().listByDatabase("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DataWarehouseRestorePointsListByDatabase.json + */ + /** + * Sample code: List datawarehouse database restore points. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatawarehouseDatabaseRestorePoints( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorePoints().listByDatabase("Default-SQL-SouthEastAsia", "testserver", "testDatabase", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..1c7968a9624d7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; + +/** Samples for SensitivityLabels CreateOrUpdate. */ +public final class SensitivityLabelsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelCreateMax.json + */ + /** + * Sample code: Updates the sensitivity label of a given column with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesTheSensitivityLabelOfAGivenColumnWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .createOrUpdateWithResponse( + "myRG", + "myServer", + "myDatabase", + "dbo", + "myTable", + "myColumn", + new SensitivityLabelInner() + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646") + .withRank(SensitivityLabelRank.LOW), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsDeleteSamples.java new file mode 100644 index 0000000000000..0166f539fa128 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels Delete. */ +public final class SensitivityLabelsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelDelete.json + */ + /** + * Sample code: Deletes the sensitivity label of a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesTheSensitivityLabelOfAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .deleteWithResponse("myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsDisableRecommendationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsDisableRecommendationSamples.java new file mode 100644 index 0000000000000..d5159dbe53f99 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsDisableRecommendationSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels DisableRecommendation. */ +public final class SensitivityLabelsDisableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/RecommendedColumnSensitivityLabelDisable.json + */ + /** + * Sample code: Disables sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void disablesSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .disableRecommendationWithResponse( + "myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsEnableRecommendationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsEnableRecommendationSamples.java new file mode 100644 index 0000000000000..8b12969eb7075 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsEnableRecommendationSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels EnableRecommendation. */ +public final class SensitivityLabelsEnableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/RecommendedColumnSensitivityLabelEnable.json + */ + /** + * Sample code: Enables sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void enablesSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .enableRecommendationWithResponse( + "myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsGetSamples.java new file mode 100644 index 0000000000000..b01ef44938993 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsGetSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; + +/** Samples for SensitivityLabels Get. */ +public final class SensitivityLabelsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelGet.json + */ + /** + * Sample code: Gets the sensitivity label of a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheSensitivityLabelOfAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .getWithResponse( + "myRG", + "myServer", + "myDatabase", + "dbo", + "myTable", + "myColumn", + SensitivityLabelSource.CURRENT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsListCurrentByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsListCurrentByDatabaseSamples.java new file mode 100644 index 0000000000000..06b8c95026873 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsListCurrentByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels ListCurrentByDatabase. */ +public final class SensitivityLabelsListCurrentByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsListByDatabaseWithSourceCurrent.json + */ + /** + * Sample code: Gets the current sensitivity labels of a given database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheCurrentSensitivityLabelsOfAGivenDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .listCurrentByDatabase("myRG", "myServer", "myDatabase", null, null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsListRecommendedByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsListRecommendedByDatabaseSamples.java new file mode 100644 index 0000000000000..d80a3bb9e0290 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsListRecommendedByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels ListRecommendedByDatabase. */ +public final class SensitivityLabelsListRecommendedByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsListByDatabaseWithSourceRecommended.json + */ + /** + * Sample code: Gets the recommended sensitivity labels of a given database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheRecommendedSensitivityLabelsOfAGivenDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .listRecommendedByDatabase("myRG", "myServer", "myDatabase", null, null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsUpdateSamples.java new file mode 100644 index 0000000000000..bd71affa9ec29 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsUpdateSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for SensitivityLabels Update. */ +public final class SensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsCurrentUpdate.json + */ + /** + * Sample code: Update sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .updateWithResponse( + "myRG", + "myServer", + "myDatabase", + new SensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("Highly Confidential") + .withLabelId("3A477B16-9423-432B-AA97-6069B481CEC3") + .withInformationType("Financial") + .withInformationTypeId("1D3652D6-422C-4115-82F1-65DAEBC665C8") + .withRank(SensitivityLabelRank.LOW)), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646") + .withRank(SensitivityLabelRank.CRITICAL)), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.REMOVE) + .withSchema("dbo") + .withTable("Table1") + .withColumn("Column3"))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsGetSamples.java new file mode 100644 index 0000000000000..b49b51d054033 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAdvisors Get. */ +public final class ServerAdvisorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorGet.json + */ + /** + * Sample code: Get server advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAdvisors().getWithResponse("workloadinsight-demos", "misosisvr", "CreateIndex", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsListByServerSamples.java new file mode 100644 index 0000000000000..f650396d80077 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsListByServerSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAdvisors ListByServer. */ +public final class ServerAdvisorsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorList.json + */ + /** + * Sample code: List of server advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfServerAdvisors(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAdvisors().listByServerWithResponse("workloadinsight-demos", "misosisvr", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerRecommendedActionListExpand.json + */ + /** + * Sample code: List of server recommended actions for all advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfServerRecommendedActionsForAllAdvisors( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAdvisors() + .listByServerWithResponse("workloadinsight-demos", "misosisvr", "recommendedActions", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsUpdateSamples.java new file mode 100644 index 0000000000000..8be8609ff97cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatus; + +/** Samples for ServerAdvisors Update. */ +public final class ServerAdvisorsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorUpdate.json + */ + /** + * Sample code: Update server advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void updateServerAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAdvisors() + .updateWithResponse( + "workloadinsight-demos", + "misosisvr", + "CreateIndex", + new AdvisorInner().withAutoExecuteStatus(AutoExecuteStatus.DISABLED), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAutomaticTuningGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAutomaticTuningGetSamples.java new file mode 100644 index 0000000000000..d5e04910834f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAutomaticTuningGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAutomaticTuning Get. */ +public final class ServerAutomaticTuningGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningGet.json + */ + /** + * Sample code: Get a server's automatic tuning settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSAutomaticTuningSettings(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAutomaticTunings().getWithResponse("default-sql-onebox", "testsvr11", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAutomaticTuningUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAutomaticTuningUpdateSamples.java new file mode 100644 index 0000000000000..bdea78e47d811 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAutomaticTuningUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptionModeDesired; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerOptions; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ServerAutomaticTuning Update. */ +public final class ServerAutomaticTuningUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningUpdateMax.json + */ + /** + * Sample code: Updates server automatic tuning settings with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesServerAutomaticTuningSettingsWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + new ServerAutomaticTuningInner() + .withDesiredState(AutomaticTuningServerMode.AUTO) + .withOptions( + mapOf( + "createIndex", + new AutomaticTuningServerOptions().withDesiredState(AutomaticTuningOptionModeDesired.OFF), + "dropIndex", + new AutomaticTuningServerOptions().withDesiredState(AutomaticTuningOptionModeDesired.ON), + "forceLastGoodPlan", + new AutomaticTuningServerOptions() + .withDesiredState(AutomaticTuningOptionModeDesired.DEFAULT))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningUpdateMin.json + */ + /** + * Sample code: Updates server automatic tuning settings with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesServerAutomaticTuningSettingsWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + new ServerAutomaticTuningInner().withDesiredState(AutomaticTuningServerMode.AUTO), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..438b8489ec8e9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.AdministratorType; +import java.util.UUID; + +/** Samples for ServerAzureADAdministrators CreateOrUpdate. */ +public final class ServerAzureADAdministratorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates an existing Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAnExistingAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADAdministrators() + .define(AdministratorName.ACTIVE_DIRECTORY) + .withExistingServer("sqlcrudtest-4799", "sqlcrudtest-6440") + .withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")) + .withTenantId(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsDeleteSamples.java new file mode 100644 index 0000000000000..eecaea09b4902 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ServerAzureADAdministrators Delete. */ +public final class ServerAzureADAdministratorsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorDelete.json + */ + /** + * Sample code: Delete Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADAdministrators() + .delete("sqlcrudtest-4799", "sqlcrudtest-6440", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsGetSamples.java new file mode 100644 index 0000000000000..4e964a86711d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ServerAzureADAdministrators Get. */ +public final class ServerAzureADAdministratorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorGet.json + */ + /** + * Sample code: Gets a Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADAdministrators() + .getWithResponse("sqlcrudtest-4799", "sqlcrudtest-6440", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsListByServerSamples.java new file mode 100644 index 0000000000000..e90d8436ca89a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAzureADAdministrators ListByServer. */ +public final class ServerAzureADAdministratorsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorList.json + */ + /** + * Sample code: Gets a list of Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAzureADAdministrators().listByServer("sqlcrudtest-4799", "sqlcrudtest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..cc582250a4728 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ServerAzureADOnlyAuthentications CreateOrUpdate. */ +public final class ServerAzureADOnlyAuthenticationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADOnlyAuthentications() + .define(AuthenticationName.DEFAULT) + .withExistingServer("sqlcrudtest-4799", "sqlcrudtest-6440") + .withAzureADOnlyAuthentication(false) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsDeleteSamples.java new file mode 100644 index 0000000000000..7fe836bc424ca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ServerAzureADOnlyAuthentications Delete. */ +public final class ServerAzureADOnlyAuthenticationsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthDelete.json + */ + /** + * Sample code: Deletes Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADOnlyAuthentications() + .delete("sqlcrudtest-4799", "sqlcrudtest-6440", AuthenticationName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsGetSamples.java new file mode 100644 index 0000000000000..5ad7b7488550c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ServerAzureADOnlyAuthentications Get. */ +public final class ServerAzureADOnlyAuthenticationsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthGet.json + */ + /** + * Sample code: Gets a Azure Active Directory only authentication property. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAAzureActiveDirectoryOnlyAuthenticationProperty( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADOnlyAuthentications() + .getWithResponse("sqlcrudtest-4799", "sqlcrudtest-6440", AuthenticationName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsListByServerSamples.java new file mode 100644 index 0000000000000..f53afa79eec0d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAzureADOnlyAuthentications ListByServer. */ +public final class ServerAzureADOnlyAuthenticationsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthList.json + */ + /** + * Sample code: Gets a list of Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAzureADOnlyAuthentications().listByServer("sqlcrudtest-4799", "sqlcrudtest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8cf152f01bec8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerBlobAuditingPolicy; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for ServerBlobAuditingPolicies CreateOrUpdate. */ +public final class ServerBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingCreateMin.json + */ + /** + * Sample code: Update a server's blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerBlobAuditingPolicy resource = + manager + .serverBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingCreateMax.json + */ + /** + * Sample code: Update a server's blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerBlobAuditingPolicy resource = + manager + .serverBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP", + "FAILED_DATABASE_AUTHENTICATION_GROUP", + "BATCH_COMPLETED_GROUP")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesGetSamples.java new file mode 100644 index 0000000000000..c886e2db926ae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerBlobAuditingPolicies Get. */ +public final class ServerBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingGet.json + */ + /** + * Sample code: Get a server's blob auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSBlobAuditingPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesListByServerSamples.java new file mode 100644 index 0000000000000..af91d2a167fdc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesListByServerSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerBlobAuditingPolicies ListByServer. */ +public final class ServerBlobAuditingPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAuditingSettingsList.json + */ + /** + * Sample code: List auditing settings of a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listAuditingSettingsOfAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverBlobAuditingPolicies() + .listByServer("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..b2d0db4a13dcd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksCreateOrUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for ServerCommunicationLinks CreateOrUpdate. */ +public final class ServerCommunicationLinksCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkCreateOrUpdate.json + */ + /** + * Sample code: Create a server communication link. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerCommunicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverCommunicationLinks() + .define("link1") + .withExistingServer("sqlcrudtest-7398", "sqlcrudtest-4645") + .withPartnerServer("sqldcrudtest-test") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksDeleteSamples.java new file mode 100644 index 0000000000000..f0b60343bd5ae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksDeleteSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerCommunicationLinks Delete. */ +public final class ServerCommunicationLinksDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkDelete.json + */ + /** + * Sample code: Delete a server communication link. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAServerCommunicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverCommunicationLinks() + .deleteWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "link1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksGetSamples.java new file mode 100644 index 0000000000000..39222d1599efe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerCommunicationLinks Get. */ +public final class ServerCommunicationLinksGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkGet.json + */ + /** + * Sample code: Get a server communication link. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerCommunicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverCommunicationLinks() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "link1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksListByServerSamples.java new file mode 100644 index 0000000000000..f7126302e397e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerCommunicationLinks ListByServer. */ +public final class ServerCommunicationLinksListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkList.json + */ + /** + * Sample code: List server communication links. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerCommunicationLinks(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverCommunicationLinks().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..9afac1c560c9f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionPolicy; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionType; + +/** Samples for ServerConnectionPolicies CreateOrUpdate. */ +public final class ServerConnectionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesUpdate.json + */ + /** + * Sample code: Updates a server connection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesAServerConnectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerConnectionPolicy resource = + manager + .serverConnectionPolicies() + .getWithResponse("testrg", "testserver", ConnectionPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withConnectionType(ServerConnectionType.REDIRECT).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesGetSamples.java new file mode 100644 index 0000000000000..53f1d05156848 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; + +/** Samples for ServerConnectionPolicies Get. */ +public final class ServerConnectionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesGet.json + */ + /** + * Sample code: Gets a server connection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAServerConnectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverConnectionPolicies() + .getWithResponse("rgtest-12", "servertest-6285", ConnectionPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesListByServerSamples.java new file mode 100644 index 0000000000000..9da46bfaf0c11 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerConnectionPolicies ListByServer. */ +public final class ServerConnectionPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesList.json + */ + /** + * Sample code: Lists a servers connection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void listsAServersConnectionPolicies(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverConnectionPolicies().listByServer("rgtest-12", "servertest-6285", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..3792536cc2cd5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerDevOpsAuditingSettings; +import java.util.UUID; + +/** Samples for ServerDevOpsAuditSettings CreateOrUpdate. */ +public final class ServerDevOpsAuditSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDevOpsAuditCreateMin.json + */ + /** + * Sample code: Update a server's DevOps audit settings with minimal input. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSDevOpsAuditSettingsWithMinimalInput( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerDevOpsAuditingSettings resource = + manager + .serverDevOpsAuditSettings() + .getWithResponse("devAuditTestRG", "devOpsAuditTestSvr", "default", Context.NONE) + .getValue(); + resource + .update() + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDevOpsAuditCreateMax.json + */ + /** + * Sample code: Update a server's DevOps audit settings with all params. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSDevOpsAuditSettingsWithAllParams( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerDevOpsAuditingSettings resource = + manager + .serverDevOpsAuditSettings() + .getWithResponse("devAuditTestRG", "devOpsAuditTestSvr", "default", Context.NONE) + .getValue(); + resource + .update() + .withIsAzureMonitorTargetEnabled(true) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsGetSamples.java new file mode 100644 index 0000000000000..ff754d72dccaf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerDevOpsAuditSettings Get. */ +public final class ServerDevOpsAuditSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDevOpsAuditGet.json + */ + /** + * Sample code: Get a server's DevOps audit settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSDevOpsAuditSettings(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverDevOpsAuditSettings() + .getWithResponse("devAuditTestRG", "devOpsAuditTestSvr", "default", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsListByServerSamples.java new file mode 100644 index 0000000000000..e7652c29f2429 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerDevOpsAuditSettings ListByServer. */ +public final class ServerDevOpsAuditSettingsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDevOpsAuditSettingsList.json + */ + /** + * Sample code: List DevOps audit settings of a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listDevOpsAuditSettingsOfAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDevOpsAuditSettings().listByServer("devAuditTestRG", "devOpsAuditTestSvr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesAcquireSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesAcquireSamples.java new file mode 100644 index 0000000000000..7a90a3ec7e490 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesAcquireSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliasAcquisition; + +/** Samples for ServerDnsAliases Acquire. */ +public final class ServerDnsAliasesAcquireSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasAcquire.json + */ + /** + * Sample code: Acquire server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void acquireServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverDnsAliases() + .acquire( + "Default", + "dns-alias-new-server", + "dns-alias-name-1", + new ServerDnsAliasAcquisition() + .withOldServerDnsAliasId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-old-server/dnsAliases/dns-alias-name-1"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..209cc36c5a9ab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesCreateOrUpdateSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases CreateOrUpdate. */ +public final class ServerDnsAliasesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasCreateOrUpdate.json + */ + /** + * Sample code: Create server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void createServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().createOrUpdate("Default", "dns-alias-server", "dns-alias-name-1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesDeleteSamples.java new file mode 100644 index 0000000000000..c194c81d1725b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases Delete. */ +public final class ServerDnsAliasesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasDelete.json + */ + /** + * Sample code: Delete server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().delete("Default", "dns-alias-server", "dns-alias-name-1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesGetSamples.java new file mode 100644 index 0000000000000..ac8096a9e78e0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases Get. */ +public final class ServerDnsAliasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasGet.json + */ + /** + * Sample code: Get server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().getWithResponse("Default", "dns-alias-server", "dns-alias-name-1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesListByServerSamples.java new file mode 100644 index 0000000000000..fcf03c308c6e7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases ListByServer. */ +public final class ServerDnsAliasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasList.json + */ + /** + * Sample code: List server DNS aliases. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerDNSAliases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().listByServer("Default", "dns-alias-server", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..20d72e7b3ed41 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +/** Samples for ServerKeys CreateOrUpdate. */ +public final class ServerKeysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates a server key. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAServerKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverKeys() + .define("someVault_someKey_01234567890123456789012345678901") + .withExistingServer("sqlcrudtest-7398", "sqlcrudtest-4645") + .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) + .withUri("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysDeleteSamples.java new file mode 100644 index 0000000000000..435b6cc3b469a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerKeys Delete. */ +public final class ServerKeysDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyDelete.json + */ + /** + * Sample code: Delete the server key. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheServerKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverKeys() + .delete( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysGetSamples.java new file mode 100644 index 0000000000000..c204784ac8601 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerKeys Get. */ +public final class ServerKeysGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyGet.json + */ + /** + * Sample code: Get the server key. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheServerKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverKeys() + .getWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysListByServerSamples.java new file mode 100644 index 0000000000000..d1c09f1e931db --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerKeys ListByServer. */ +public final class ServerKeysListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyList.json + */ + /** + * Sample code: List the server keys by server. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheServerKeysByServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverKeys().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerOperationsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerOperationsListByServerSamples.java new file mode 100644 index 0000000000000..e1fb16be20e17 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerOperationsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerOperations ListByServer. */ +public final class ServerOperationsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListServerOperations.json + */ + /** + * Sample code: List the server management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheServerManagementOperations(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverOperations().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5b77b516c5457 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicy; +import java.util.Arrays; + +/** Samples for ServerSecurityAlertPolicies CreateOrUpdate. */ +public final class ServerSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsCreateMin.json + */ + /** + * Sample code: Update a server's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerSecurityAlertPolicy resource = + manager + .serverSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertsPolicyState.ENABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsCreateMax.json + */ + /** + * Sample code: Update a server's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerSecurityAlertPolicy resource = + manager + .serverSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertsPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Access_Anomaly", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("testSecurityAlert@microsoft.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(5) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesGetSamples.java new file mode 100644 index 0000000000000..849d45ef4505d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for ServerSecurityAlertPolicies Get. */ +public final class ServerSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsGet.json + */ + /** + * Sample code: Get a server's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSThreatDetectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesListByServerSamples.java new file mode 100644 index 0000000000000..1273abef09d7a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerSecurityAlertPolicies ListByServer. */ +public final class ServerSecurityAlertPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsListByServer.json + */ + /** + * Sample code: List the server's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheServerSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverSecurityAlertPolicies().listByServer("securityalert-4799", "securityalert-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ef754c849dffb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesCreateOrUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for ServerTrustCertificates CreateOrUpdate. */ +public final class ServerTrustCertificatesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesCreate.json + */ + /** + * Sample code: Create server trust certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void createServerTrustCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverTrustCertificates() + .define("customerCertificateName") + .withExistingManagedInstance("testrg", "testcl") + .withPublicBlob("308203AE30820296A0030201020210") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesDeleteSamples.java new file mode 100644 index 0000000000000..793f57fa90bb0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerTrustCertificates Delete. */ +public final class ServerTrustCertificatesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesDelete.json + */ + /** + * Sample code: Delete server trust certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteServerTrustCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustCertificates().delete("testrg", "testcl", "customerCertificateName", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesGetSamples.java new file mode 100644 index 0000000000000..e2996ea325886 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerTrustCertificates Get. */ +public final class ServerTrustCertificatesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesGet.json + */ + /** + * Sample code: Gets server trust certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void getsServerTrustCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustCertificates().getWithResponse("testrg", "testcl", "customerCertificateName", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesListByInstanceSamples.java new file mode 100644 index 0000000000000..b0466b1f1f54e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesListByInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerTrustCertificates ListByInstance. */ +public final class ServerTrustCertificatesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesListByInstance.json + */ + /** + * Sample code: Gets a list of server trust certificates on a given server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfServerTrustCertificatesOnAGivenServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustCertificates().listByInstance("testrg", "testcl", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..26ad5cea261ec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.ServerInfo; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroupPropertiesTrustScopesItem; +import java.util.Arrays; + +/** Samples for ServerTrustGroups CreateOrUpdate. */ +public final class ServerTrustGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupCreate.json + */ + /** + * Sample code: Create server trust group. + * + * @param manager Entry point to SqlManager. + */ + public static void createServerTrustGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverTrustGroups() + .define("server-trust-group-test") + .withExistingLocation("Default", "Japan East") + .withGroupMembers( + Arrays + .asList( + new ServerInfo() + .withServerId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-1"), + new ServerInfo() + .withServerId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-2"))) + .withTrustScopes( + Arrays + .asList( + ServerTrustGroupPropertiesTrustScopesItem.GLOBAL_TRANSACTIONS, + ServerTrustGroupPropertiesTrustScopesItem.SERVICE_BROKER)) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsDeleteSamples.java new file mode 100644 index 0000000000000..ed415cda20be2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups Delete. */ +public final class ServerTrustGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupDelete.json + */ + /** + * Sample code: Drop server trust group. + * + * @param manager Entry point to SqlManager. + */ + public static void dropServerTrustGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().delete("Default", "Japan East", "server-trust-group-test", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsGetSamples.java new file mode 100644 index 0000000000000..1539b68ad4e77 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups Get. */ +public final class ServerTrustGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupGet.json + */ + /** + * Sample code: Get server trust group. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerTrustGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().getWithResponse("Default", "Japan East", "server-trust-group-test", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsListByInstanceSamples.java new file mode 100644 index 0000000000000..f1d33ee0f0b86 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsListByInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups ListByInstance. */ +public final class ServerTrustGroupsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupListByManagedInstance.json + */ + /** + * Sample code: List server trust groups by managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerTrustGroupsByManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().listByInstance("Default-SQL-SouthEastAsia", "managedInstance-1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsListByLocationSamples.java new file mode 100644 index 0000000000000..3e2d3f7ee5885 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsListByLocationSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups ListByLocation. */ +public final class ServerTrustGroupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupList.json + */ + /** + * Sample code: List server trust groups. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerTrustGroups(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().listByLocation("Default", "Japan East", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerUsagesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerUsagesListByServerSamples.java new file mode 100644 index 0000000000000..ba3b9c0505adc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerUsagesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerUsages ListByServer. */ +public final class ServerUsagesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ServerUsageMetricsList.json + */ + /** + * Sample code: List servers usages. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersUsages(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverUsages().listByServer("sqlcrudtest-6730", "sqlcrudtest-9007", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8d1bfe2a0c26d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for ServerVulnerabilityAssessments CreateOrUpdate. */ +public final class ServerVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a server's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateStorageAccessKeyMin.json + */ + /** + * Sample code: Create a server's vulnerability assessment with minimal parameters, when storageAccountAccessKey is + * specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerSVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateContainerSasKeyMin.json + */ + /** + * Sample code: Create a server's vulnerability assessment with minimal parameters, when storageContainerSasKey is + * specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerSVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsDeleteSamples.java new file mode 100644 index 0000000000000..87daa61510e7c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsDeleteSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ServerVulnerabilityAssessments Delete. */ +public final class ServerVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a server's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeAServerSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsGetSamples.java new file mode 100644 index 0000000000000..611f0bde01b07 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsGetSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ServerVulnerabilityAssessments Get. */ +public final class ServerVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a server's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSVulnerabilityAssessment(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsListByServerSamples.java new file mode 100644 index 0000000000000..745018ad4d304 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsListByServerSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerVulnerabilityAssessments ListByServer. */ +public final class ServerVulnerabilityAssessmentsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentListByServer.json + */ + /** + * Sample code: Get a server's vulnerability assessment policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSVulnerabilityAssessmentPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .listByServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersCheckNameAvailabilitySamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..5b1fddb51db35 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersCheckNameAvailabilitySamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityRequest; + +/** Samples for Servers CheckNameAvailability. */ +public final class ServersCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerAvailable.json + */ + /** + * Sample code: Check for a server name that is available. + * + * @param manager Entry point to SqlManager. + */ + public static void checkForAServerNameThatIsAvailable(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("server1"), Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerAlreadyExists.json + */ + /** + * Sample code: Check for a server name that already exists. + * + * @param manager Entry point to SqlManager. + */ + public static void checkForAServerNameThatAlreadyExists( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("server1"), Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerInvalid.json + */ + /** + * Sample code: Check for a server name that is invalid. + * + * @param manager Entry point to SqlManager. + */ + public static void checkForAServerNameThatIsInvalid(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("SERVER1"), Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..62852eeb1e206 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.PrincipalType; +import com.azure.resourcemanager.sql.generated.models.ServerExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ServerNetworkAccessFlag; +import java.util.UUID; + +/** Samples for Servers CreateOrUpdate. */ +public final class ServersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerCreate.json + */ + /** + * Sample code: Create server. + * + * @param manager Entry point to SqlManager. + */ + public static void createServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .define("sqlcrudtest-4645") + .withRegion("Japan East") + .withExistingResourceGroup("sqlcrudtest-7398") + .withAdministratorLogin("dummylogin") + .withAdministratorLoginPassword("PLACEHOLDER") + .withPublicNetworkAccess(ServerNetworkAccessFlag.ENABLED) + .withAdministrators( + new ServerExternalAdministrator() + .withPrincipalType(PrincipalType.USER) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withTenantId(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withAzureADOnlyAuthentication(true)) + .withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag.ENABLED) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersDeleteSamples.java new file mode 100644 index 0000000000000..7f93fec99f7b9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Servers Delete. */ +public final class ServersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerDelete.json + */ + /** + * Sample code: Delete server. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().delete("sqlcrudtest-7398", "sqlcrudtest-6661", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersGetByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..b5aa04e430279 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersGetByResourceGroupSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for Servers GetByResourceGroup. */ +public final class ServersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerGetWithExpandEqualsAdministrators.json + */ + /** + * Sample code: Get server with $expand=administrators. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerWithExpandAdministrators(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().getByResourceGroupWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerGet.json + */ + /** + * Sample code: Get server. + * + * @param manager Entry point to SqlManager. + */ + public static void getServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().getByResourceGroupWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersImportDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersImportDatabaseSamples.java new file mode 100644 index 0000000000000..b44cc468a96f1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersImportDatabaseSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ImportNewDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.NetworkIsolationSettings; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for Servers ImportDatabase. */ +public final class ServersImportDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ImportNewDatabaseWithNetworkIsolation.json + */ + /** + * Sample code: Imports to a new database, using private link for the SQL server and storage account. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToANewDatabaseUsingPrivateLinkForTheSQLServerAndStorageAccount( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .importDatabase( + "Default-SQL-SouthEastAsia", + "testsvr", + new ImportNewDatabaseDefinition() + .withDatabaseName("testdb") + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey( + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("password") + .withAuthenticationType("Sql") + .withNetworkIsolation( + new NetworkIsolationSettings() + .withStorageAccountResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink") + .withSqlServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ImportNewDatabase.json + */ + /** + * Sample code: Imports to a new database. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToANewDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .importDatabase( + "Default-SQL-SouthEastAsia", + "testsvr", + new ImportNewDatabaseDefinition() + .withDatabaseName("testdb") + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey( + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("password") + .withAuthenticationType("Sql"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersListByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..55157947d6cd3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersListByResourceGroupSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for Servers ListByResourceGroup. */ +public final class ServersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListByResourceGroup.json + */ + /** + * Sample code: List servers by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().listByResourceGroup("sqlcrudtest-7398", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListByResourceGroupWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List servers by resource group with $expand=administrators. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersByResourceGroupWithExpandAdministrators( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().listByResourceGroup("sqlcrudtest-7398", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersListSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersListSamples.java new file mode 100644 index 0000000000000..b6f6a33eab9b9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersListSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for Servers List. */ +public final class ServersListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerList.json + */ + /** + * Sample code: List servers. + * + * @param manager Entry point to SqlManager. + */ + public static void listServers(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().list(null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List servers with expand equals administrators. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersWithExpandEqualsAdministrators( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().list(null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersUpdateSamples.java new file mode 100644 index 0000000000000..c80a23f7b180d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.Server; +import com.azure.resourcemanager.sql.generated.models.ServerNetworkAccessFlag; + +/** Samples for Servers Update. */ +public final class ServersUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerUpdate.json + */ + /** + * Sample code: Update a server. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + Server resource = + manager + .servers() + .getByResourceGroupWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE) + .getValue(); + resource + .update() + .withAdministratorLoginPassword("placeholder") + .withPublicNetworkAccess(ServerNetworkAccessFlag.DISABLED) + .withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag.ENABLED) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServiceObjectivesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServiceObjectivesGetSamples.java new file mode 100644 index 0000000000000..c4fe563b31f5c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServiceObjectivesGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceObjectives Get. */ +public final class ServiceObjectivesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveGet.json + */ + /** + * Sample code: Get a service objective. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServiceObjective(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serviceObjectives() + .getWithResponse("group1", "sqlcrudtest", "29dd7459-4a7c-4e56-be22-f0adda49440d", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServiceObjectivesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServiceObjectivesListByServerSamples.java new file mode 100644 index 0000000000000..c54ae1456bb94 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServiceObjectivesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceObjectives ListByServer. */ +public final class ServiceObjectivesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveList.json + */ + /** + * Sample code: List service objectives. + * + * @param manager Entry point to SqlManager. + */ + public static void listServiceObjectives(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serviceObjectives().listByServer("group1", "sqlcrudtest", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlAgentCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlAgentCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d707b2d6c1e20 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlAgentCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner; +import com.azure.resourcemanager.sql.generated.models.SqlAgentConfigurationPropertiesState; + +/** Samples for SqlAgent CreateOrUpdate. */ +public final class SqlAgentCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlAgentConfigurationPut.json + */ + /** + * Sample code: Puts new sql agent configuration to instance. + * + * @param manager Entry point to SqlManager. + */ + public static void putsNewSqlAgentConfigurationToInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlAgents() + .createOrUpdateWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + new SqlAgentConfigurationInner().withState(SqlAgentConfigurationPropertiesState.ENABLED), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlAgentGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlAgentGetSamples.java new file mode 100644 index 0000000000000..3c36f952a1faf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlAgentGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlAgent Get. */ +public final class SqlAgentGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlAgentConfigurationGet.json + */ + /** + * Sample code: Gets current instance sql agent configuration. + * + * @param manager Entry point to SqlManager. + */ + public static void getsCurrentInstanceSqlAgentConfiguration( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.sqlAgents().getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SubscriptionUsagesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SubscriptionUsagesGetSamples.java new file mode 100644 index 0000000000000..25aeb0b90e883 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SubscriptionUsagesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SubscriptionUsages Get. */ +public final class SubscriptionUsagesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SubscriptionUsageGet.json + */ + /** + * Sample code: Get specific subscription usage in the given location. + * + * @param manager Entry point to SqlManager. + */ + public static void getSpecificSubscriptionUsageInTheGivenLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.subscriptionUsages().getWithResponse("WestUS", "ServerQuota", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SubscriptionUsagesListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SubscriptionUsagesListByLocationSamples.java new file mode 100644 index 0000000000000..90dda93dde3e2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SubscriptionUsagesListByLocationSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SubscriptionUsages ListByLocation. */ +public final class SubscriptionUsagesListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SubscriptionUsageListByLocation.json + */ + /** + * Sample code: List subscription usages in the given location. + * + * @param manager Entry point to SqlManager. + */ + public static void listSubscriptionUsagesInTheGivenLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.subscriptionUsages().listByLocation("WestUS", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..1c952b8d4676c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncAgent; + +/** Samples for SyncAgents CreateOrUpdate. */ +public final class SyncAgentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentCreate.json + */ + /** + * Sample code: Create a new sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void createANewSyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .define("syncagentcrud-3187") + .withExistingServer("syncagentcrud-65440", "syncagentcrud-8475") + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/databases/sync") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentUpdate.json + */ + /** + * Sample code: Update a sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + SyncAgent resource = + manager + .syncAgents() + .getWithResponse("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE) + .getValue(); + resource + .update() + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/databases/sync") + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsDeleteSamples.java new file mode 100644 index 0000000000000..1f480cbd49dff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncAgents Delete. */ +public final class SyncAgentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentDelete.json + */ + /** + * Sample code: Delete a sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteASyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.syncAgents().delete("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsGenerateKeySamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsGenerateKeySamples.java new file mode 100644 index 0000000000000..3adfb44d8cac0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsGenerateKeySamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncAgents GenerateKey. */ +public final class SyncAgentsGenerateKeySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGenerateKey.json + */ + /** + * Sample code: Generate a sync agent key. + * + * @param manager Entry point to SqlManager. + */ + public static void generateASyncAgentKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .generateKeyWithResponse("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsGetSamples.java new file mode 100644 index 0000000000000..466b52e9a483b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncAgents Get. */ +public final class SyncAgentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGet.json + */ + /** + * Sample code: Get a sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .getWithResponse("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsListByServerSamples.java new file mode 100644 index 0000000000000..5374f43c962ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncAgents ListByServer. */ +public final class SyncAgentsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentListByServer.json + */ + /** + * Sample code: Get sync agents under a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getSyncAgentsUnderAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.syncAgents().listByServer("syncagentcrud-65440", "syncagentcrud-8475", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsListLinkedDatabasesSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsListLinkedDatabasesSamples.java new file mode 100644 index 0000000000000..9e0f897a7461f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsListLinkedDatabasesSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncAgents ListLinkedDatabases. */ +public final class SyncAgentsListLinkedDatabasesSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGetLinkedDatabases.json + */ + /** + * Sample code: Get sync agent linked databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getSyncAgentLinkedDatabases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .listLinkedDatabases("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsCancelSyncSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsCancelSyncSamples.java new file mode 100644 index 0000000000000..1d352dd846c76 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsCancelSyncSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups CancelSync. */ +public final class SyncGroupsCancelSyncSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupCancelSync.json + */ + /** + * Sample code: Cancel a sync group synchronization. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelASyncGroupSynchronization(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .cancelSyncWithResponse( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e9117ef471a48 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.SyncConflictResolutionPolicy; + +/** Samples for SyncGroups CreateOrUpdate. */ +public final class SyncGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupUpdate.json + */ + /** + * Sample code: Update a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .define("syncgroupcrud-3187") + .withExistingDatabase("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328") + .withInterval(-1) + .withConflictResolutionPolicy(SyncConflictResolutionPolicy.HUB_WIN) + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withHubDatabaseUsername("hubUser") + .withUsePrivateLinkConnection(true) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupCreate.json + */ + /** + * Sample code: Create a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void createASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .define("syncgroupcrud-3187") + .withExistingDatabase("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328") + .withInterval(-1) + .withConflictResolutionPolicy(SyncConflictResolutionPolicy.HUB_WIN) + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withHubDatabaseUsername("hubUser") + .withUsePrivateLinkConnection(true) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsDeleteSamples.java new file mode 100644 index 0000000000000..b1344b7ab383b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups Delete. */ +public final class SyncGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupDelete.json + */ + /** + * Sample code: Delete a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .delete( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsGetSamples.java new file mode 100644 index 0000000000000..0fac25ebef687 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups Get. */ +public final class SyncGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGet.json + */ + /** + * Sample code: Get a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .getWithResponse( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListByDatabaseSamples.java new file mode 100644 index 0000000000000..8b4792423297d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListByDatabaseSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups ListByDatabase. */ +public final class SyncGroupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupListByDatabase.json + */ + /** + * Sample code: List sync groups under a given database. + * + * @param manager Entry point to SqlManager. + */ + public static void listSyncGroupsUnderAGivenDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .listByDatabase("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListHubSchemasSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListHubSchemasSamples.java new file mode 100644 index 0000000000000..e5a891610720b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListHubSchemasSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups ListHubSchemas. */ +public final class SyncGroupsListHubSchemasSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetHubSchema.json + */ + /** + * Sample code: Get a hub database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getAHubDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .listHubSchemas( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListLogsSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListLogsSamples.java new file mode 100644 index 0000000000000..281dd6af9966f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListLogsSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncGroupsType; + +/** Samples for SyncGroups ListLogs. */ +public final class SyncGroupsListLogsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetLog.json + */ + /** + * Sample code: Get sync group logs. + * + * @param manager Entry point to SqlManager. + */ + public static void getSyncGroupLogs(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .listLogs( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "2017-01-01T00:00:00", + "2017-12-31T00:00:00", + SyncGroupsType.ALL, + null, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListSyncDatabaseIdsSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListSyncDatabaseIdsSamples.java new file mode 100644 index 0000000000000..36563f73c7d8d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListSyncDatabaseIdsSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups ListSyncDatabaseIds. */ +public final class SyncGroupsListSyncDatabaseIdsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetSyncDatabaseId.json + */ + /** + * Sample code: Get a sync database ID. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncDatabaseID(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.syncGroups().listSyncDatabaseIds("westus", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsRefreshHubSchemaSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsRefreshHubSchemaSamples.java new file mode 100644 index 0000000000000..0bb94646cc05d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsRefreshHubSchemaSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups RefreshHubSchema. */ +public final class SyncGroupsRefreshHubSchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupRefreshHubSchema.json + */ + /** + * Sample code: Refresh a hub database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void refreshAHubDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .refreshHubSchema( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsTriggerSyncSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsTriggerSyncSamples.java new file mode 100644 index 0000000000000..d37622fb7ab55 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsTriggerSyncSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups TriggerSync. */ +public final class SyncGroupsTriggerSyncSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupTriggerSync.json + */ + /** + * Sample code: Trigger a sync group synchronization. + * + * @param manager Entry point to SqlManager. + */ + public static void triggerASyncGroupSynchronization(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .triggerSyncWithResponse( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsUpdateSamples.java new file mode 100644 index 0000000000000..877029bdaba26 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncConflictResolutionPolicy; +import com.azure.resourcemanager.sql.generated.models.SyncGroup; + +/** Samples for SyncGroups Update. */ +public final class SyncGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupPatch.json + */ + /** + * Sample code: Update a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + SyncGroup resource = + manager + .syncGroups() + .getWithResponse( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + Context.NONE) + .getValue(); + resource + .update() + .withInterval(-1) + .withConflictResolutionPolicy(SyncConflictResolutionPolicy.HUB_WIN) + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withHubDatabaseUsername("hubUser") + .withHubDatabasePassword("hubPassword") + .withUsePrivateLinkConnection(true) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..4344a99690c4e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.sql.generated.models.SyncDirection; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; + +/** Samples for SyncMembers CreateOrUpdate. */ +public final class SyncMembersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberCreate.json + */ + /** + * Sample code: Create a new sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void createANewSyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .define("syncmembercrud-4879") + .withExistingSyncGroup( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187") + .withDatabaseType(SyncMemberDbType.AZURE_SQL_DATABASE) + .withSyncMemberAzureDatabaseResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withUsePrivateLinkConnection(true) + .withServerName("syncgroupcrud-3379.database.windows.net") + .withDatabaseName("syncgroupcrud-7421") + .withUsername("myUser") + .withSyncDirection(SyncDirection.BIDIRECTIONAL) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberUpdate.json + */ + /** + * Sample code: Update a sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .define("syncmembercrud-4879") + .withExistingSyncGroup( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187") + .withDatabaseType(SyncMemberDbType.AZURE_SQL_DATABASE) + .withSyncMemberAzureDatabaseResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withUsePrivateLinkConnection(true) + .withServerName("syncgroupcrud-3379.database.windows.net") + .withDatabaseName("syncgroupcrud-7421") + .withUsername("myUser") + .withSyncDirection(SyncDirection.BIDIRECTIONAL) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersDeleteSamples.java new file mode 100644 index 0000000000000..3603e9373b77e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersDeleteSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncMembers Delete. */ +public final class SyncMembersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberDelete.json + */ + /** + * Sample code: Delete a sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteASyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .delete( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncgroupcrud-4879", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersGetSamples.java new file mode 100644 index 0000000000000..01ae4cac83319 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersGetSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncMembers Get. */ +public final class SyncMembersGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberGet.json + */ + /** + * Sample code: Get a sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .getWithResponse( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncmembercrud-4879", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersListBySyncGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersListBySyncGroupSamples.java new file mode 100644 index 0000000000000..e7b7728936d3a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersListBySyncGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncMembers ListBySyncGroup. */ +public final class SyncMembersListBySyncGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberListBySyncGroup.json + */ + /** + * Sample code: List sync members under a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void listSyncMembersUnderASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .listBySyncGroup( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersListMemberSchemasSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersListMemberSchemasSamples.java new file mode 100644 index 0000000000000..052568854482b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersListMemberSchemasSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncMembers ListMemberSchemas. */ +public final class SyncMembersListMemberSchemasSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberGetSchema.json + */ + /** + * Sample code: Get a sync member schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncMemberSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .listMemberSchemas( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncgroupcrud-4879", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersRefreshMemberSchemaSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersRefreshMemberSchemaSamples.java new file mode 100644 index 0000000000000..c77c3dae16014 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersRefreshMemberSchemaSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncMembers RefreshMemberSchema. */ +public final class SyncMembersRefreshMemberSchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberRefreshSchema.json + */ + /** + * Sample code: Refresh a sync member database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void refreshASyncMemberDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .refreshMemberSchema( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncgroupcrud-4879", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersUpdateSamples.java new file mode 100644 index 0000000000000..3d99f7116e19e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncDirection; +import com.azure.resourcemanager.sql.generated.models.SyncMember; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; + +/** Samples for SyncMembers Update. */ +public final class SyncMembersUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberPatch.json + */ + /** + * Sample code: Update an existing sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnExistingSyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + SyncMember resource = + manager + .syncMembers() + .getWithResponse( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncmembercrud-4879", + Context.NONE) + .getValue(); + resource + .update() + .withDatabaseType(SyncMemberDbType.AZURE_SQL_DATABASE) + .withSyncMemberAzureDatabaseResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withUsePrivateLinkConnection(true) + .withServerName("syncgroupcrud-3379.database.windows.net") + .withDatabaseName("syncgroupcrud-7421") + .withUsername("myUser") + .withSyncDirection(SyncDirection.BIDIRECTIONAL) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TdeCertificatesCreateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TdeCertificatesCreateSamples.java new file mode 100644 index 0000000000000..6b0b2ded2acae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TdeCertificatesCreateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; + +/** Samples for TdeCertificates Create. */ +public final class TdeCertificatesCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlTdeCertificateCreate.json + */ + /** + * Sample code: Upload a TDE certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void uploadATDECertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .tdeCertificates() + .create("testtdecert", "testtdecert", new TdeCertificate().withPrivateBlob("MIIXXXXXXXX"), Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TimeZonesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TimeZonesGetSamples.java new file mode 100644 index 0000000000000..806cc89ab8f66 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TimeZonesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for TimeZones Get. */ +public final class TimeZonesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTimeZoneGet.json + */ + /** + * Sample code: Get managed instance time zone. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedInstanceTimeZone(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.timeZones().getWithResponse("canadaeast", "Haiti Standard Time", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TimeZonesListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TimeZonesListByLocationSamples.java new file mode 100644 index 0000000000000..a44e68b6d32df --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TimeZonesListByLocationSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for TimeZones ListByLocation. */ +public final class TimeZonesListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTimeZoneListByLocation.json + */ + /** + * Sample code: List managed instance time zones by location. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstanceTimeZonesByLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.timeZones().listByLocation("canadaeast", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ca8ec683705c7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsCreateOrUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LogicalDatabaseTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; + +/** Samples for TransparentDataEncryptions CreateOrUpdate. */ +public final class TransparentDataEncryptionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionUpdate.json + */ + /** + * Sample code: Update a database's Transparent Data Encryption state with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSTransparentDataEncryptionStateWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + LogicalDatabaseTransparentDataEncryption resource = + manager + .transparentDataEncryptions() + .getWithResponse( + "securitytde-42-rg", + "securitytde-42", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE) + .getValue(); + resource.update().withState(TransparentDataEncryptionState.ENABLED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsGetSamples.java new file mode 100644 index 0000000000000..c5841c31a4cf0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsGetSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +/** Samples for TransparentDataEncryptions Get. */ +public final class TransparentDataEncryptionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionGet.json + */ + /** + * Sample code: Get a database's transparent data encryption. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSTransparentDataEncryption( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .transparentDataEncryptions() + .getWithResponse( + "security-tde-resourcegroup", + "securitytde", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsListByDatabaseSamples.java new file mode 100644 index 0000000000000..247c3099d6cb1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for TransparentDataEncryptions ListByDatabase. */ +public final class TransparentDataEncryptionsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionList.json + */ + /** + * Sample code: Get a list of the database's transparent data encryption. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfTheDatabaseSTransparentDataEncryption( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .transparentDataEncryptions() + .listByDatabase("security-tde-resourcegroup", "securitytde", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/UsagesListByInstancePoolSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/UsagesListByInstancePoolSamples.java new file mode 100644 index 0000000000000..7ae872ad84e36 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/UsagesListByInstancePoolSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for Usages ListByInstancePool. */ +public final class UsagesListByInstancePoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsage.json + */ + /** + * Sample code: List instance pool usages. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolUsages(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.usages().listByInstancePool("group1", "testIP", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsageExpanded.json + */ + /** + * Sample code: List instance pool usages expanded with children. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolUsagesExpandedWithChildren( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.usages().listByInstancePool("group1", "testIP", true, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersDeleteSamples.java new file mode 100644 index 0000000000000..193ae4b35c036 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualClusters Delete. */ +public final class VirtualClustersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterDelete.json + */ + /** + * Sample code: Delete virtual cluster. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteVirtualCluster(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualClusters().delete("testrg", "vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersGetByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..ff5bd1db3e988 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersGetByResourceGroupSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualClusters GetByResourceGroup. */ +public final class VirtualClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterGet.json + */ + /** + * Sample code: Get virtual cluster. + * + * @param manager Entry point to SqlManager. + */ + public static void getVirtualCluster(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .virtualClusters() + .getByResourceGroupWithResponse("testrg", "vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersListByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..f1d5c92448d3d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualClusters ListByResourceGroup. */ +public final class VirtualClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterListByResourceGroup.json + */ + /** + * Sample code: List virtual clusters by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listVirtualClustersByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualClusters().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersListSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersListSamples.java new file mode 100644 index 0000000000000..f3ffb957fbe31 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualClusters List. */ +public final class VirtualClustersListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterList.json + */ + /** + * Sample code: List virtualClusters. + * + * @param manager Entry point to SqlManager. + */ + public static void listVirtualClusters(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualClusters().list(Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersUpdateDnsServersSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersUpdateDnsServersSamples.java new file mode 100644 index 0000000000000..9add90b86f631 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersUpdateDnsServersSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualClusters UpdateDnsServers. */ +public final class VirtualClustersUpdateDnsServersSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedInstanceDnsServers.json + */ + /** + * Sample code: Synchronizes the DNS server settings used by the managed instances inside the given virtual cluster. + * + * @param manager Entry point to SqlManager. + */ + public static void synchronizesTheDNSServerSettingsUsedByTheManagedInstancesInsideTheGivenVirtualCluster( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualClusters().updateDnsServersWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersUpdateSamples.java new file mode 100644 index 0000000000000..075b2cb0dc554 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VirtualClusterUpdate; + +/** Samples for VirtualClusters Update. */ +public final class VirtualClustersUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualClusterUpdate.json + */ + /** + * Sample code: Update virtual cluster with tags. + * + * @param manager Entry point to SqlManager. + */ + public static void updateVirtualClusterWithTags(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .virtualClusters() + .update( + "testrg", + "vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", + new VirtualClusterUpdate() + .withMaintenanceConfigurationId( + "/subscriptions/ab0e51c0-83c0-4380-8ae9-025516df392f/resourceGroups/Federation/providers/Microsoft.Maintenance/maintenanceConfigurations/MiPolicy1"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e5666b9eca8f2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesCreateOrUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for VirtualNetworkRules CreateOrUpdate. */ +public final class VirtualNetworkRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesCreateOrUpdate.json + */ + /** + * Sample code: Create or update a virtual network rule. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAVirtualNetworkRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .virtualNetworkRules() + .define("vnet-firewall-rule") + .withExistingServer("Default", "vnet-test-svr") + .withVirtualNetworkSubnetId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet") + .withIgnoreMissingVnetServiceEndpoint(false) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesDeleteSamples.java new file mode 100644 index 0000000000000..9ff4a18ca15aa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules Delete. */ +public final class VirtualNetworkRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesDelete.json + */ + /** + * Sample code: Delete a virtual network rule. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAVirtualNetworkRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualNetworkRules().delete("Default", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesGetSamples.java new file mode 100644 index 0000000000000..82ae44a9c6abd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules Get. */ +public final class VirtualNetworkRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesGet.json + */ + /** + * Sample code: Gets a virtual network rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAVirtualNetworkRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualNetworkRules().getWithResponse("Default", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesListByServerSamples.java new file mode 100644 index 0000000000000..7db256b0e5308 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules ListByServer. */ +public final class VirtualNetworkRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesList.json + */ + /** + * Sample code: List virtual network rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listVirtualNetworkRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualNetworkRules().listByServer("Default", "vnet-test-svr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..59b1f0a0e48cd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersCreateOrUpdateSamples.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.generated; + +/** Samples for WorkloadClassifiers CreateOrUpdate. */ +public final class WorkloadClassifiersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadClassifierMin.json + */ + /** + * Sample code: Create a workload group with the required properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithTheRequiredPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .define("wlm_workloadclassifier") + .withExistingWorkloadGroup("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup") + .withMemberName("dbo") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadClassifierMax.json + */ + /** + * Sample code: Create a workload group with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .define("wlm_workloadclassifier") + .withExistingWorkloadGroup("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup") + .withMemberName("dbo") + .withLabel("test_label") + .withContext("test_context") + .withStartTime("12:00") + .withEndTime("14:00") + .withImportance("high") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersDeleteSamples.java new file mode 100644 index 0000000000000..ab730b18eeec5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersDeleteSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for WorkloadClassifiers Delete. */ +public final class WorkloadClassifiersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteWorkloadClassifier.json + */ + /** + * Sample code: Delete a workload classifier. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAWorkloadClassifier(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .delete( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + "wlm_workloadgroup", + "wlm_workloadclassifier", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersGetSamples.java new file mode 100644 index 0000000000000..dd2f2e9282e4b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for WorkloadClassifiers Get. */ +public final class WorkloadClassifiersGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadClassifier.json + */ + /** + * Sample code: Gets a workload classifier for a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAWorkloadClassifierForADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", "wlm_classifier", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersListByWorkloadGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersListByWorkloadGroupSamples.java new file mode 100644 index 0000000000000..e163996a36386 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersListByWorkloadGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for WorkloadClassifiers ListByWorkloadGroup. */ +public final class WorkloadClassifiersListByWorkloadGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadClassifierList.json + */ + /** + * Sample code: Get the list of workload classifiers for a workload group. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheListOfWorkloadClassifiersForAWorkloadGroup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .listByWorkloadGroup("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..a69d30cbda6f0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsCreateOrUpdateSamples.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.generated; + +/** Samples for WorkloadGroups CreateOrUpdate. */ +public final class WorkloadGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadGroupMin.json + */ + /** + * Sample code: Create a workload group with the required properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithTheRequiredPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .define("smallrc") + .withExistingDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb") + .withMinResourcePercent(0) + .withMaxResourcePercent(100) + .withMinResourcePercentPerRequest(3.0) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadGroupMax.json + */ + /** + * Sample code: Create a workload group with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .define("smallrc") + .withExistingDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb") + .withMinResourcePercent(0) + .withMaxResourcePercent(100) + .withMinResourcePercentPerRequest(3.0) + .withMaxResourcePercentPerRequest(3.0) + .withImportance("normal") + .withQueryExecutionTimeout(0) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsDeleteSamples.java new file mode 100644 index 0000000000000..d317221fbc0c8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsDeleteSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for WorkloadGroups Delete. */ +public final class WorkloadGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteWorkloadGroup.json + */ + /** + * Sample code: Delete a workload group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAWorkloadGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .delete("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsGetSamples.java new file mode 100644 index 0000000000000..4b1bee2bfb4dd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for WorkloadGroups Get. */ +public final class WorkloadGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadGroup.json + */ + /** + * Sample code: Gets a workload group for a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAWorkloadGroupForADataWarehouse(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", "smallrc", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsListByDatabaseSamples.java new file mode 100644 index 0000000000000..668ce1b55a43e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsListByDatabaseSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for WorkloadGroups ListByDatabase. */ +public final class WorkloadGroupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadGroupList.json + */ + /** + * Sample code: Get the list of workload groups for a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheListOfWorkloadGroupsForADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.workloadGroups().listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/ci.yml b/sdk/sql/ci.yml new file mode 100644 index 0000000000000..af6a8446a3687 --- /dev/null +++ b/sdk/sql/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/sql/ci.yml + - sdk/sql/azure-resourcemanager-sql-generated/ + exclude: + - sdk/sql/pom.xml + - sdk/sql/azure-resourcemanager-sql-generated/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sql/ci.yml + - sdk/sql/azure-resourcemanager-sql-generated/ + exclude: + - sdk/sql/pom.xml + - sdk/sql/azure-resourcemanager-sql-generated/pom.xml + +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 + + + +