diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/CHANGELOG.md b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/CHANGELOG.md index 9fd8fce98c86..e10d5767433f 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/CHANGELOG.md +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2022-02-18) +- Azure Resource Manager SqlVirtualMachine client library for Java. This package contains Microsoft Azure SDK for SqlVirtualMachine Management SDK. The SQL virtual machine management API provides a RESTful set of web APIs that interact with Azure Compute, Network & Storage services to manage your SQL Server virtual machine. The API enables users to create, delete and retrieve a SQL virtual machine, SQL virtual machine group or availability group listener. Package tag package-preview-2021-11. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## 1.0.0-beta.1 (2020-12-18) diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/README.md b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/README.md index 817d99ae6f7a..5de0f82cc7c9 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/README.md +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/README.md @@ -2,7 +2,21 @@ Azure Resource Manager SqlVirtualMachine client library for Java. -This package contains Microsoft Azure SDK for SqlVirtualMachine Management SDK. The SQL virtual machine management API provides a RESTful set of web APIs that interact with Azure Compute, Network & Storage services to manage your SQL Server virtual machine. The API enables users to create, delete and retrieve a SQL virtual machine, SQL virtual machine group or availability group listener. Package tag package-2017-03-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for SqlVirtualMachine Management SDK. The SQL virtual machine management API provides a RESTful set of web APIs that interact with Azure Compute, Network & Storage services to manage your SQL Server virtual machine. The API enables users to create, delete and retrieve a SQL virtual machine, SQL virtual machine group or availability group listener. Package tag package-preview-2021-11. 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 @@ -18,7 +32,7 @@ This package contains Microsoft Azure SDK for SqlVirtualMachine Management SDK. com.azure.resourcemanager azure-resourcemanager-sqlvirtualmachine - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -60,6 +74,9 @@ See [API design][design] for general introduction on design and key concepts on ## Examples +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/SAMPLE.md) + + ## Troubleshooting ## Next steps @@ -75,6 +92,8 @@ For details on contributing to this repository, see the [contributing guide](htt 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 diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/SAMPLE.md b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/SAMPLE.md new file mode 100644 index 000000000000..633760ff8f4e --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/SAMPLE.md @@ -0,0 +1,835 @@ +# Code snippets and samples + + +## AvailabilityGroupListeners + +- [CreateOrUpdate](#availabilitygrouplisteners_createorupdate) +- [Delete](#availabilitygrouplisteners_delete) +- [Get](#availabilitygrouplisteners_get) +- [ListByGroup](#availabilitygrouplisteners_listbygroup) + +## Operations + +- [List](#operations_list) + +## SqlVirtualMachineGroups + +- [CreateOrUpdate](#sqlvirtualmachinegroups_createorupdate) +- [Delete](#sqlvirtualmachinegroups_delete) +- [GetByResourceGroup](#sqlvirtualmachinegroups_getbyresourcegroup) +- [List](#sqlvirtualmachinegroups_list) +- [ListByResourceGroup](#sqlvirtualmachinegroups_listbyresourcegroup) +- [Update](#sqlvirtualmachinegroups_update) + +## SqlVirtualMachines + +- [CreateOrUpdate](#sqlvirtualmachines_createorupdate) +- [Delete](#sqlvirtualmachines_delete) +- [GetByResourceGroup](#sqlvirtualmachines_getbyresourcegroup) +- [List](#sqlvirtualmachines_list) +- [ListByResourceGroup](#sqlvirtualmachines_listbyresourcegroup) +- [ListBySqlVmGroup](#sqlvirtualmachines_listbysqlvmgroup) +- [Redeploy](#sqlvirtualmachines_redeploy) +- [StartAssessment](#sqlvirtualmachines_startassessment) +- [Update](#sqlvirtualmachines_update) +### AvailabilityGroupListeners_CreateOrUpdate + +```java +import com.azure.resourcemanager.sqlvirtualmachine.models.LoadBalancerConfiguration; +import com.azure.resourcemanager.sqlvirtualmachine.models.PrivateIpAddress; +import java.util.Arrays; + +/** Samples for AvailabilityGroupListeners CreateOrUpdate. */ +public final class AvailabilityGroupListenersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateAvailabilityGroupListener.json + */ + /** + * Sample code: Creates or updates an availability group listener. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void createsOrUpdatesAnAvailabilityGroupListener( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .availabilityGroupListeners() + .define("agl-test") + .withExistingSqlVirtualMachineGroup("testrg", "testvmgroup") + .withAvailabilityGroupName("ag-test") + .withLoadBalancerConfigurations( + Arrays + .asList( + new LoadBalancerConfiguration() + .withPrivateIpAddress( + new PrivateIpAddress() + .withIpAddress("10.1.0.112") + .withSubnetResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default")) + .withLoadBalancerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb-test") + .withProbePort(59983) + .withSqlVirtualMachineInstances( + Arrays + .asList( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm2", + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm3")))) + .withPort(1433) + .create(); + } +} +``` + +### AvailabilityGroupListeners_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for AvailabilityGroupListeners Delete. */ +public final class AvailabilityGroupListenersDeleteSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/DeleteAvailabilityGroupListener.json + */ + /** + * Sample code: Deletes an availability group listener. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void deletesAnAvailabilityGroupListener( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.availabilityGroupListeners().delete("testrg", "testvmgroup", "agl-test", Context.NONE); + } +} +``` + +### AvailabilityGroupListeners_Get + +```java +import com.azure.core.util.Context; + +/** Samples for AvailabilityGroupListeners Get. */ +public final class AvailabilityGroupListenersGetSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/GetAvailabilityGroupListener.json + */ + /** + * Sample code: Gets an availability group listener. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsAnAvailabilityGroupListener( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.availabilityGroupListeners().getWithResponse("testrg", "testvmgroup", "agl-test", null, Context.NONE); + } +} +``` + +### AvailabilityGroupListeners_ListByGroup + +```java +import com.azure.core.util.Context; + +/** Samples for AvailabilityGroupListeners ListByGroup. */ +public final class AvailabilityGroupListenersListByGroupSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListByGroupAvailabilityGroupListener.json + */ + /** + * Sample code: Lists all availability group listeners in a SQL virtual machine group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void listsAllAvailabilityGroupListenersInASQLVirtualMachineGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.availabilityGroupListeners().listByGroup("testrg", "testvmgroup", Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListOperation.json + */ + /** + * Sample code: Lists all of the available SQL Virtual Machine Rest API operations. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void listsAllOfTheAvailableSQLVirtualMachineRestAPIOperations( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### SqlVirtualMachineGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlVmGroupImageSku; +import com.azure.resourcemanager.sqlvirtualmachine.models.WsfcDomainProfile; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlVirtualMachineGroups CreateOrUpdate. */ +public final class SqlVirtualMachineGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateSqlVirtualMachineGroup.json + */ + /** + * Sample code: Creates or updates a SQL virtual machine group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void createsOrUpdatesASQLVirtualMachineGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .sqlVirtualMachineGroups() + .define("testvmgroup") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withTags(mapOf("mytag", "myval")) + .withSqlImageOffer("SQL2016-WS2016") + .withSqlImageSku(SqlVmGroupImageSku.ENTERPRISE) + .withWsfcDomainProfile( + new WsfcDomainProfile() + .withDomainFqdn("testdomain.com") + .withOuPath("OU=WSCluster,DC=testdomain,DC=com") + .withClusterBootstrapAccount("testrpadmin") + .withClusterOperatorAccount("testrp@testdomain.com") + .withSqlServiceAccount("sqlservice@testdomain.com") + .withStorageAccountUrl("https://storgact.blob.core.windows.net/") + .withStorageAccountPrimaryKey("")) + .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; + } +} +``` + +### SqlVirtualMachineGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachineGroups Delete. */ +public final class SqlVirtualMachineGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/DeleteSqlVirtualMachineGroup.json + */ + /** + * Sample code: Deletes a SQL virtual machine group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void deletesASQLVirtualMachineGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachineGroups().delete("testrg", "testvmgroup", Context.NONE); + } +} +``` + +### SqlVirtualMachineGroups_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachineGroups GetByResourceGroup. */ +public final class SqlVirtualMachineGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/GetSqlVirtualMachineGroup.json + */ + /** + * Sample code: Gets a SQL virtual machine group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsASQLVirtualMachineGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachineGroups().getByResourceGroupWithResponse("testrg", "testvmgroup", Context.NONE); + } +} +``` + +### SqlVirtualMachineGroups_List + +```java +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachineGroups List. */ +public final class SqlVirtualMachineGroupsListSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListSubscriptionSqlVirtualMachineGroup.json + */ + /** + * Sample code: Gets all SQL virtual machine groups in a subscription. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsAllSQLVirtualMachineGroupsInASubscription( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachineGroups().list(Context.NONE); + } +} +``` + +### SqlVirtualMachineGroups_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachineGroups ListByResourceGroup. */ +public final class SqlVirtualMachineGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListByResourceGroupSqlVirtualMachineGroup.json + */ + /** + * Sample code: Gets all SQL virtual machine groups in a resource group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsAllSQLVirtualMachineGroupsInAResourceGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachineGroups().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### SqlVirtualMachineGroups_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlVirtualMachineGroup; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlVirtualMachineGroups Update. */ +public final class SqlVirtualMachineGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/UpdateSqlVirtualMachineGroup.json + */ + /** + * Sample code: Updates a SQL virtual machine group tags. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void updatesASQLVirtualMachineGroupTags( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + SqlVirtualMachineGroup resource = + manager + .sqlVirtualMachineGroups() + .getByResourceGroupWithResponse("testrg", "testvmgroup", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlVirtualMachines_CreateOrUpdate + +```java +import com.azure.resourcemanager.sqlvirtualmachine.models.AdditionalFeaturesServerConfigurations; +import com.azure.resourcemanager.sqlvirtualmachine.models.AssessmentSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.AutoBackupSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.AutoPatchingSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.BackupScheduleType; +import com.azure.resourcemanager.sqlvirtualmachine.models.ConnectivityType; +import com.azure.resourcemanager.sqlvirtualmachine.models.DayOfWeek; +import com.azure.resourcemanager.sqlvirtualmachine.models.DaysOfWeek; +import com.azure.resourcemanager.sqlvirtualmachine.models.DiskConfigurationType; +import com.azure.resourcemanager.sqlvirtualmachine.models.FullBackupFrequencyType; +import com.azure.resourcemanager.sqlvirtualmachine.models.KeyVaultCredentialSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.Schedule; +import com.azure.resourcemanager.sqlvirtualmachine.models.ServerConfigurationsManagementSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlConnectivityUpdateSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlImageSku; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlInstanceSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlManagementMode; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlServerLicenseType; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlStorageSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlStorageUpdateSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlTempDbSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlWorkloadType; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlWorkloadTypeUpdateSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.StorageConfigurationSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.StorageWorkloadType; +import com.azure.resourcemanager.sqlvirtualmachine.models.WsfcDomainCredentials; +import java.util.Arrays; + +/** Samples for SqlVirtualMachines CreateOrUpdate. */ +public final class SqlVirtualMachinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateSqlVirtualMachineStorageConfigurationEXTEND.json + */ + /** + * Sample code: Creates or updates a SQL virtual machine for Storage Configuration Settings to EXTEND Data, Log or + * TempDB storage pool. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void + createsOrUpdatesASQLVirtualMachineForStorageConfigurationSettingsToEXTENDDataLogOrTempDBStoragePool( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .sqlVirtualMachines() + .define("testvm") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withVirtualMachineResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm") + .withStorageConfigurationSettings( + new StorageConfigurationSettings() + .withSqlDataSettings(new SqlStorageSettings().withLuns(Arrays.asList(2))) + .withDiskConfigurationType(DiskConfigurationType.EXTEND)) + .create(); + } + + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateVirtualMachineWithVMGroup.json + */ + /** + * Sample code: Creates or updates a SQL virtual machine and joins it to a SQL virtual machine group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void createsOrUpdatesASQLVirtualMachineAndJoinsItToASQLVirtualMachineGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .sqlVirtualMachines() + .define("testvm") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withVirtualMachineResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm2") + .withWsfcDomainCredentials( + new WsfcDomainCredentials() + .withClusterBootstrapAccountPassword("") + .withClusterOperatorAccountPassword("") + .withSqlServiceAccountPassword("")) + .create(); + } + + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateSqlVirtualMachineAutomatedBackupWeekly.json + */ + /** + * Sample code: Creates or updates a SQL virtual machine for Automated Back up Settings with Weekly and Days of the + * week to run the back up. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void + createsOrUpdatesASQLVirtualMachineForAutomatedBackUpSettingsWithWeeklyAndDaysOfTheWeekToRunTheBackUp( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .sqlVirtualMachines() + .define("testvm") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withVirtualMachineResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm") + .withSqlServerLicenseType(SqlServerLicenseType.PAYG) + .withSqlManagement(SqlManagementMode.FULL) + .withSqlImageSku(SqlImageSku.ENTERPRISE) + .withAutoPatchingSettings( + new AutoPatchingSettings() + .withEnable(true) + .withDayOfWeek(DayOfWeek.SUNDAY) + .withMaintenanceWindowStartingHour(2) + .withMaintenanceWindowDuration(60)) + .withAutoBackupSettings( + new AutoBackupSettings() + .withEnable(true) + .withEnableEncryption(true) + .withRetentionPeriod(17) + .withStorageAccountUrl("https://teststorage.blob.core.windows.net/") + .withStorageContainerName("testcontainer") + .withStorageAccessKey("") + .withPassword("") + .withBackupSystemDbs(true) + .withBackupScheduleType(BackupScheduleType.MANUAL) + .withFullBackupFrequency(FullBackupFrequencyType.WEEKLY) + .withDaysOfWeek(Arrays.asList(DaysOfWeek.MONDAY, DaysOfWeek.FRIDAY)) + .withFullBackupStartTime(6) + .withFullBackupWindowHours(11) + .withLogBackupFrequency(10)) + .withKeyVaultCredentialSettings(new KeyVaultCredentialSettings().withEnable(false)) + .withServerConfigurationsManagementSettings( + new ServerConfigurationsManagementSettings() + .withSqlConnectivityUpdateSettings( + new SqlConnectivityUpdateSettings() + .withConnectivityType(ConnectivityType.PRIVATE) + .withPort(1433) + .withSqlAuthUpdateUsername("sqllogin") + .withSqlAuthUpdatePassword("")) + .withSqlWorkloadTypeUpdateSettings( + new SqlWorkloadTypeUpdateSettings().withSqlWorkloadType(SqlWorkloadType.OLTP)) + .withSqlStorageUpdateSettings( + new SqlStorageUpdateSettings() + .withDiskCount(1) + .withStartingDeviceId(2) + .withDiskConfigurationType(DiskConfigurationType.NEW)) + .withAdditionalFeaturesServerConfigurations( + new AdditionalFeaturesServerConfigurations().withIsRServicesEnabled(false))) + .create(); + } + + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateSqlVirtualMachineStorageConfigurationNEW.json + */ + /** + * Sample code: Creates or updates a SQL virtual machine for Storage Configuration Settings to NEW Data, Log and + * TempDB storage pool. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void + createsOrUpdatesASQLVirtualMachineForStorageConfigurationSettingsToNEWDataLogAndTempDBStoragePool( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .sqlVirtualMachines() + .define("testvm") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withVirtualMachineResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm") + .withStorageConfigurationSettings( + new StorageConfigurationSettings() + .withSqlDataSettings( + new SqlStorageSettings().withLuns(Arrays.asList(0)).withDefaultFilePath("F:\\folderpath\\")) + .withSqlLogSettings( + new SqlStorageSettings().withLuns(Arrays.asList(1)).withDefaultFilePath("G:\\folderpath\\")) + .withSqlTempDbSettings( + new SqlTempDbSettings() + .withDataFileSize(256) + .withDataGrowth(512) + .withLogFileSize(256) + .withLogGrowth(512) + .withDataFileCount(8) + .withDefaultFilePath("D:\\TEMP")) + .withSqlSystemDbOnDataDisk(true) + .withDiskConfigurationType(DiskConfigurationType.NEW) + .withStorageWorkloadType(StorageWorkloadType.OLTP)) + .create(); + } + + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateSqlVirtualMachineMAX.json + */ + /** + * Sample code: Creates or updates a SQL virtual machine with max parameters. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void createsOrUpdatesASQLVirtualMachineWithMaxParameters( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .sqlVirtualMachines() + .define("testvm") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withVirtualMachineResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm") + .withSqlServerLicenseType(SqlServerLicenseType.PAYG) + .withSqlManagement(SqlManagementMode.FULL) + .withSqlImageSku(SqlImageSku.ENTERPRISE) + .withAutoPatchingSettings( + new AutoPatchingSettings() + .withEnable(true) + .withDayOfWeek(DayOfWeek.SUNDAY) + .withMaintenanceWindowStartingHour(2) + .withMaintenanceWindowDuration(60)) + .withAutoBackupSettings( + new AutoBackupSettings() + .withEnable(true) + .withEnableEncryption(true) + .withRetentionPeriod(17) + .withStorageAccountUrl("https://teststorage.blob.core.windows.net/") + .withStorageContainerName("testcontainer") + .withStorageAccessKey("") + .withPassword("") + .withBackupSystemDbs(true) + .withBackupScheduleType(BackupScheduleType.MANUAL) + .withFullBackupFrequency(FullBackupFrequencyType.DAILY) + .withFullBackupStartTime(6) + .withFullBackupWindowHours(11) + .withLogBackupFrequency(10)) + .withKeyVaultCredentialSettings(new KeyVaultCredentialSettings().withEnable(false)) + .withServerConfigurationsManagementSettings( + new ServerConfigurationsManagementSettings() + .withSqlConnectivityUpdateSettings( + new SqlConnectivityUpdateSettings() + .withConnectivityType(ConnectivityType.PRIVATE) + .withPort(1433) + .withSqlAuthUpdateUsername("sqllogin") + .withSqlAuthUpdatePassword("")) + .withSqlWorkloadTypeUpdateSettings( + new SqlWorkloadTypeUpdateSettings().withSqlWorkloadType(SqlWorkloadType.OLTP)) + .withSqlStorageUpdateSettings( + new SqlStorageUpdateSettings() + .withDiskCount(1) + .withStartingDeviceId(2) + .withDiskConfigurationType(DiskConfigurationType.NEW)) + .withAdditionalFeaturesServerConfigurations( + new AdditionalFeaturesServerConfigurations().withIsRServicesEnabled(false)) + .withSqlInstanceSettings( + new SqlInstanceSettings() + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withMaxDop(8) + .withIsOptimizeForAdHocWorkloadsEnabled(true) + .withMinServerMemoryMB(0) + .withMaxServerMemoryMB(128))) + .withAssessmentSettings( + new AssessmentSettings() + .withEnable(true) + .withRunImmediately(true) + .withSchedule( + new Schedule() + .withEnable(true) + .withWeeklyInterval(1) + .withDayOfWeek(DayOfWeek.SUNDAY) + .withStartTime("23:17"))) + .create(); + } + + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateSqlVirtualMachineMIN.json + */ + /** + * Sample code: Creates or updates a SQL virtual machine with min parameters. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void createsOrUpdatesASQLVirtualMachineWithMinParameters( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .sqlVirtualMachines() + .define("testvm") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withVirtualMachineResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm") + .create(); + } +} +``` + +### SqlVirtualMachines_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachines Delete. */ +public final class SqlVirtualMachinesDeleteSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/DeleteSqlVirtualMachine.json + */ + /** + * Sample code: Deletes a SQL virtual machine. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void deletesASQLVirtualMachine( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachines().delete("testrg", "testvm1", Context.NONE); + } +} +``` + +### SqlVirtualMachines_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachines GetByResourceGroup. */ +public final class SqlVirtualMachinesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/GetSqlVirtualMachine.json + */ + /** + * Sample code: Gets a SQL virtual machine. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsASQLVirtualMachine( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachines().getByResourceGroupWithResponse("testrg", "testvm", null, Context.NONE); + } +} +``` + +### SqlVirtualMachines_List + +```java +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachines List. */ +public final class SqlVirtualMachinesListSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListSubscriptionSqlVirtualMachine.json + */ + /** + * Sample code: Gets all SQL virtual machines in a subscription. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsAllSQLVirtualMachinesInASubscription( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachines().list(Context.NONE); + } +} +``` + +### SqlVirtualMachines_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachines ListByResourceGroup. */ +public final class SqlVirtualMachinesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListByResourceGroupSqlVirtualMachine.json + */ + /** + * Sample code: Gets all SQL virtual machines in a resource group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsAllSQLVirtualMachinesInAResourceGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachines().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### SqlVirtualMachines_ListBySqlVmGroup + +```java +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachines ListBySqlVmGroup. */ +public final class SqlVirtualMachinesListBySqlVmGroupSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListBySqlVirtualMachineGroupSqlVirtualMachine.json + */ + /** + * Sample code: Gets the list of sql virtual machines in a SQL virtual machine group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsTheListOfSqlVirtualMachinesInASQLVirtualMachineGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachines().listBySqlVmGroup("testrg", "testvm", Context.NONE); + } +} +``` + +### SqlVirtualMachines_Redeploy + +```java +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachines Redeploy. */ +public final class SqlVirtualMachinesRedeploySamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/RedeploySqlVirtualMachine.json + */ + /** + * Sample code: Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void uninstallsAndReinstallsTheSQLIaasExtension( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachines().redeploy("testrg", "testvm", Context.NONE); + } +} +``` + +### SqlVirtualMachines_StartAssessment + +```java +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachines StartAssessment. */ +public final class SqlVirtualMachinesStartAssessmentSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/StartAssessmentOnSqlVirtualMachine.json + */ + /** + * Sample code: Starts Assessment on SQL virtual machine. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void startsAssessmentOnSQLVirtualMachine( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachines().startAssessment("testrg", "testvm", Context.NONE); + } +} +``` + +### SqlVirtualMachines_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlVirtualMachine; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlVirtualMachines Update. */ +public final class SqlVirtualMachinesUpdateSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/UpdateSqlVirtualMachine.json + */ + /** + * Sample code: Updates a SQL virtual machine tags. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void updatesASQLVirtualMachineTags( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + SqlVirtualMachine resource = + manager + .sqlVirtualMachines() + .getByResourceGroupWithResponse("testrg", "testvm", null, Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/pom.xml b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/pom.xml index 19b7685eea2b..97ee55776da8 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/pom.xml +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/pom.xml @@ -1,50 +1,55 @@ - 4.0.0 - - com.azure - azure-client-sdk-parent - 1.7.0 - ../../parents/azure-client-sdk-parent - + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + - com.azure.resourcemanager - azure-resourcemanager-sqlvirtualmachine - 1.0.0-beta.2 - jar + com.azure.resourcemanager + azure-resourcemanager-sqlvirtualmachine + 1.0.0-beta.2 + jar - Microsoft Azure SDK for SqlVirtualMachine Management - This package contains Microsoft Azure SDK for SqlVirtualMachine Management SDK. The SQL virtual machine management API provides a RESTful set of web APIs that interact with Azure Compute, Network & Storage services to manage your SQL Server virtual machine. The API enables users to create, delete and retrieve a SQL virtual machine, SQL virtual machine group or availability group listener. Package tag package-2017-03-01-preview. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt - https://github.com/Azure/azure-sdk-for-java + Microsoft Azure SDK for SqlVirtualMachine Management + This package contains Microsoft Azure SDK for SqlVirtualMachine Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The SQL virtual machine management API provides a RESTful set of web APIs that interact with Azure Compute, Network & Storage services to manage your SQL Server virtual machine. The API enables users to create, delete and retrieve a SQL virtual machine, SQL virtual machine group or availability group listener. Package tag package-preview-2021-11. + https://github.com/Azure/azure-sdk-for-java - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - + + + 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-management - 1.5.2 - - + + 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.25.0 + + + com.azure + azure-core-management + 1.5.2 + + diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/SqlVirtualMachineManager.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/SqlVirtualMachineManager.java index 1de090ec4187..2fa31b076122 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/SqlVirtualMachineManager.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/SqlVirtualMachineManager.java @@ -8,8 +8,8 @@ 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.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -17,6 +17,7 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -35,6 +36,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** * Entry point to SqlVirtualMachineManager. The SQL virtual machine management API provides a RESTful set of web APIs @@ -94,6 +96,7 @@ public static final class Configurable { private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; private Duration defaultPollInterval; @@ -133,6 +136,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) { 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. * @@ -169,25 +183,53 @@ public SqlVirtualMachineManager authenticate(TokenCredential credential, AzurePr 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.sqlvirtualmachine") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } if (retryPolicy == null) { retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); } List policies = new ArrayList<>(); - policies - .add( - new UserAgentPolicy( - null, - "com.azure.resourcemanager.sqlvirtualmachine", - "1.0.0-beta.1", - Configuration.getGlobalConfiguration())); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies - .add( - new BearerTokenAuthenticationPolicy( - credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPipeline httpPipeline = diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/AvailabilityGroupListenersClient.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/AvailabilityGroupListenersClient.java index 9afbf3561495..cb42d8dd67e7 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/AvailabilityGroupListenersClient.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/AvailabilityGroupListenersClient.java @@ -38,17 +38,19 @@ AvailabilityGroupListenerInner get( * the Azure Resource Manager API or the portal. * @param sqlVirtualMachineGroupName Name of the SQL virtual machine group. * @param availabilityGroupListenerName Name of the availability group listener. + * @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 an availability group listener. + * @return an availability group listener along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response getWithResponse( String resourceGroupName, String sqlVirtualMachineGroupName, String availabilityGroupListenerName, + String expand, Context context); /** @@ -62,9 +64,9 @@ Response getWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL Server availability group listener. + * @return the {@link SyncPoller} for polling of a SQL Server availability group listener. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, AvailabilityGroupListenerInner> beginCreateOrUpdate( String resourceGroupName, String sqlVirtualMachineGroupName, @@ -83,9 +85,9 @@ SyncPoller, AvailabilityGroupListener * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL Server availability group listener. + * @return the {@link SyncPoller} for polling of a SQL Server availability group listener. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, AvailabilityGroupListenerInner> beginCreateOrUpdate( String resourceGroupName, String sqlVirtualMachineGroupName, @@ -145,9 +147,9 @@ AvailabilityGroupListenerInner createOrUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete( String resourceGroupName, String sqlVirtualMachineGroupName, String availabilityGroupListenerName); @@ -162,9 +164,9 @@ SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete( String resourceGroupName, String sqlVirtualMachineGroupName, @@ -213,7 +215,7 @@ void 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 a list of availability group listeners. + * @return a list of availability group listeners as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByGroup( @@ -229,7 +231,7 @@ PagedIterable listByGroup( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of availability group listeners. + * @return a list of availability group listeners as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByGroup( diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/OperationsClient.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/OperationsClient.java index adaa4817e522..ad93d791b083 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/OperationsClient.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/OperationsClient.java @@ -13,23 +13,23 @@ /** 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. + * Lists all of the available SQL Virtual Machine 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. + * @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. + * Lists all of the available SQL Virtual Machine 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. + * @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/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/SqlVirtualMachineGroupsClient.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/SqlVirtualMachineGroupsClient.java index e34f1c45816a..6eabd134d166 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/SqlVirtualMachineGroupsClient.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/SqlVirtualMachineGroupsClient.java @@ -40,7 +40,7 @@ public interface SqlVirtualMachineGroupsClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response getByResourceGroupWithResponse( @@ -56,9 +56,9 @@ Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return the {@link SyncPoller} for polling of a SQL virtual machine group. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, SqlVirtualMachineGroupInner> beginCreateOrUpdate( String resourceGroupName, String sqlVirtualMachineGroupName, SqlVirtualMachineGroupInner parameters); @@ -73,9 +73,9 @@ SyncPoller, SqlVirtualMachineGroupInner> * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return the {@link SyncPoller} for polling of a SQL virtual machine group. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, SqlVirtualMachineGroupInner> beginCreateOrUpdate( String resourceGroupName, String sqlVirtualMachineGroupName, @@ -127,9 +127,9 @@ SqlVirtualMachineGroupInner createOrUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String sqlVirtualMachineGroupName); /** @@ -142,9 +142,9 @@ SqlVirtualMachineGroupInner createOrUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete( String resourceGroupName, String sqlVirtualMachineGroupName, Context context); @@ -185,9 +185,9 @@ SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return the {@link SyncPoller} for polling of a SQL virtual machine group. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, SqlVirtualMachineGroupInner> beginUpdate( String resourceGroupName, String sqlVirtualMachineGroupName, SqlVirtualMachineGroupUpdate parameters); @@ -202,9 +202,9 @@ SyncPoller, SqlVirtualMachineGroupInner> * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return the {@link SyncPoller} for polling of a SQL virtual machine group. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, SqlVirtualMachineGroupInner> beginUpdate( String resourceGroupName, String sqlVirtualMachineGroupName, @@ -255,7 +255,7 @@ SqlVirtualMachineGroupInner update( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a resource group. + * @return all SQL virtual machine groups in a resource group as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByResourceGroup(String resourceGroupName); @@ -269,7 +269,7 @@ SqlVirtualMachineGroupInner update( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a resource group. + * @return all SQL virtual machine groups in a resource group as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByResourceGroup(String resourceGroupName, Context context); @@ -279,7 +279,7 @@ SqlVirtualMachineGroupInner update( * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a subscription. + * @return all SQL virtual machine groups in a subscription as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(); @@ -291,7 +291,7 @@ SqlVirtualMachineGroupInner update( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a subscription. + * @return all SQL virtual machine groups in a subscription as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Context context); diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/SqlVirtualMachinesClient.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/SqlVirtualMachinesClient.java index ef2d554ca5d2..4ebf4f68c6e2 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/SqlVirtualMachinesClient.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/SqlVirtualMachinesClient.java @@ -25,7 +25,8 @@ public interface SqlVirtualMachinesClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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 sql virtual machines in a SQL virtual machine group. + * @return the list of sql virtual machines in a SQL virtual machine group as paginated response with {@link + * PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listBySqlVmGroup(String resourceGroupName, String sqlVirtualMachineGroupName); @@ -40,7 +41,8 @@ public interface SqlVirtualMachinesClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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 sql virtual machines in a SQL virtual machine group. + * @return the list of sql virtual machines in a SQL virtual machine group as paginated response with {@link + * PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listBySqlVmGroup( @@ -51,7 +53,7 @@ PagedIterable listBySqlVmGroup( * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a subscription. + * @return all SQL virtual machines in a subscription as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(); @@ -63,11 +65,68 @@ PagedIterable listBySqlVmGroup( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a subscription. + * @return all SQL virtual machines in a subscription as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Context context); + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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> beginRedeploy(String resourceGroupName, String sqlVirtualMachineName); + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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> beginRedeploy( + String resourceGroupName, String sqlVirtualMachineName, Context context); + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void redeploy(String resourceGroupName, String sqlVirtualMachineName); + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void redeploy(String resourceGroupName, String sqlVirtualMachineName, Context context); + /** * Gets a SQL virtual machine. * @@ -93,7 +152,7 @@ PagedIterable listBySqlVmGroup( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response getByResourceGroupWithResponse( @@ -109,9 +168,9 @@ Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return the {@link SyncPoller} for polling of a SQL virtual machine. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, SqlVirtualMachineInner> beginCreateOrUpdate( String resourceGroupName, String sqlVirtualMachineName, SqlVirtualMachineInner parameters); @@ -126,9 +185,9 @@ SyncPoller, SqlVirtualMachineInner> beginCrea * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return the {@link SyncPoller} for polling of a SQL virtual machine. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, SqlVirtualMachineInner> beginCreateOrUpdate( String resourceGroupName, String sqlVirtualMachineName, SqlVirtualMachineInner parameters, Context context); @@ -174,9 +233,9 @@ SqlVirtualMachineInner createOrUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String sqlVirtualMachineName); /** @@ -189,9 +248,9 @@ SqlVirtualMachineInner createOrUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete( String resourceGroupName, String sqlVirtualMachineName, Context context); @@ -232,9 +291,9 @@ SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return the {@link SyncPoller} for polling of a SQL virtual machine. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, SqlVirtualMachineInner> beginUpdate( String resourceGroupName, String sqlVirtualMachineName, SqlVirtualMachineUpdate parameters); @@ -249,9 +308,9 @@ SyncPoller, SqlVirtualMachineInner> beginUpda * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return the {@link SyncPoller} for polling of a SQL virtual machine. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, SqlVirtualMachineInner> beginUpdate( String resourceGroupName, String sqlVirtualMachineName, SqlVirtualMachineUpdate parameters, Context context); @@ -296,7 +355,7 @@ SqlVirtualMachineInner update( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a resource group. + * @return all SQL virtual machines in a resource group as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByResourceGroup(String resourceGroupName); @@ -310,8 +369,65 @@ SqlVirtualMachineInner update( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a resource group. + * @return all SQL virtual machines in a resource group as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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> beginStartAssessment(String resourceGroupName, String sqlVirtualMachineName); + + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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> beginStartAssessment( + String resourceGroupName, String sqlVirtualMachineName, Context context); + + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void startAssessment(String resourceGroupName, String sqlVirtualMachineName); + + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void startAssessment(String resourceGroupName, String sqlVirtualMachineName, Context context); } diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/AvailabilityGroupListenerInner.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/AvailabilityGroupListenerInner.java index 7238b97557ac..db15c49ec319 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/AvailabilityGroupListenerInner.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/AvailabilityGroupListenerInner.java @@ -5,49 +5,49 @@ package com.azure.resourcemanager.sqlvirtualmachine.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.JsonFlatten; import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sqlvirtualmachine.models.AgConfiguration; import com.azure.resourcemanager.sqlvirtualmachine.models.LoadBalancerConfiguration; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** A SQL Server availability group listener. */ -@JsonFlatten @Fluent -public class AvailabilityGroupListenerInner extends ProxyResource { +public final class AvailabilityGroupListenerInner extends ProxyResource { @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailabilityGroupListenerInner.class); /* - * Provisioning state to track the async operation status. + * Resource properties. */ - @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) - private String provisioningState; + @JsonProperty(value = "properties") + private AvailabilityGroupListenerProperties innerProperties; /* - * Name of the availability group. + * Metadata pertaining to creation and last modification of the resource. */ - @JsonProperty(value = "properties.availabilityGroupName") - private String availabilityGroupName; + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; - /* - * List of load balancer configurations for an availability group listener. - */ - @JsonProperty(value = "properties.loadBalancerConfigurations") - private List loadBalancerConfigurations; - - /* - * Create a default availability group if it does not exist. + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. */ - @JsonProperty(value = "properties.createDefaultAvailabilityGroupIfNotExist") - private Boolean createDefaultAvailabilityGroupIfNotExist; + private AvailabilityGroupListenerProperties innerProperties() { + return this.innerProperties; + } - /* - * Listener port. + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. */ - @JsonProperty(value = "properties.port") - private Integer port; + public SystemData systemData() { + return this.systemData; + } /** * Get the provisioningState property: Provisioning state to track the async operation status. @@ -55,7 +55,7 @@ public class AvailabilityGroupListenerInner extends ProxyResource { * @return the provisioningState value. */ public String provisioningState() { - return this.provisioningState; + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); } /** @@ -64,7 +64,7 @@ public String provisioningState() { * @return the availabilityGroupName value. */ public String availabilityGroupName() { - return this.availabilityGroupName; + return this.innerProperties() == null ? null : this.innerProperties().availabilityGroupName(); } /** @@ -74,7 +74,10 @@ public String availabilityGroupName() { * @return the AvailabilityGroupListenerInner object itself. */ public AvailabilityGroupListenerInner withAvailabilityGroupName(String availabilityGroupName) { - this.availabilityGroupName = availabilityGroupName; + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilityGroupListenerProperties(); + } + this.innerProperties().withAvailabilityGroupName(availabilityGroupName); return this; } @@ -85,7 +88,7 @@ public AvailabilityGroupListenerInner withAvailabilityGroupName(String availabil * @return the loadBalancerConfigurations value. */ public List loadBalancerConfigurations() { - return this.loadBalancerConfigurations; + return this.innerProperties() == null ? null : this.innerProperties().loadBalancerConfigurations(); } /** @@ -97,7 +100,10 @@ public List loadBalancerConfigurations() { */ public AvailabilityGroupListenerInner withLoadBalancerConfigurations( List loadBalancerConfigurations) { - this.loadBalancerConfigurations = loadBalancerConfigurations; + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilityGroupListenerProperties(); + } + this.innerProperties().withLoadBalancerConfigurations(loadBalancerConfigurations); return this; } @@ -108,7 +114,9 @@ public AvailabilityGroupListenerInner withLoadBalancerConfigurations( * @return the createDefaultAvailabilityGroupIfNotExist value. */ public Boolean createDefaultAvailabilityGroupIfNotExist() { - return this.createDefaultAvailabilityGroupIfNotExist; + return this.innerProperties() == null + ? null + : this.innerProperties().createDefaultAvailabilityGroupIfNotExist(); } /** @@ -120,7 +128,10 @@ public Boolean createDefaultAvailabilityGroupIfNotExist() { */ public AvailabilityGroupListenerInner withCreateDefaultAvailabilityGroupIfNotExist( Boolean createDefaultAvailabilityGroupIfNotExist) { - this.createDefaultAvailabilityGroupIfNotExist = createDefaultAvailabilityGroupIfNotExist; + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilityGroupListenerProperties(); + } + this.innerProperties().withCreateDefaultAvailabilityGroupIfNotExist(createDefaultAvailabilityGroupIfNotExist); return this; } @@ -130,7 +141,7 @@ public AvailabilityGroupListenerInner withCreateDefaultAvailabilityGroupIfNotExi * @return the port value. */ public Integer port() { - return this.port; + return this.innerProperties() == null ? null : this.innerProperties().port(); } /** @@ -140,7 +151,34 @@ public Integer port() { * @return the AvailabilityGroupListenerInner object itself. */ public AvailabilityGroupListenerInner withPort(Integer port) { - this.port = port; + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilityGroupListenerProperties(); + } + this.innerProperties().withPort(port); + return this; + } + + /** + * Get the availabilityGroupConfiguration property: Availability Group configuration. + * + * @return the availabilityGroupConfiguration value. + */ + public AgConfiguration availabilityGroupConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().availabilityGroupConfiguration(); + } + + /** + * Set the availabilityGroupConfiguration property: Availability Group configuration. + * + * @param availabilityGroupConfiguration the availabilityGroupConfiguration value to set. + * @return the AvailabilityGroupListenerInner object itself. + */ + public AvailabilityGroupListenerInner withAvailabilityGroupConfiguration( + AgConfiguration availabilityGroupConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilityGroupListenerProperties(); + } + this.innerProperties().withAvailabilityGroupConfiguration(availabilityGroupConfiguration); return this; } @@ -150,8 +188,8 @@ public AvailabilityGroupListenerInner withPort(Integer port) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (loadBalancerConfigurations() != null) { - loadBalancerConfigurations().forEach(e -> e.validate()); + if (innerProperties() != null) { + innerProperties().validate(); } } } diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/AvailabilityGroupListenerProperties.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/AvailabilityGroupListenerProperties.java new file mode 100644 index 000000000000..ef8f4ad9abc6 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/AvailabilityGroupListenerProperties.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.sqlvirtualmachine.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sqlvirtualmachine.models.AgConfiguration; +import com.azure.resourcemanager.sqlvirtualmachine.models.LoadBalancerConfiguration; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties of an availability group listener. */ +@Fluent +public final class AvailabilityGroupListenerProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailabilityGroupListenerProperties.class); + + /* + * Provisioning state to track the async operation status. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Name of the availability group. + */ + @JsonProperty(value = "availabilityGroupName") + private String availabilityGroupName; + + /* + * List of load balancer configurations for an availability group listener. + */ + @JsonProperty(value = "loadBalancerConfigurations") + private List loadBalancerConfigurations; + + /* + * Create a default availability group if it does not exist. + */ + @JsonProperty(value = "createDefaultAvailabilityGroupIfNotExist") + private Boolean createDefaultAvailabilityGroupIfNotExist; + + /* + * Listener port. + */ + @JsonProperty(value = "port") + private Integer port; + + /* + * Availability Group configuration. + */ + @JsonProperty(value = "availabilityGroupConfiguration") + private AgConfiguration availabilityGroupConfiguration; + + /** + * Get the provisioningState property: Provisioning state to track the async operation status. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the availabilityGroupName property: Name of the availability group. + * + * @return the availabilityGroupName value. + */ + public String availabilityGroupName() { + return this.availabilityGroupName; + } + + /** + * Set the availabilityGroupName property: Name of the availability group. + * + * @param availabilityGroupName the availabilityGroupName value to set. + * @return the AvailabilityGroupListenerProperties object itself. + */ + public AvailabilityGroupListenerProperties withAvailabilityGroupName(String availabilityGroupName) { + this.availabilityGroupName = availabilityGroupName; + return this; + } + + /** + * Get the loadBalancerConfigurations property: List of load balancer configurations for an availability group + * listener. + * + * @return the loadBalancerConfigurations value. + */ + public List loadBalancerConfigurations() { + return this.loadBalancerConfigurations; + } + + /** + * Set the loadBalancerConfigurations property: List of load balancer configurations for an availability group + * listener. + * + * @param loadBalancerConfigurations the loadBalancerConfigurations value to set. + * @return the AvailabilityGroupListenerProperties object itself. + */ + public AvailabilityGroupListenerProperties withLoadBalancerConfigurations( + List loadBalancerConfigurations) { + this.loadBalancerConfigurations = loadBalancerConfigurations; + return this; + } + + /** + * Get the createDefaultAvailabilityGroupIfNotExist property: Create a default availability group if it does not + * exist. + * + * @return the createDefaultAvailabilityGroupIfNotExist value. + */ + public Boolean createDefaultAvailabilityGroupIfNotExist() { + return this.createDefaultAvailabilityGroupIfNotExist; + } + + /** + * Set the createDefaultAvailabilityGroupIfNotExist property: Create a default availability group if it does not + * exist. + * + * @param createDefaultAvailabilityGroupIfNotExist the createDefaultAvailabilityGroupIfNotExist value to set. + * @return the AvailabilityGroupListenerProperties object itself. + */ + public AvailabilityGroupListenerProperties withCreateDefaultAvailabilityGroupIfNotExist( + Boolean createDefaultAvailabilityGroupIfNotExist) { + this.createDefaultAvailabilityGroupIfNotExist = createDefaultAvailabilityGroupIfNotExist; + return this; + } + + /** + * Get the port property: Listener port. + * + * @return the port value. + */ + public Integer port() { + return this.port; + } + + /** + * Set the port property: Listener port. + * + * @param port the port value to set. + * @return the AvailabilityGroupListenerProperties object itself. + */ + public AvailabilityGroupListenerProperties withPort(Integer port) { + this.port = port; + return this; + } + + /** + * Get the availabilityGroupConfiguration property: Availability Group configuration. + * + * @return the availabilityGroupConfiguration value. + */ + public AgConfiguration availabilityGroupConfiguration() { + return this.availabilityGroupConfiguration; + } + + /** + * Set the availabilityGroupConfiguration property: Availability Group configuration. + * + * @param availabilityGroupConfiguration the availabilityGroupConfiguration value to set. + * @return the AvailabilityGroupListenerProperties object itself. + */ + public AvailabilityGroupListenerProperties withAvailabilityGroupConfiguration( + AgConfiguration availabilityGroupConfiguration) { + this.availabilityGroupConfiguration = availabilityGroupConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (loadBalancerConfigurations() != null) { + loadBalancerConfigurations().forEach(e -> e.validate()); + } + if (availabilityGroupConfiguration() != null) { + availabilityGroupConfiguration().validate(); + } + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/OperationInner.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/OperationInner.java index cf222e4cbd3a..b7eb2ffbc9f5 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/OperationInner.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/OperationInner.java @@ -9,6 +9,7 @@ import com.azure.resourcemanager.sqlvirtualmachine.models.OperationDisplay; import com.azure.resourcemanager.sqlvirtualmachine.models.OperationOrigin; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -40,6 +41,7 @@ public final class OperationInner { * 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; /** diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/SqlVirtualMachineGroupInner.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/SqlVirtualMachineGroupInner.java index ac6365e974c9..1cbca3acb829 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/SqlVirtualMachineGroupInner.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/SqlVirtualMachineGroupInner.java @@ -5,8 +5,8 @@ package com.azure.resourcemanager.sqlvirtualmachine.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.JsonFlatten; import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.sqlvirtualmachine.models.ClusterConfiguration; import com.azure.resourcemanager.sqlvirtualmachine.models.ClusterManagerType; @@ -18,53 +18,53 @@ import java.util.Map; /** A SQL virtual machine group. */ -@JsonFlatten @Fluent -public class SqlVirtualMachineGroupInner extends Resource { +public final class SqlVirtualMachineGroupInner extends Resource { @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlVirtualMachineGroupInner.class); /* - * Provisioning state to track the async operation status. + * Resource properties. */ - @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) - private String provisioningState; + @JsonProperty(value = "properties") + private SqlVirtualMachineGroupProperties innerProperties; /* - * SQL image offer. Examples may include SQL2016-WS2016, SQL2017-WS2016. + * Metadata pertaining to creation and last modification of the resource. */ - @JsonProperty(value = "properties.sqlImageOffer") - private String sqlImageOffer; + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; - /* - * SQL image sku. - */ - @JsonProperty(value = "properties.sqlImageSku") - private SqlVmGroupImageSku sqlImageSku; - - /* - * Scale type. + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. */ - @JsonProperty(value = "properties.scaleType", access = JsonProperty.Access.WRITE_ONLY) - private ScaleType scaleType; + private SqlVirtualMachineGroupProperties innerProperties() { + return this.innerProperties; + } - /* - * Type of cluster manager: Windows Server Failover Cluster (WSFC), implied - * by the scale type of the group and the OS type. + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. */ - @JsonProperty(value = "properties.clusterManagerType", access = JsonProperty.Access.WRITE_ONLY) - private ClusterManagerType clusterManagerType; + public SystemData systemData() { + return this.systemData; + } - /* - * Cluster type. - */ - @JsonProperty(value = "properties.clusterConfiguration", access = JsonProperty.Access.WRITE_ONLY) - private ClusterConfiguration clusterConfiguration; + /** {@inheritDoc} */ + @Override + public SqlVirtualMachineGroupInner withLocation(String location) { + super.withLocation(location); + return this; + } - /* - * Cluster Active Directory domain profile. - */ - @JsonProperty(value = "properties.wsfcDomainProfile") - private WsfcDomainProfile wsfcDomainProfile; + /** {@inheritDoc} */ + @Override + public SqlVirtualMachineGroupInner withTags(Map tags) { + super.withTags(tags); + return this; + } /** * Get the provisioningState property: Provisioning state to track the async operation status. @@ -72,7 +72,7 @@ public class SqlVirtualMachineGroupInner extends Resource { * @return the provisioningState value. */ public String provisioningState() { - return this.provisioningState; + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); } /** @@ -81,7 +81,7 @@ public String provisioningState() { * @return the sqlImageOffer value. */ public String sqlImageOffer() { - return this.sqlImageOffer; + return this.innerProperties() == null ? null : this.innerProperties().sqlImageOffer(); } /** @@ -91,7 +91,10 @@ public String sqlImageOffer() { * @return the SqlVirtualMachineGroupInner object itself. */ public SqlVirtualMachineGroupInner withSqlImageOffer(String sqlImageOffer) { - this.sqlImageOffer = sqlImageOffer; + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineGroupProperties(); + } + this.innerProperties().withSqlImageOffer(sqlImageOffer); return this; } @@ -101,7 +104,7 @@ public SqlVirtualMachineGroupInner withSqlImageOffer(String sqlImageOffer) { * @return the sqlImageSku value. */ public SqlVmGroupImageSku sqlImageSku() { - return this.sqlImageSku; + return this.innerProperties() == null ? null : this.innerProperties().sqlImageSku(); } /** @@ -111,7 +114,10 @@ public SqlVmGroupImageSku sqlImageSku() { * @return the SqlVirtualMachineGroupInner object itself. */ public SqlVirtualMachineGroupInner withSqlImageSku(SqlVmGroupImageSku sqlImageSku) { - this.sqlImageSku = sqlImageSku; + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineGroupProperties(); + } + this.innerProperties().withSqlImageSku(sqlImageSku); return this; } @@ -121,7 +127,7 @@ public SqlVirtualMachineGroupInner withSqlImageSku(SqlVmGroupImageSku sqlImageSk * @return the scaleType value. */ public ScaleType scaleType() { - return this.scaleType; + return this.innerProperties() == null ? null : this.innerProperties().scaleType(); } /** @@ -131,7 +137,7 @@ public ScaleType scaleType() { * @return the clusterManagerType value. */ public ClusterManagerType clusterManagerType() { - return this.clusterManagerType; + return this.innerProperties() == null ? null : this.innerProperties().clusterManagerType(); } /** @@ -140,7 +146,7 @@ public ClusterManagerType clusterManagerType() { * @return the clusterConfiguration value. */ public ClusterConfiguration clusterConfiguration() { - return this.clusterConfiguration; + return this.innerProperties() == null ? null : this.innerProperties().clusterConfiguration(); } /** @@ -149,7 +155,7 @@ public ClusterConfiguration clusterConfiguration() { * @return the wsfcDomainProfile value. */ public WsfcDomainProfile wsfcDomainProfile() { - return this.wsfcDomainProfile; + return this.innerProperties() == null ? null : this.innerProperties().wsfcDomainProfile(); } /** @@ -159,21 +165,10 @@ public WsfcDomainProfile wsfcDomainProfile() { * @return the SqlVirtualMachineGroupInner object itself. */ public SqlVirtualMachineGroupInner withWsfcDomainProfile(WsfcDomainProfile wsfcDomainProfile) { - this.wsfcDomainProfile = wsfcDomainProfile; - return this; - } - - /** {@inheritDoc} */ - @Override - public SqlVirtualMachineGroupInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** {@inheritDoc} */ - @Override - public SqlVirtualMachineGroupInner withTags(Map tags) { - super.withTags(tags); + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineGroupProperties(); + } + this.innerProperties().withWsfcDomainProfile(wsfcDomainProfile); return this; } @@ -183,8 +178,8 @@ public SqlVirtualMachineGroupInner withTags(Map tags) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (wsfcDomainProfile() != null) { - wsfcDomainProfile().validate(); + if (innerProperties() != null) { + innerProperties().validate(); } } } diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/SqlVirtualMachineGroupProperties.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/SqlVirtualMachineGroupProperties.java new file mode 100644 index 000000000000..3294061efdc2 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/SqlVirtualMachineGroupProperties.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.sqlvirtualmachine.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sqlvirtualmachine.models.ClusterConfiguration; +import com.azure.resourcemanager.sqlvirtualmachine.models.ClusterManagerType; +import com.azure.resourcemanager.sqlvirtualmachine.models.ScaleType; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlVmGroupImageSku; +import com.azure.resourcemanager.sqlvirtualmachine.models.WsfcDomainProfile; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a SQL virtual machine group. */ +@Fluent +public final class SqlVirtualMachineGroupProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlVirtualMachineGroupProperties.class); + + /* + * Provisioning state to track the async operation status. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * SQL image offer. Examples may include SQL2016-WS2016, SQL2017-WS2016. + */ + @JsonProperty(value = "sqlImageOffer") + private String sqlImageOffer; + + /* + * SQL image sku. + */ + @JsonProperty(value = "sqlImageSku") + private SqlVmGroupImageSku sqlImageSku; + + /* + * Scale type. + */ + @JsonProperty(value = "scaleType", access = JsonProperty.Access.WRITE_ONLY) + private ScaleType scaleType; + + /* + * Type of cluster manager: Windows Server Failover Cluster (WSFC), implied + * by the scale type of the group and the OS type. + */ + @JsonProperty(value = "clusterManagerType", access = JsonProperty.Access.WRITE_ONLY) + private ClusterManagerType clusterManagerType; + + /* + * Cluster type. + */ + @JsonProperty(value = "clusterConfiguration", access = JsonProperty.Access.WRITE_ONLY) + private ClusterConfiguration clusterConfiguration; + + /* + * Cluster Active Directory domain profile. + */ + @JsonProperty(value = "wsfcDomainProfile") + private WsfcDomainProfile wsfcDomainProfile; + + /** + * Get the provisioningState property: Provisioning state to track the async operation status. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the sqlImageOffer property: SQL image offer. Examples may include SQL2016-WS2016, SQL2017-WS2016. + * + * @return the sqlImageOffer value. + */ + public String sqlImageOffer() { + return this.sqlImageOffer; + } + + /** + * Set the sqlImageOffer property: SQL image offer. Examples may include SQL2016-WS2016, SQL2017-WS2016. + * + * @param sqlImageOffer the sqlImageOffer value to set. + * @return the SqlVirtualMachineGroupProperties object itself. + */ + public SqlVirtualMachineGroupProperties withSqlImageOffer(String sqlImageOffer) { + this.sqlImageOffer = sqlImageOffer; + return this; + } + + /** + * Get the sqlImageSku property: SQL image sku. + * + * @return the sqlImageSku value. + */ + public SqlVmGroupImageSku sqlImageSku() { + return this.sqlImageSku; + } + + /** + * Set the sqlImageSku property: SQL image sku. + * + * @param sqlImageSku the sqlImageSku value to set. + * @return the SqlVirtualMachineGroupProperties object itself. + */ + public SqlVirtualMachineGroupProperties withSqlImageSku(SqlVmGroupImageSku sqlImageSku) { + this.sqlImageSku = sqlImageSku; + return this; + } + + /** + * Get the scaleType property: Scale type. + * + * @return the scaleType value. + */ + public ScaleType scaleType() { + return this.scaleType; + } + + /** + * Get the clusterManagerType property: Type of cluster manager: Windows Server Failover Cluster (WSFC), implied by + * the scale type of the group and the OS type. + * + * @return the clusterManagerType value. + */ + public ClusterManagerType clusterManagerType() { + return this.clusterManagerType; + } + + /** + * Get the clusterConfiguration property: Cluster type. + * + * @return the clusterConfiguration value. + */ + public ClusterConfiguration clusterConfiguration() { + return this.clusterConfiguration; + } + + /** + * Get the wsfcDomainProfile property: Cluster Active Directory domain profile. + * + * @return the wsfcDomainProfile value. + */ + public WsfcDomainProfile wsfcDomainProfile() { + return this.wsfcDomainProfile; + } + + /** + * Set the wsfcDomainProfile property: Cluster Active Directory domain profile. + * + * @param wsfcDomainProfile the wsfcDomainProfile value to set. + * @return the SqlVirtualMachineGroupProperties object itself. + */ + public SqlVirtualMachineGroupProperties withWsfcDomainProfile(WsfcDomainProfile wsfcDomainProfile) { + this.wsfcDomainProfile = wsfcDomainProfile; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (wsfcDomainProfile() != null) { + wsfcDomainProfile().validate(); + } + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/SqlVirtualMachineInner.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/SqlVirtualMachineInner.java index b953cc9e4340..eac89001ab04 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/SqlVirtualMachineInner.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/SqlVirtualMachineInner.java @@ -5,9 +5,10 @@ package com.azure.resourcemanager.sqlvirtualmachine.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.JsonFlatten; import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sqlvirtualmachine.models.AssessmentSettings; import com.azure.resourcemanager.sqlvirtualmachine.models.AutoBackupSettings; import com.azure.resourcemanager.sqlvirtualmachine.models.AutoPatchingSettings; import com.azure.resourcemanager.sqlvirtualmachine.models.KeyVaultCredentialSettings; @@ -23,9 +24,8 @@ import java.util.Map; /** A SQL virtual machine. */ -@JsonFlatten @Fluent -public class SqlVirtualMachineInner extends Resource { +public final class SqlVirtualMachineInner extends Resource { @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlVirtualMachineInner.class); /* @@ -35,86 +35,16 @@ public class SqlVirtualMachineInner extends Resource { private ResourceIdentity identity; /* - * ARM Resource id of underlying virtual machine created from SQL - * marketplace image. - */ - @JsonProperty(value = "properties.virtualMachineResourceId") - private String virtualMachineResourceId; - - /* - * Provisioning state to track the async operation status. - */ - @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) - private String provisioningState; - - /* - * SQL image offer. Examples include SQL2016-WS2016, SQL2017-WS2016. - */ - @JsonProperty(value = "properties.sqlImageOffer") - private String sqlImageOffer; - - /* - * SQL Server license type. - */ - @JsonProperty(value = "properties.sqlServerLicenseType") - private SqlServerLicenseType sqlServerLicenseType; - - /* - * SQL Server Management type. - */ - @JsonProperty(value = "properties.sqlManagement") - private SqlManagementMode sqlManagement; - - /* - * SQL Server edition type. - */ - @JsonProperty(value = "properties.sqlImageSku") - private SqlImageSku sqlImageSku; - - /* - * ARM resource id of the SQL virtual machine group this SQL virtual - * machine is or will be part of. - */ - @JsonProperty(value = "properties.sqlVirtualMachineGroupResourceId") - private String sqlVirtualMachineGroupResourceId; - - /* - * Domain credentials for setting up Windows Server Failover Cluster for - * SQL availability group. + * Resource properties. */ - @JsonProperty(value = "properties.wsfcDomainCredentials") - private WsfcDomainCredentials wsfcDomainCredentials; + @JsonProperty(value = "properties") + private SqlVirtualMachineProperties innerProperties; /* - * Auto patching settings for applying critical security updates to SQL - * virtual machine. + * Metadata pertaining to creation and last modification of the resource. */ - @JsonProperty(value = "properties.autoPatchingSettings") - private AutoPatchingSettings autoPatchingSettings; - - /* - * Auto backup settings for SQL Server. - */ - @JsonProperty(value = "properties.autoBackupSettings") - private AutoBackupSettings autoBackupSettings; - - /* - * Key vault credential settings. - */ - @JsonProperty(value = "properties.keyVaultCredentialSettings") - private KeyVaultCredentialSettings keyVaultCredentialSettings; - - /* - * SQL Server configuration management settings. - */ - @JsonProperty(value = "properties.serverConfigurationsManagementSettings") - private ServerConfigurationsManagementSettings serverConfigurationsManagementSettings; - - /* - * Storage Configuration Settings. - */ - @JsonProperty(value = "properties.storageConfigurationSettings") - private StorageConfigurationSettings storageConfigurationSettings; + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; /** * Get the identity property: Azure Active Directory identity of the server. @@ -136,6 +66,38 @@ public SqlVirtualMachineInner withIdentity(ResourceIdentity identity) { return this; } + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SqlVirtualMachineProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public SqlVirtualMachineInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlVirtualMachineInner withTags(Map tags) { + super.withTags(tags); + return this; + } + /** * Get the virtualMachineResourceId property: ARM Resource id of underlying virtual machine created from SQL * marketplace image. @@ -143,7 +105,7 @@ public SqlVirtualMachineInner withIdentity(ResourceIdentity identity) { * @return the virtualMachineResourceId value. */ public String virtualMachineResourceId() { - return this.virtualMachineResourceId; + return this.innerProperties() == null ? null : this.innerProperties().virtualMachineResourceId(); } /** @@ -154,7 +116,10 @@ public String virtualMachineResourceId() { * @return the SqlVirtualMachineInner object itself. */ public SqlVirtualMachineInner withVirtualMachineResourceId(String virtualMachineResourceId) { - this.virtualMachineResourceId = virtualMachineResourceId; + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineProperties(); + } + this.innerProperties().withVirtualMachineResourceId(virtualMachineResourceId); return this; } @@ -164,7 +129,7 @@ public SqlVirtualMachineInner withVirtualMachineResourceId(String virtualMachine * @return the provisioningState value. */ public String provisioningState() { - return this.provisioningState; + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); } /** @@ -173,7 +138,7 @@ public String provisioningState() { * @return the sqlImageOffer value. */ public String sqlImageOffer() { - return this.sqlImageOffer; + return this.innerProperties() == null ? null : this.innerProperties().sqlImageOffer(); } /** @@ -183,7 +148,10 @@ public String sqlImageOffer() { * @return the SqlVirtualMachineInner object itself. */ public SqlVirtualMachineInner withSqlImageOffer(String sqlImageOffer) { - this.sqlImageOffer = sqlImageOffer; + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineProperties(); + } + this.innerProperties().withSqlImageOffer(sqlImageOffer); return this; } @@ -193,7 +161,7 @@ public SqlVirtualMachineInner withSqlImageOffer(String sqlImageOffer) { * @return the sqlServerLicenseType value. */ public SqlServerLicenseType sqlServerLicenseType() { - return this.sqlServerLicenseType; + return this.innerProperties() == null ? null : this.innerProperties().sqlServerLicenseType(); } /** @@ -203,7 +171,10 @@ public SqlServerLicenseType sqlServerLicenseType() { * @return the SqlVirtualMachineInner object itself. */ public SqlVirtualMachineInner withSqlServerLicenseType(SqlServerLicenseType sqlServerLicenseType) { - this.sqlServerLicenseType = sqlServerLicenseType; + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineProperties(); + } + this.innerProperties().withSqlServerLicenseType(sqlServerLicenseType); return this; } @@ -213,7 +184,7 @@ public SqlVirtualMachineInner withSqlServerLicenseType(SqlServerLicenseType sqlS * @return the sqlManagement value. */ public SqlManagementMode sqlManagement() { - return this.sqlManagement; + return this.innerProperties() == null ? null : this.innerProperties().sqlManagement(); } /** @@ -223,7 +194,10 @@ public SqlManagementMode sqlManagement() { * @return the SqlVirtualMachineInner object itself. */ public SqlVirtualMachineInner withSqlManagement(SqlManagementMode sqlManagement) { - this.sqlManagement = sqlManagement; + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineProperties(); + } + this.innerProperties().withSqlManagement(sqlManagement); return this; } @@ -233,7 +207,7 @@ public SqlVirtualMachineInner withSqlManagement(SqlManagementMode sqlManagement) * @return the sqlImageSku value. */ public SqlImageSku sqlImageSku() { - return this.sqlImageSku; + return this.innerProperties() == null ? null : this.innerProperties().sqlImageSku(); } /** @@ -243,7 +217,10 @@ public SqlImageSku sqlImageSku() { * @return the SqlVirtualMachineInner object itself. */ public SqlVirtualMachineInner withSqlImageSku(SqlImageSku sqlImageSku) { - this.sqlImageSku = sqlImageSku; + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineProperties(); + } + this.innerProperties().withSqlImageSku(sqlImageSku); return this; } @@ -254,7 +231,7 @@ public SqlVirtualMachineInner withSqlImageSku(SqlImageSku sqlImageSku) { * @return the sqlVirtualMachineGroupResourceId value. */ public String sqlVirtualMachineGroupResourceId() { - return this.sqlVirtualMachineGroupResourceId; + return this.innerProperties() == null ? null : this.innerProperties().sqlVirtualMachineGroupResourceId(); } /** @@ -265,7 +242,10 @@ public String sqlVirtualMachineGroupResourceId() { * @return the SqlVirtualMachineInner object itself. */ public SqlVirtualMachineInner withSqlVirtualMachineGroupResourceId(String sqlVirtualMachineGroupResourceId) { - this.sqlVirtualMachineGroupResourceId = sqlVirtualMachineGroupResourceId; + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineProperties(); + } + this.innerProperties().withSqlVirtualMachineGroupResourceId(sqlVirtualMachineGroupResourceId); return this; } @@ -276,7 +256,7 @@ public SqlVirtualMachineInner withSqlVirtualMachineGroupResourceId(String sqlVir * @return the wsfcDomainCredentials value. */ public WsfcDomainCredentials wsfcDomainCredentials() { - return this.wsfcDomainCredentials; + return this.innerProperties() == null ? null : this.innerProperties().wsfcDomainCredentials(); } /** @@ -287,7 +267,10 @@ public WsfcDomainCredentials wsfcDomainCredentials() { * @return the SqlVirtualMachineInner object itself. */ public SqlVirtualMachineInner withWsfcDomainCredentials(WsfcDomainCredentials wsfcDomainCredentials) { - this.wsfcDomainCredentials = wsfcDomainCredentials; + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineProperties(); + } + this.innerProperties().withWsfcDomainCredentials(wsfcDomainCredentials); return this; } @@ -298,7 +281,7 @@ public SqlVirtualMachineInner withWsfcDomainCredentials(WsfcDomainCredentials ws * @return the autoPatchingSettings value. */ public AutoPatchingSettings autoPatchingSettings() { - return this.autoPatchingSettings; + return this.innerProperties() == null ? null : this.innerProperties().autoPatchingSettings(); } /** @@ -309,7 +292,10 @@ public AutoPatchingSettings autoPatchingSettings() { * @return the SqlVirtualMachineInner object itself. */ public SqlVirtualMachineInner withAutoPatchingSettings(AutoPatchingSettings autoPatchingSettings) { - this.autoPatchingSettings = autoPatchingSettings; + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineProperties(); + } + this.innerProperties().withAutoPatchingSettings(autoPatchingSettings); return this; } @@ -319,7 +305,7 @@ public SqlVirtualMachineInner withAutoPatchingSettings(AutoPatchingSettings auto * @return the autoBackupSettings value. */ public AutoBackupSettings autoBackupSettings() { - return this.autoBackupSettings; + return this.innerProperties() == null ? null : this.innerProperties().autoBackupSettings(); } /** @@ -329,7 +315,10 @@ public AutoBackupSettings autoBackupSettings() { * @return the SqlVirtualMachineInner object itself. */ public SqlVirtualMachineInner withAutoBackupSettings(AutoBackupSettings autoBackupSettings) { - this.autoBackupSettings = autoBackupSettings; + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineProperties(); + } + this.innerProperties().withAutoBackupSettings(autoBackupSettings); return this; } @@ -339,7 +328,7 @@ public SqlVirtualMachineInner withAutoBackupSettings(AutoBackupSettings autoBack * @return the keyVaultCredentialSettings value. */ public KeyVaultCredentialSettings keyVaultCredentialSettings() { - return this.keyVaultCredentialSettings; + return this.innerProperties() == null ? null : this.innerProperties().keyVaultCredentialSettings(); } /** @@ -350,7 +339,10 @@ public KeyVaultCredentialSettings keyVaultCredentialSettings() { */ public SqlVirtualMachineInner withKeyVaultCredentialSettings( KeyVaultCredentialSettings keyVaultCredentialSettings) { - this.keyVaultCredentialSettings = keyVaultCredentialSettings; + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineProperties(); + } + this.innerProperties().withKeyVaultCredentialSettings(keyVaultCredentialSettings); return this; } @@ -360,7 +352,7 @@ public SqlVirtualMachineInner withKeyVaultCredentialSettings( * @return the serverConfigurationsManagementSettings value. */ public ServerConfigurationsManagementSettings serverConfigurationsManagementSettings() { - return this.serverConfigurationsManagementSettings; + return this.innerProperties() == null ? null : this.innerProperties().serverConfigurationsManagementSettings(); } /** @@ -371,7 +363,10 @@ public ServerConfigurationsManagementSettings serverConfigurationsManagementSett */ public SqlVirtualMachineInner withServerConfigurationsManagementSettings( ServerConfigurationsManagementSettings serverConfigurationsManagementSettings) { - this.serverConfigurationsManagementSettings = serverConfigurationsManagementSettings; + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineProperties(); + } + this.innerProperties().withServerConfigurationsManagementSettings(serverConfigurationsManagementSettings); return this; } @@ -381,7 +376,7 @@ public SqlVirtualMachineInner withServerConfigurationsManagementSettings( * @return the storageConfigurationSettings value. */ public StorageConfigurationSettings storageConfigurationSettings() { - return this.storageConfigurationSettings; + return this.innerProperties() == null ? null : this.innerProperties().storageConfigurationSettings(); } /** @@ -392,21 +387,33 @@ public StorageConfigurationSettings storageConfigurationSettings() { */ public SqlVirtualMachineInner withStorageConfigurationSettings( StorageConfigurationSettings storageConfigurationSettings) { - this.storageConfigurationSettings = storageConfigurationSettings; + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineProperties(); + } + this.innerProperties().withStorageConfigurationSettings(storageConfigurationSettings); return this; } - /** {@inheritDoc} */ - @Override - public SqlVirtualMachineInner withLocation(String location) { - super.withLocation(location); - return this; + /** + * Get the assessmentSettings property: Assessment Settings. + * + * @return the assessmentSettings value. + */ + public AssessmentSettings assessmentSettings() { + return this.innerProperties() == null ? null : this.innerProperties().assessmentSettings(); } - /** {@inheritDoc} */ - @Override - public SqlVirtualMachineInner withTags(Map tags) { - super.withTags(tags); + /** + * Set the assessmentSettings property: Assessment Settings. + * + * @param assessmentSettings the assessmentSettings value to set. + * @return the SqlVirtualMachineInner object itself. + */ + public SqlVirtualMachineInner withAssessmentSettings(AssessmentSettings assessmentSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlVirtualMachineProperties(); + } + this.innerProperties().withAssessmentSettings(assessmentSettings); return this; } @@ -419,23 +426,8 @@ public void validate() { if (identity() != null) { identity().validate(); } - if (wsfcDomainCredentials() != null) { - wsfcDomainCredentials().validate(); - } - if (autoPatchingSettings() != null) { - autoPatchingSettings().validate(); - } - if (autoBackupSettings() != null) { - autoBackupSettings().validate(); - } - if (keyVaultCredentialSettings() != null) { - keyVaultCredentialSettings().validate(); - } - if (serverConfigurationsManagementSettings() != null) { - serverConfigurationsManagementSettings().validate(); - } - if (storageConfigurationSettings() != null) { - storageConfigurationSettings().validate(); + if (innerProperties() != null) { + innerProperties().validate(); } } } diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/SqlVirtualMachineProperties.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/SqlVirtualMachineProperties.java new file mode 100644 index 000000000000..070f5c530dcc --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/fluent/models/SqlVirtualMachineProperties.java @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sqlvirtualmachine.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sqlvirtualmachine.models.AssessmentSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.AutoBackupSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.AutoPatchingSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.KeyVaultCredentialSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.ServerConfigurationsManagementSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlImageSku; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlManagementMode; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlServerLicenseType; +import com.azure.resourcemanager.sqlvirtualmachine.models.StorageConfigurationSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.WsfcDomainCredentials; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SQL virtual machine properties. */ +@Fluent +public final class SqlVirtualMachineProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlVirtualMachineProperties.class); + + /* + * ARM Resource id of underlying virtual machine created from SQL + * marketplace image. + */ + @JsonProperty(value = "virtualMachineResourceId") + private String virtualMachineResourceId; + + /* + * Provisioning state to track the async operation status. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * SQL image offer. Examples include SQL2016-WS2016, SQL2017-WS2016. + */ + @JsonProperty(value = "sqlImageOffer") + private String sqlImageOffer; + + /* + * SQL Server license type. + */ + @JsonProperty(value = "sqlServerLicenseType") + private SqlServerLicenseType sqlServerLicenseType; + + /* + * SQL Server Management type. + */ + @JsonProperty(value = "sqlManagement") + private SqlManagementMode sqlManagement; + + /* + * SQL Server edition type. + */ + @JsonProperty(value = "sqlImageSku") + private SqlImageSku sqlImageSku; + + /* + * ARM resource id of the SQL virtual machine group this SQL virtual + * machine is or will be part of. + */ + @JsonProperty(value = "sqlVirtualMachineGroupResourceId") + private String sqlVirtualMachineGroupResourceId; + + /* + * Domain credentials for setting up Windows Server Failover Cluster for + * SQL availability group. + */ + @JsonProperty(value = "wsfcDomainCredentials") + private WsfcDomainCredentials wsfcDomainCredentials; + + /* + * Auto patching settings for applying critical security updates to SQL + * virtual machine. + */ + @JsonProperty(value = "autoPatchingSettings") + private AutoPatchingSettings autoPatchingSettings; + + /* + * Auto backup settings for SQL Server. + */ + @JsonProperty(value = "autoBackupSettings") + private AutoBackupSettings autoBackupSettings; + + /* + * Key vault credential settings. + */ + @JsonProperty(value = "keyVaultCredentialSettings") + private KeyVaultCredentialSettings keyVaultCredentialSettings; + + /* + * SQL Server configuration management settings. + */ + @JsonProperty(value = "serverConfigurationsManagementSettings") + private ServerConfigurationsManagementSettings serverConfigurationsManagementSettings; + + /* + * Storage Configuration Settings. + */ + @JsonProperty(value = "storageConfigurationSettings") + private StorageConfigurationSettings storageConfigurationSettings; + + /* + * Assessment Settings. + */ + @JsonProperty(value = "assessmentSettings") + private AssessmentSettings assessmentSettings; + + /** + * Get the virtualMachineResourceId property: ARM Resource id of underlying virtual machine created from SQL + * marketplace image. + * + * @return the virtualMachineResourceId value. + */ + public String virtualMachineResourceId() { + return this.virtualMachineResourceId; + } + + /** + * Set the virtualMachineResourceId property: ARM Resource id of underlying virtual machine created from SQL + * marketplace image. + * + * @param virtualMachineResourceId the virtualMachineResourceId value to set. + * @return the SqlVirtualMachineProperties object itself. + */ + public SqlVirtualMachineProperties withVirtualMachineResourceId(String virtualMachineResourceId) { + this.virtualMachineResourceId = virtualMachineResourceId; + return this; + } + + /** + * Get the provisioningState property: Provisioning state to track the async operation status. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the sqlImageOffer property: SQL image offer. Examples include SQL2016-WS2016, SQL2017-WS2016. + * + * @return the sqlImageOffer value. + */ + public String sqlImageOffer() { + return this.sqlImageOffer; + } + + /** + * Set the sqlImageOffer property: SQL image offer. Examples include SQL2016-WS2016, SQL2017-WS2016. + * + * @param sqlImageOffer the sqlImageOffer value to set. + * @return the SqlVirtualMachineProperties object itself. + */ + public SqlVirtualMachineProperties withSqlImageOffer(String sqlImageOffer) { + this.sqlImageOffer = sqlImageOffer; + return this; + } + + /** + * Get the sqlServerLicenseType property: SQL Server license type. + * + * @return the sqlServerLicenseType value. + */ + public SqlServerLicenseType sqlServerLicenseType() { + return this.sqlServerLicenseType; + } + + /** + * Set the sqlServerLicenseType property: SQL Server license type. + * + * @param sqlServerLicenseType the sqlServerLicenseType value to set. + * @return the SqlVirtualMachineProperties object itself. + */ + public SqlVirtualMachineProperties withSqlServerLicenseType(SqlServerLicenseType sqlServerLicenseType) { + this.sqlServerLicenseType = sqlServerLicenseType; + return this; + } + + /** + * Get the sqlManagement property: SQL Server Management type. + * + * @return the sqlManagement value. + */ + public SqlManagementMode sqlManagement() { + return this.sqlManagement; + } + + /** + * Set the sqlManagement property: SQL Server Management type. + * + * @param sqlManagement the sqlManagement value to set. + * @return the SqlVirtualMachineProperties object itself. + */ + public SqlVirtualMachineProperties withSqlManagement(SqlManagementMode sqlManagement) { + this.sqlManagement = sqlManagement; + return this; + } + + /** + * Get the sqlImageSku property: SQL Server edition type. + * + * @return the sqlImageSku value. + */ + public SqlImageSku sqlImageSku() { + return this.sqlImageSku; + } + + /** + * Set the sqlImageSku property: SQL Server edition type. + * + * @param sqlImageSku the sqlImageSku value to set. + * @return the SqlVirtualMachineProperties object itself. + */ + public SqlVirtualMachineProperties withSqlImageSku(SqlImageSku sqlImageSku) { + this.sqlImageSku = sqlImageSku; + return this; + } + + /** + * Get the sqlVirtualMachineGroupResourceId property: ARM resource id of the SQL virtual machine group this SQL + * virtual machine is or will be part of. + * + * @return the sqlVirtualMachineGroupResourceId value. + */ + public String sqlVirtualMachineGroupResourceId() { + return this.sqlVirtualMachineGroupResourceId; + } + + /** + * Set the sqlVirtualMachineGroupResourceId property: ARM resource id of the SQL virtual machine group this SQL + * virtual machine is or will be part of. + * + * @param sqlVirtualMachineGroupResourceId the sqlVirtualMachineGroupResourceId value to set. + * @return the SqlVirtualMachineProperties object itself. + */ + public SqlVirtualMachineProperties withSqlVirtualMachineGroupResourceId(String sqlVirtualMachineGroupResourceId) { + this.sqlVirtualMachineGroupResourceId = sqlVirtualMachineGroupResourceId; + return this; + } + + /** + * Get the wsfcDomainCredentials property: Domain credentials for setting up Windows Server Failover Cluster for SQL + * availability group. + * + * @return the wsfcDomainCredentials value. + */ + public WsfcDomainCredentials wsfcDomainCredentials() { + return this.wsfcDomainCredentials; + } + + /** + * Set the wsfcDomainCredentials property: Domain credentials for setting up Windows Server Failover Cluster for SQL + * availability group. + * + * @param wsfcDomainCredentials the wsfcDomainCredentials value to set. + * @return the SqlVirtualMachineProperties object itself. + */ + public SqlVirtualMachineProperties withWsfcDomainCredentials(WsfcDomainCredentials wsfcDomainCredentials) { + this.wsfcDomainCredentials = wsfcDomainCredentials; + return this; + } + + /** + * Get the autoPatchingSettings property: Auto patching settings for applying critical security updates to SQL + * virtual machine. + * + * @return the autoPatchingSettings value. + */ + public AutoPatchingSettings autoPatchingSettings() { + return this.autoPatchingSettings; + } + + /** + * Set the autoPatchingSettings property: Auto patching settings for applying critical security updates to SQL + * virtual machine. + * + * @param autoPatchingSettings the autoPatchingSettings value to set. + * @return the SqlVirtualMachineProperties object itself. + */ + public SqlVirtualMachineProperties withAutoPatchingSettings(AutoPatchingSettings autoPatchingSettings) { + this.autoPatchingSettings = autoPatchingSettings; + return this; + } + + /** + * Get the autoBackupSettings property: Auto backup settings for SQL Server. + * + * @return the autoBackupSettings value. + */ + public AutoBackupSettings autoBackupSettings() { + return this.autoBackupSettings; + } + + /** + * Set the autoBackupSettings property: Auto backup settings for SQL Server. + * + * @param autoBackupSettings the autoBackupSettings value to set. + * @return the SqlVirtualMachineProperties object itself. + */ + public SqlVirtualMachineProperties withAutoBackupSettings(AutoBackupSettings autoBackupSettings) { + this.autoBackupSettings = autoBackupSettings; + return this; + } + + /** + * Get the keyVaultCredentialSettings property: Key vault credential settings. + * + * @return the keyVaultCredentialSettings value. + */ + public KeyVaultCredentialSettings keyVaultCredentialSettings() { + return this.keyVaultCredentialSettings; + } + + /** + * Set the keyVaultCredentialSettings property: Key vault credential settings. + * + * @param keyVaultCredentialSettings the keyVaultCredentialSettings value to set. + * @return the SqlVirtualMachineProperties object itself. + */ + public SqlVirtualMachineProperties withKeyVaultCredentialSettings( + KeyVaultCredentialSettings keyVaultCredentialSettings) { + this.keyVaultCredentialSettings = keyVaultCredentialSettings; + return this; + } + + /** + * Get the serverConfigurationsManagementSettings property: SQL Server configuration management settings. + * + * @return the serverConfigurationsManagementSettings value. + */ + public ServerConfigurationsManagementSettings serverConfigurationsManagementSettings() { + return this.serverConfigurationsManagementSettings; + } + + /** + * Set the serverConfigurationsManagementSettings property: SQL Server configuration management settings. + * + * @param serverConfigurationsManagementSettings the serverConfigurationsManagementSettings value to set. + * @return the SqlVirtualMachineProperties object itself. + */ + public SqlVirtualMachineProperties withServerConfigurationsManagementSettings( + ServerConfigurationsManagementSettings serverConfigurationsManagementSettings) { + this.serverConfigurationsManagementSettings = serverConfigurationsManagementSettings; + return this; + } + + /** + * Get the storageConfigurationSettings property: Storage Configuration Settings. + * + * @return the storageConfigurationSettings value. + */ + public StorageConfigurationSettings storageConfigurationSettings() { + return this.storageConfigurationSettings; + } + + /** + * Set the storageConfigurationSettings property: Storage Configuration Settings. + * + * @param storageConfigurationSettings the storageConfigurationSettings value to set. + * @return the SqlVirtualMachineProperties object itself. + */ + public SqlVirtualMachineProperties withStorageConfigurationSettings( + StorageConfigurationSettings storageConfigurationSettings) { + this.storageConfigurationSettings = storageConfigurationSettings; + return this; + } + + /** + * Get the assessmentSettings property: Assessment Settings. + * + * @return the assessmentSettings value. + */ + public AssessmentSettings assessmentSettings() { + return this.assessmentSettings; + } + + /** + * Set the assessmentSettings property: Assessment Settings. + * + * @param assessmentSettings the assessmentSettings value to set. + * @return the SqlVirtualMachineProperties object itself. + */ + public SqlVirtualMachineProperties withAssessmentSettings(AssessmentSettings assessmentSettings) { + this.assessmentSettings = assessmentSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (wsfcDomainCredentials() != null) { + wsfcDomainCredentials().validate(); + } + if (autoPatchingSettings() != null) { + autoPatchingSettings().validate(); + } + if (autoBackupSettings() != null) { + autoBackupSettings().validate(); + } + if (keyVaultCredentialSettings() != null) { + keyVaultCredentialSettings().validate(); + } + if (serverConfigurationsManagementSettings() != null) { + serverConfigurationsManagementSettings().validate(); + } + if (storageConfigurationSettings() != null) { + storageConfigurationSettings().validate(); + } + if (assessmentSettings() != null) { + assessmentSettings().validate(); + } + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/AvailabilityGroupListenerImpl.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/AvailabilityGroupListenerImpl.java index 0ad6e07df792..d531bd7e371e 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/AvailabilityGroupListenerImpl.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/AvailabilityGroupListenerImpl.java @@ -4,9 +4,10 @@ package com.azure.resourcemanager.sqlvirtualmachine.implementation; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; -import com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager; import com.azure.resourcemanager.sqlvirtualmachine.fluent.models.AvailabilityGroupListenerInner; +import com.azure.resourcemanager.sqlvirtualmachine.models.AgConfiguration; import com.azure.resourcemanager.sqlvirtualmachine.models.AvailabilityGroupListener; import com.azure.resourcemanager.sqlvirtualmachine.models.LoadBalancerConfiguration; import java.util.Collections; @@ -16,7 +17,7 @@ public final class AvailabilityGroupListenerImpl implements AvailabilityGroupListener, AvailabilityGroupListener.Definition, AvailabilityGroupListener.Update { private AvailabilityGroupListenerInner innerObject; - private final SqlVirtualMachineManager serviceManager; + private final com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager; public String id() { return this.innerModel().id(); @@ -30,6 +31,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String provisioningState() { return this.innerModel().provisioningState(); } @@ -55,11 +60,15 @@ public Integer port() { return this.innerModel().port(); } + public AgConfiguration availabilityGroupConfiguration() { + return this.innerModel().availabilityGroupConfiguration(); + } + public AvailabilityGroupListenerInner innerModel() { return this.innerObject; } - private SqlVirtualMachineManager manager() { + private com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager() { return this.serviceManager; } @@ -104,7 +113,8 @@ public AvailabilityGroupListener create(Context context) { return this; } - AvailabilityGroupListenerImpl(String name, SqlVirtualMachineManager serviceManager) { + AvailabilityGroupListenerImpl( + String name, com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager) { this.innerObject = new AvailabilityGroupListenerInner(); this.serviceManager = serviceManager; this.availabilityGroupListenerName = name; @@ -142,7 +152,9 @@ public AvailabilityGroupListener apply(Context context) { return this; } - AvailabilityGroupListenerImpl(AvailabilityGroupListenerInner innerObject, SqlVirtualMachineManager serviceManager) { + AvailabilityGroupListenerImpl( + AvailabilityGroupListenerInner innerObject, + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); @@ -151,22 +163,29 @@ public AvailabilityGroupListener apply(Context context) { } public AvailabilityGroupListener refresh() { + String localExpand = null; this.innerObject = serviceManager .serviceClient() .getAvailabilityGroupListeners() .getWithResponse( - resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, Context.NONE) + resourceGroupName, + sqlVirtualMachineGroupName, + availabilityGroupListenerName, + localExpand, + Context.NONE) .getValue(); return this; } public AvailabilityGroupListener refresh(Context context) { + String localExpand = null; this.innerObject = serviceManager .serviceClient() .getAvailabilityGroupListeners() - .getWithResponse(resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, context) + .getWithResponse( + resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, localExpand, context) .getValue(); return this; } @@ -192,4 +211,10 @@ public AvailabilityGroupListenerImpl withPort(Integer port) { this.innerModel().withPort(port); return this; } + + public AvailabilityGroupListenerImpl withAvailabilityGroupConfiguration( + AgConfiguration availabilityGroupConfiguration) { + this.innerModel().withAvailabilityGroupConfiguration(availabilityGroupConfiguration); + return this; + } } diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/AvailabilityGroupListenersClientImpl.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/AvailabilityGroupListenersClientImpl.java index 905d777e051d..e6e36ddc54f5 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/AvailabilityGroupListenersClientImpl.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/AvailabilityGroupListenersClientImpl.java @@ -81,6 +81,7 @@ Mono> get( @PathParam("resourceGroupName") String resourceGroupName, @PathParam("sqlVirtualMachineGroupName") String sqlVirtualMachineGroupName, @PathParam("availabilityGroupListenerName") String availabilityGroupListenerName, + @QueryParam("$expand") String expand, @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, @@ -153,14 +154,18 @@ Mono> listByGroupNext( * the Azure Resource Manager API or the portal. * @param sqlVirtualMachineGroupName Name of the SQL virtual machine group. * @param availabilityGroupListenerName Name of the availability group listener. + * @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 an availability group listener. + * @return an availability group listener along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync( - String resourceGroupName, String sqlVirtualMachineGroupName, String availabilityGroupListenerName) { + String resourceGroupName, + String sqlVirtualMachineGroupName, + String availabilityGroupListenerName, + String expand) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -199,11 +204,12 @@ private Mono> getWithResponseAsync( resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, + expand, this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -213,17 +219,19 @@ private Mono> getWithResponseAsync( * the Azure Resource Manager API or the portal. * @param sqlVirtualMachineGroupName Name of the SQL virtual machine group. * @param availabilityGroupListenerName Name of the availability group listener. + * @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 an availability group listener. + * @return an availability group listener along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync( String resourceGroupName, String sqlVirtualMachineGroupName, String availabilityGroupListenerName, + String expand, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -261,6 +269,7 @@ private Mono> getWithResponseAsync( resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, + expand, this.client.getSubscriptionId(), this.client.getApiVersion(), accept, @@ -274,15 +283,48 @@ private Mono> getWithResponseAsync( * the Azure Resource Manager API or the portal. * @param sqlVirtualMachineGroupName Name of the SQL virtual machine group. * @param availabilityGroupListenerName Name of the availability group listener. + * @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 an availability group listener. + * @return an availability group listener on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String sqlVirtualMachineGroupName, + String availabilityGroupListenerName, + String expand) { + return getWithResponseAsync( + resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an availability group listener. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineGroupName Name of the SQL virtual machine group. + * @param availabilityGroupListenerName Name of the availability group listener. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an availability group listener on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono getAsync( String resourceGroupName, String sqlVirtualMachineGroupName, String availabilityGroupListenerName) { - return getWithResponseAsync(resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName) + final String expand = null; + return getWithResponseAsync( + resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, expand) .flatMap( (Response res) -> { if (res.getValue() != null) { @@ -308,7 +350,8 @@ private Mono getAsync( @ServiceMethod(returns = ReturnType.SINGLE) public AvailabilityGroupListenerInner get( String resourceGroupName, String sqlVirtualMachineGroupName, String availabilityGroupListenerName) { - return getAsync(resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName).block(); + final String expand = null; + return getAsync(resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, expand).block(); } /** @@ -318,20 +361,22 @@ public AvailabilityGroupListenerInner get( * the Azure Resource Manager API or the portal. * @param sqlVirtualMachineGroupName Name of the SQL virtual machine group. * @param availabilityGroupListenerName Name of the availability group listener. + * @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 an availability group listener. + * @return an availability group listener along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse( String resourceGroupName, String sqlVirtualMachineGroupName, String availabilityGroupListenerName, + String expand, Context context) { return getWithResponseAsync( - resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, context) + resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, expand, context) .block(); } @@ -346,7 +391,8 @@ public Response getWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL Server availability group listener. + * @return a SQL Server availability group listener along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createOrUpdateWithResponseAsync( @@ -402,7 +448,7 @@ private Mono>> createOrUpdateWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -417,7 +463,8 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL Server availability group listener. + * @return a SQL Server availability group listener along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createOrUpdateWithResponseAsync( @@ -485,9 +532,9 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL Server availability group listener. + * @return the {@link PollerFlux} for polling of a SQL Server availability group listener. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, AvailabilityGroupListenerInner> beginCreateOrUpdateAsync( String resourceGroupName, @@ -504,7 +551,7 @@ private Mono>> createOrUpdateWithResponseAsync( this.client.getHttpPipeline(), AvailabilityGroupListenerInner.class, AvailabilityGroupListenerInner.class, - Context.NONE); + this.client.getContext()); } /** @@ -519,9 +566,9 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL Server availability group listener. + * @return the {@link PollerFlux} for polling of a SQL Server availability group listener. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, AvailabilityGroupListenerInner> beginCreateOrUpdateAsync( String resourceGroupName, @@ -554,9 +601,9 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL Server availability group listener. + * @return the {@link SyncPoller} for polling of a SQL Server availability group listener. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, AvailabilityGroupListenerInner> beginCreateOrUpdate( String resourceGroupName, String sqlVirtualMachineGroupName, @@ -579,9 +626,9 @@ public SyncPoller, AvailabilityGroupL * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL Server availability group listener. + * @return the {@link SyncPoller} for polling of a SQL Server availability group listener. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, AvailabilityGroupListenerInner> beginCreateOrUpdate( String resourceGroupName, String sqlVirtualMachineGroupName, @@ -604,7 +651,7 @@ public SyncPoller, AvailabilityGroupL * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL Server availability group listener. + * @return a SQL Server availability group listener on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync( @@ -630,7 +677,7 @@ private Mono createOrUpdateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL Server availability group listener. + * @return a SQL Server availability group listener on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync( @@ -705,7 +752,7 @@ public AvailabilityGroupListenerInner createOrUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync( @@ -750,7 +797,7 @@ private Mono>> deleteWithResponseAsync( this.client.getSubscriptionId(), this.client.getApiVersion(), context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -764,7 +811,7 @@ private Mono>> deleteWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync( @@ -822,16 +869,17 @@ private Mono>> deleteWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( String resourceGroupName, String sqlVirtualMachineGroupName, String availabilityGroupListenerName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName); return this .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); } /** @@ -845,9 +893,9 @@ private PollerFlux, Void> beginDeleteAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( String resourceGroupName, String sqlVirtualMachineGroupName, @@ -872,9 +920,9 @@ private PollerFlux, Void> beginDeleteAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( String resourceGroupName, String sqlVirtualMachineGroupName, String availabilityGroupListenerName) { return beginDeleteAsync(resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName) @@ -892,9 +940,9 @@ public SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( String resourceGroupName, String sqlVirtualMachineGroupName, @@ -914,7 +962,7 @@ public SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync( @@ -935,7 +983,7 @@ private Mono deleteAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync( @@ -995,7 +1043,8 @@ public void 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 list of availability group listeners. + * @return a list of availability group listeners along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByGroupSinglePageAsync( @@ -1044,7 +1093,7 @@ private Mono> listByGroupSinglePag res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1057,7 +1106,8 @@ private Mono> listByGroupSinglePag * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of availability group listeners. + * @return a list of availability group listeners along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByGroupSinglePageAsync( @@ -1115,7 +1165,7 @@ private Mono> listByGroupSinglePag * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of availability group listeners. + * @return a list of availability group listeners as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByGroupAsync( @@ -1135,7 +1185,7 @@ private PagedFlux listByGroupAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of availability group listeners. + * @return a list of availability group listeners as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByGroupAsync( @@ -1154,7 +1204,7 @@ private PagedFlux listByGroupAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of availability group listeners. + * @return a list of availability group listeners as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByGroup( @@ -1172,7 +1222,7 @@ public PagedIterable listByGroup( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of availability group listeners. + * @return a list of availability group listeners as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByGroup( @@ -1187,7 +1237,8 @@ public PagedIterable listByGroup( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of availability group listeners. + * @return a list of availability group listeners along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByGroupNextSinglePageAsync(String nextLink) { @@ -1212,7 +1263,7 @@ private Mono> listByGroupNextSingl res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1223,7 +1274,8 @@ private Mono> listByGroupNextSingl * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of availability group listeners. + * @return a list of availability group listeners along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByGroupNextSinglePageAsync( diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/AvailabilityGroupListenersImpl.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/AvailabilityGroupListenersImpl.java index a048f12a5d90..e5e356e32b5b 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/AvailabilityGroupListenersImpl.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/AvailabilityGroupListenersImpl.java @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager; import com.azure.resourcemanager.sqlvirtualmachine.fluent.AvailabilityGroupListenersClient; import com.azure.resourcemanager.sqlvirtualmachine.fluent.models.AvailabilityGroupListenerInner; import com.azure.resourcemanager.sqlvirtualmachine.models.AvailabilityGroupListener; @@ -21,10 +20,11 @@ public final class AvailabilityGroupListenersImpl implements AvailabilityGroupLi private final AvailabilityGroupListenersClient innerClient; - private final SqlVirtualMachineManager serviceManager; + private final com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager; public AvailabilityGroupListenersImpl( - AvailabilityGroupListenersClient innerClient, SqlVirtualMachineManager serviceManager) { + AvailabilityGroupListenersClient innerClient, + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -44,11 +44,13 @@ public Response getWithResponse( String resourceGroupName, String sqlVirtualMachineGroupName, String availabilityGroupListenerName, + String expand, Context context) { Response inner = this .serviceClient() - .getWithResponse(resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, context); + .getWithResponse( + resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, expand, context); if (inner != null) { return new SimpleResponse<>( inner.getRequest(), @@ -79,14 +81,14 @@ public PagedIterable listByGroup( String resourceGroupName, String sqlVirtualMachineGroupName) { PagedIterable inner = this.serviceClient().listByGroup(resourceGroupName, sqlVirtualMachineGroupName); - return inner.mapPage(inner1 -> new AvailabilityGroupListenerImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new AvailabilityGroupListenerImpl(inner1, this.manager())); } public PagedIterable listByGroup( String resourceGroupName, String sqlVirtualMachineGroupName, Context context) { PagedIterable inner = this.serviceClient().listByGroup(resourceGroupName, sqlVirtualMachineGroupName, context); - return inner.mapPage(inner1 -> new AvailabilityGroupListenerImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new AvailabilityGroupListenerImpl(inner1, this.manager())); } public AvailabilityGroupListener getById(String id) { @@ -118,12 +120,14 @@ public AvailabilityGroupListener getById(String id) { "The resource ID '%s' is not valid. Missing path segment 'availabilityGroupListeners'.", id))); } + String localExpand = null; return this - .getWithResponse(resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, Context.NONE) + .getWithResponse( + resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, localExpand, Context.NONE) .getValue(); } - public Response getByIdWithResponse(String id, Context context) { + public Response getByIdWithResponse(String id, String expand, Context context) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw logger @@ -153,7 +157,8 @@ public Response getByIdWithResponse(String id, Contex id))); } return this - .getWithResponse(resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, context); + .getWithResponse( + resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, expand, context); } public void deleteById(String id) { @@ -224,7 +229,7 @@ private AvailabilityGroupListenersClient serviceClient() { return this.innerClient; } - private SqlVirtualMachineManager manager() { + private com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager() { return this.serviceManager; } diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/OperationImpl.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/OperationImpl.java index b07b432f02d0..76e21d080079 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/OperationImpl.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/OperationImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.sqlvirtualmachine.implementation; -import com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager; import com.azure.resourcemanager.sqlvirtualmachine.fluent.models.OperationInner; import com.azure.resourcemanager.sqlvirtualmachine.models.Operation; import com.azure.resourcemanager.sqlvirtualmachine.models.OperationDisplay; @@ -15,9 +14,11 @@ public final class OperationImpl implements Operation { private OperationInner innerObject; - private final SqlVirtualMachineManager serviceManager; + private final com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager; - OperationImpl(OperationInner innerObject, SqlVirtualMachineManager serviceManager) { + OperationImpl( + OperationInner innerObject, + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -47,7 +48,7 @@ public OperationInner innerModel() { return this.innerObject; } - private SqlVirtualMachineManager manager() { + private com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager() { return this.serviceManager; } } diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/OperationsClientImpl.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/OperationsClientImpl.java index 654073a4c460..c1ca667f2fab 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/OperationsClientImpl.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/OperationsClientImpl.java @@ -81,11 +81,12 @@ Mono> listNext( } /** - * Lists all of the available SQL Rest API operations. + * Lists all of the available SQL Virtual Machine 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. + * @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() { @@ -108,17 +109,18 @@ private Mono> listSinglePageAsync() { res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Lists all of the available SQL Rest API operations. + * Lists all of the available SQL Virtual Machine 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. + * @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) { @@ -144,11 +146,11 @@ private Mono> listSinglePageAsync(Context context) } /** - * Lists all of the available SQL Rest API operations. + * Lists all of the available SQL Virtual Machine 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. + * @return result of the request to list SQL operations as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync() { @@ -156,13 +158,13 @@ private PagedFlux listAsync() { } /** - * Lists all of the available SQL Rest API operations. + * Lists all of the available SQL Virtual Machine 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. + * @return result of the request to list SQL operations as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { @@ -171,11 +173,11 @@ private PagedFlux listAsync(Context context) { } /** - * Lists all of the available SQL Rest API operations. + * Lists all of the available SQL Virtual Machine 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. + * @return result of the request to list SQL operations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { @@ -183,13 +185,13 @@ public PagedIterable list() { } /** - * Lists all of the available SQL Rest API operations. + * Lists all of the available SQL Virtual Machine 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. + * @return result of the request to list SQL operations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { @@ -203,7 +205,8 @@ public PagedIterable list(Context context) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @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) { @@ -228,7 +231,7 @@ private Mono> listNextSinglePageAsync(String nextL res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -239,7 +242,8 @@ private Mono> listNextSinglePageAsync(String nextL * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @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) { diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/OperationsImpl.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/OperationsImpl.java index 47d07859be46..ced421e7130e 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/OperationsImpl.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/OperationsImpl.java @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager; import com.azure.resourcemanager.sqlvirtualmachine.fluent.OperationsClient; import com.azure.resourcemanager.sqlvirtualmachine.fluent.models.OperationInner; import com.azure.resourcemanager.sqlvirtualmachine.models.Operation; @@ -19,28 +18,30 @@ public final class OperationsImpl implements Operations { private final OperationsClient innerClient; - private final SqlVirtualMachineManager serviceManager; + private final com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager; - public OperationsImpl(OperationsClient innerClient, SqlVirtualMachineManager serviceManager) { + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return inner.mapPage(inner1 -> new OperationImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return inner.mapPage(inner1 -> new OperationImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); } private OperationsClient serviceClient() { return this.innerClient; } - private SqlVirtualMachineManager manager() { + private com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager() { return this.serviceManager; } } diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineGroupImpl.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineGroupImpl.java index bd8fddd82db4..3ac75bfb76ea 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineGroupImpl.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineGroupImpl.java @@ -5,8 +5,8 @@ package com.azure.resourcemanager.sqlvirtualmachine.implementation; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; -import com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager; import com.azure.resourcemanager.sqlvirtualmachine.fluent.models.SqlVirtualMachineGroupInner; import com.azure.resourcemanager.sqlvirtualmachine.models.ClusterConfiguration; import com.azure.resourcemanager.sqlvirtualmachine.models.ClusterManagerType; @@ -22,7 +22,7 @@ public final class SqlVirtualMachineGroupImpl implements SqlVirtualMachineGroup, SqlVirtualMachineGroup.Definition, SqlVirtualMachineGroup.Update { private SqlVirtualMachineGroupInner innerObject; - private final SqlVirtualMachineManager serviceManager; + private final com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager; public String id() { return this.innerModel().id(); @@ -49,6 +49,10 @@ public Map tags() { } } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String provisioningState() { return this.innerModel().provisioningState(); } @@ -89,7 +93,7 @@ public SqlVirtualMachineGroupInner innerModel() { return this.innerObject; } - private SqlVirtualMachineManager manager() { + private com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager() { return this.serviceManager; } @@ -122,7 +126,8 @@ public SqlVirtualMachineGroup create(Context context) { return this; } - SqlVirtualMachineGroupImpl(String name, SqlVirtualMachineManager serviceManager) { + SqlVirtualMachineGroupImpl( + String name, com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager) { this.innerObject = new SqlVirtualMachineGroupInner(); this.serviceManager = serviceManager; this.sqlVirtualMachineGroupName = name; @@ -151,7 +156,9 @@ public SqlVirtualMachineGroup apply(Context context) { return this; } - SqlVirtualMachineGroupImpl(SqlVirtualMachineGroupInner innerObject, SqlVirtualMachineManager serviceManager) { + SqlVirtualMachineGroupImpl( + SqlVirtualMachineGroupInner innerObject, + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineGroupsClientImpl.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineGroupsClientImpl.java index 59c50f5b5b9a..cee813883adc 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineGroupsClientImpl.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineGroupsClientImpl.java @@ -186,7 +186,7 @@ Mono> listNext( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getByResourceGroupWithResponseAsync( @@ -226,7 +226,7 @@ private Mono> getByResourceGroupWithRespon this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -239,7 +239,7 @@ private Mono> getByResourceGroupWithRespon * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getByResourceGroupWithResponseAsync( @@ -288,7 +288,7 @@ private Mono> getByResourceGroupWithRespon * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono getByResourceGroupAsync( @@ -330,7 +330,7 @@ public SqlVirtualMachineGroupInner getByResourceGroup(String resourceGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getByResourceGroupWithResponse( @@ -348,7 +348,7 @@ public Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createOrUpdateWithResponseAsync( @@ -394,7 +394,7 @@ private Mono>> createOrUpdateWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -408,7 +408,7 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createOrUpdateWithResponseAsync( @@ -467,9 +467,9 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return the {@link PollerFlux} for polling of a SQL virtual machine group. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, SqlVirtualMachineGroupInner> beginCreateOrUpdateAsync( String resourceGroupName, String sqlVirtualMachineGroupName, SqlVirtualMachineGroupInner parameters) { Mono>> mono = @@ -481,7 +481,7 @@ private PollerFlux, SqlVirtualMachineGro this.client.getHttpPipeline(), SqlVirtualMachineGroupInner.class, SqlVirtualMachineGroupInner.class, - Context.NONE); + this.client.getContext()); } /** @@ -495,9 +495,9 @@ private PollerFlux, SqlVirtualMachineGro * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return the {@link PollerFlux} for polling of a SQL virtual machine group. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, SqlVirtualMachineGroupInner> beginCreateOrUpdateAsync( String resourceGroupName, String sqlVirtualMachineGroupName, @@ -526,9 +526,9 @@ private PollerFlux, SqlVirtualMachineGro * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return the {@link SyncPoller} for polling of a SQL virtual machine group. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, SqlVirtualMachineGroupInner> beginCreateOrUpdate( String resourceGroupName, String sqlVirtualMachineGroupName, SqlVirtualMachineGroupInner parameters) { return beginCreateOrUpdateAsync(resourceGroupName, sqlVirtualMachineGroupName, parameters).getSyncPoller(); @@ -545,9 +545,9 @@ public SyncPoller, SqlVirtualMachineGrou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return the {@link SyncPoller} for polling of a SQL virtual machine group. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, SqlVirtualMachineGroupInner> beginCreateOrUpdate( String resourceGroupName, String sqlVirtualMachineGroupName, @@ -567,7 +567,7 @@ public SyncPoller, SqlVirtualMachineGrou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync( @@ -588,7 +588,7 @@ private Mono createOrUpdateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync( @@ -650,7 +650,7 @@ public SqlVirtualMachineGroupInner createOrUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync( @@ -688,7 +688,7 @@ private Mono>> deleteWithResponseAsync( this.client.getSubscriptionId(), this.client.getApiVersion(), context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -701,7 +701,7 @@ private Mono>> deleteWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync( @@ -748,15 +748,16 @@ private Mono>> deleteWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( String resourceGroupName, String sqlVirtualMachineGroupName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, sqlVirtualMachineGroupName); return this .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); } /** @@ -769,9 +770,9 @@ private PollerFlux, Void> beginDeleteAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( String resourceGroupName, String sqlVirtualMachineGroupName, Context context) { context = this.client.mergeContext(context); @@ -791,9 +792,9 @@ private PollerFlux, Void> beginDeleteAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlVirtualMachineGroupName) { return beginDeleteAsync(resourceGroupName, sqlVirtualMachineGroupName).getSyncPoller(); } @@ -808,9 +809,9 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( String resourceGroupName, String sqlVirtualMachineGroupName, Context context) { return beginDeleteAsync(resourceGroupName, sqlVirtualMachineGroupName, context).getSyncPoller(); @@ -825,7 +826,7 @@ public SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String sqlVirtualMachineGroupName) { @@ -844,7 +845,7 @@ private Mono deleteAsync(String resourceGroupName, String sqlVirtualMachin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String sqlVirtualMachineGroupName, Context context) { @@ -894,7 +895,7 @@ public void delete(String resourceGroupName, String sqlVirtualMachineGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> updateWithResponseAsync( @@ -940,7 +941,7 @@ private Mono>> updateWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -954,7 +955,7 @@ private Mono>> updateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> updateWithResponseAsync( @@ -1013,9 +1014,9 @@ private Mono>> updateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return the {@link PollerFlux} for polling of a SQL virtual machine group. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, SqlVirtualMachineGroupInner> beginUpdateAsync( String resourceGroupName, String sqlVirtualMachineGroupName, SqlVirtualMachineGroupUpdate parameters) { Mono>> mono = @@ -1027,7 +1028,7 @@ private PollerFlux, SqlVirtualMachineGro this.client.getHttpPipeline(), SqlVirtualMachineGroupInner.class, SqlVirtualMachineGroupInner.class, - Context.NONE); + this.client.getContext()); } /** @@ -1041,9 +1042,9 @@ private PollerFlux, SqlVirtualMachineGro * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return the {@link PollerFlux} for polling of a SQL virtual machine group. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, SqlVirtualMachineGroupInner> beginUpdateAsync( String resourceGroupName, String sqlVirtualMachineGroupName, @@ -1072,9 +1073,9 @@ private PollerFlux, SqlVirtualMachineGro * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return the {@link SyncPoller} for polling of a SQL virtual machine group. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, SqlVirtualMachineGroupInner> beginUpdate( String resourceGroupName, String sqlVirtualMachineGroupName, SqlVirtualMachineGroupUpdate parameters) { return beginUpdateAsync(resourceGroupName, sqlVirtualMachineGroupName, parameters).getSyncPoller(); @@ -1091,9 +1092,9 @@ public SyncPoller, SqlVirtualMachineGrou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return the {@link SyncPoller} for polling of a SQL virtual machine group. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, SqlVirtualMachineGroupInner> beginUpdate( String resourceGroupName, String sqlVirtualMachineGroupName, @@ -1112,7 +1113,7 @@ public SyncPoller, SqlVirtualMachineGrou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync( @@ -1133,7 +1134,7 @@ private Mono updateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync( @@ -1194,7 +1195,8 @@ public SqlVirtualMachineGroupInner update( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a resource group. + * @return all SQL virtual machine groups in a resource group along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupSinglePageAsync( @@ -1236,7 +1238,7 @@ private Mono> listByResourceGroupSing res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1248,7 +1250,8 @@ private Mono> listByResourceGroupSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a resource group. + * @return all SQL virtual machine groups in a resource group along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupSinglePageAsync( @@ -1298,7 +1301,7 @@ private Mono> listByResourceGroupSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a resource group. + * @return all SQL virtual machine groups in a resource group as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName) { @@ -1316,7 +1319,7 @@ private PagedFlux listByResourceGroupAsync(String r * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a resource group. + * @return all SQL virtual machine groups in a resource group as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { @@ -1333,7 +1336,7 @@ private PagedFlux listByResourceGroupAsync(String r * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a resource group. + * @return all SQL virtual machine groups in a resource group as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName) { @@ -1349,7 +1352,7 @@ public PagedIterable listByResourceGroup(String res * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a resource group. + * @return all SQL virtual machine groups in a resource group as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { @@ -1361,7 +1364,8 @@ public PagedIterable listByResourceGroup(String res * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a subscription. + * @return all SQL virtual machine groups in a subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync() { @@ -1397,7 +1401,7 @@ private Mono> listSinglePageAsync() { res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1407,7 +1411,8 @@ private Mono> listSinglePageAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a subscription. + * @return all SQL virtual machine groups in a subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(Context context) { @@ -1448,7 +1453,7 @@ private Mono> listSinglePageAsync(Con * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a subscription. + * @return all SQL virtual machine groups in a subscription as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync() { @@ -1462,7 +1467,7 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a subscription. + * @return all SQL virtual machine groups in a subscription as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { @@ -1475,7 +1480,7 @@ private PagedFlux listAsync(Context context) { * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a subscription. + * @return all SQL virtual machine groups in a subscription as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { @@ -1489,7 +1494,7 @@ public PagedIterable list() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a subscription. + * @return all SQL virtual machine groups in a subscription as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { @@ -1503,7 +1508,8 @@ public PagedIterable list(Context context) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SQL virtual machine groups. + * @return a list of SQL virtual machine groups along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { @@ -1529,7 +1535,7 @@ private Mono> listByResourceGroupNext res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1540,7 +1546,8 @@ private Mono> listByResourceGroupNext * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SQL virtual machine groups. + * @return a list of SQL virtual machine groups along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupNextSinglePageAsync( @@ -1576,7 +1583,8 @@ private Mono> listByResourceGroupNext * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SQL virtual machine groups. + * @return a list of SQL virtual machine groups along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink) { @@ -1601,7 +1609,7 @@ private Mono> listNextSinglePageAsync res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1612,7 +1620,8 @@ private Mono> listNextSinglePageAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SQL virtual machine groups. + * @return a list of SQL virtual machine groups along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink, Context context) { diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineGroupsImpl.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineGroupsImpl.java index 0c821e5e441c..a8fe079458c6 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineGroupsImpl.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineGroupsImpl.java @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager; import com.azure.resourcemanager.sqlvirtualmachine.fluent.SqlVirtualMachineGroupsClient; import com.azure.resourcemanager.sqlvirtualmachine.fluent.models.SqlVirtualMachineGroupInner; import com.azure.resourcemanager.sqlvirtualmachine.models.SqlVirtualMachineGroup; @@ -21,10 +20,11 @@ public final class SqlVirtualMachineGroupsImpl implements SqlVirtualMachineGroup private final SqlVirtualMachineGroupsClient innerClient; - private final SqlVirtualMachineManager serviceManager; + private final com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager; public SqlVirtualMachineGroupsImpl( - SqlVirtualMachineGroupsClient innerClient, SqlVirtualMachineManager serviceManager) { + SqlVirtualMachineGroupsClient innerClient, + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -64,23 +64,23 @@ public void delete(String resourceGroupName, String sqlVirtualMachineGroupName, public PagedIterable listByResourceGroup(String resourceGroupName) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return inner.mapPage(inner1 -> new SqlVirtualMachineGroupImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new SqlVirtualMachineGroupImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return inner.mapPage(inner1 -> new SqlVirtualMachineGroupImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new SqlVirtualMachineGroupImpl(inner1, this.manager())); } public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return inner.mapPage(inner1 -> new SqlVirtualMachineGroupImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new SqlVirtualMachineGroupImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return inner.mapPage(inner1 -> new SqlVirtualMachineGroupImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new SqlVirtualMachineGroupImpl(inner1, this.manager())); } public SqlVirtualMachineGroup getById(String id) { @@ -177,7 +177,7 @@ private SqlVirtualMachineGroupsClient serviceClient() { return this.innerClient; } - private SqlVirtualMachineManager manager() { + private com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager() { return this.serviceManager; } diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineImpl.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineImpl.java index 2b1ec596215c..cf033a8ba051 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineImpl.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineImpl.java @@ -5,9 +5,10 @@ package com.azure.resourcemanager.sqlvirtualmachine.implementation; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; -import com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager; import com.azure.resourcemanager.sqlvirtualmachine.fluent.models.SqlVirtualMachineInner; +import com.azure.resourcemanager.sqlvirtualmachine.models.AssessmentSettings; import com.azure.resourcemanager.sqlvirtualmachine.models.AutoBackupSettings; import com.azure.resourcemanager.sqlvirtualmachine.models.AutoPatchingSettings; import com.azure.resourcemanager.sqlvirtualmachine.models.KeyVaultCredentialSettings; @@ -27,7 +28,7 @@ public final class SqlVirtualMachineImpl implements SqlVirtualMachine, SqlVirtualMachine.Definition, SqlVirtualMachine.Update { private SqlVirtualMachineInner innerObject; - private final SqlVirtualMachineManager serviceManager; + private final com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager; public String id() { return this.innerModel().id(); @@ -58,6 +59,10 @@ public ResourceIdentity identity() { return this.innerModel().identity(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String virtualMachineResourceId() { return this.innerModel().virtualMachineResourceId(); } @@ -110,6 +115,10 @@ public StorageConfigurationSettings storageConfigurationSettings() { return this.innerModel().storageConfigurationSettings(); } + public AssessmentSettings assessmentSettings() { + return this.innerModel().assessmentSettings(); + } + public Region region() { return Region.fromName(this.regionName()); } @@ -122,7 +131,7 @@ public SqlVirtualMachineInner innerModel() { return this.innerObject; } - private SqlVirtualMachineManager manager() { + private com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager() { return this.serviceManager; } @@ -155,7 +164,8 @@ public SqlVirtualMachine create(Context context) { return this; } - SqlVirtualMachineImpl(String name, SqlVirtualMachineManager serviceManager) { + SqlVirtualMachineImpl( + String name, com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager) { this.innerObject = new SqlVirtualMachineInner(); this.serviceManager = serviceManager; this.sqlVirtualMachineName = name; @@ -184,7 +194,9 @@ public SqlVirtualMachine apply(Context context) { return this; } - SqlVirtualMachineImpl(SqlVirtualMachineInner innerObject, SqlVirtualMachineManager serviceManager) { + SqlVirtualMachineImpl( + SqlVirtualMachineInner innerObject, + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); @@ -213,6 +225,22 @@ public SqlVirtualMachine refresh(Context context) { return this; } + public void redeploy() { + serviceManager.sqlVirtualMachines().redeploy(resourceGroupName, sqlVirtualMachineName); + } + + public void redeploy(Context context) { + serviceManager.sqlVirtualMachines().redeploy(resourceGroupName, sqlVirtualMachineName, context); + } + + public void startAssessment() { + serviceManager.sqlVirtualMachines().startAssessment(resourceGroupName, sqlVirtualMachineName); + } + + public void startAssessment(Context context) { + serviceManager.sqlVirtualMachines().startAssessment(resourceGroupName, sqlVirtualMachineName, context); + } + public SqlVirtualMachineImpl withRegion(Region location) { this.innerModel().withLocation(location.toString()); return this; @@ -263,11 +291,6 @@ public SqlVirtualMachineImpl withSqlImageSku(SqlImageSku sqlImageSku) { return this; } - public SqlVirtualMachineImpl withSqlVirtualMachineGroupResourceId(String sqlVirtualMachineGroupResourceId) { - this.innerModel().withSqlVirtualMachineGroupResourceId(sqlVirtualMachineGroupResourceId); - return this; - } - public SqlVirtualMachineImpl withWsfcDomainCredentials(WsfcDomainCredentials wsfcDomainCredentials) { this.innerModel().withWsfcDomainCredentials(wsfcDomainCredentials); return this; @@ -300,6 +323,11 @@ public SqlVirtualMachineImpl withStorageConfigurationSettings( return this; } + public SqlVirtualMachineImpl withAssessmentSettings(AssessmentSettings assessmentSettings) { + this.innerModel().withAssessmentSettings(assessmentSettings); + return this; + } + private boolean isInCreateMode() { return this.innerModel().id() == null; } diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineManagementClientImpl.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineManagementClientImpl.java index b59727d19bee..b8333e94a48b 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineManagementClientImpl.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachineManagementClientImpl.java @@ -183,7 +183,7 @@ public SqlVirtualMachinesClient getSqlVirtualMachines() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2017-03-01-preview"; + this.apiVersion = "2021-11-01-preview"; this.availabilityGroupListeners = new AvailabilityGroupListenersClientImpl(this); this.operations = new OperationsClientImpl(this); this.sqlVirtualMachineGroups = new SqlVirtualMachineGroupsClientImpl(this); @@ -272,7 +272,7 @@ public Mono getLroFinalResultOrError(AsyncPollResponse, if (managementError.getCode() == null || managementError.getMessage() == null) { managementError = null; } - } catch (IOException ioe) { + } catch (IOException | RuntimeException ioe) { logger.logThrowableAsWarning(ioe); } } @@ -301,7 +301,7 @@ private static final class HttpResponseImpl extends HttpResponse { super(null); this.statusCode = statusCode; this.httpHeaders = httpHeaders; - this.responseBody = responseBody.getBytes(StandardCharsets.UTF_8); + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); } public int getStatusCode() { diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachinesClientImpl.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachinesClientImpl.java index 53aeffcbd1c9..c415ca57398a 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachinesClientImpl.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachinesClientImpl.java @@ -14,6 +14,7 @@ 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; @@ -95,6 +96,20 @@ Mono> list( @HeaderParam("Accept") String accept, Context context); + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine" + + "/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> redeploy( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlVirtualMachineName") String sqlVirtualMachineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine" @@ -171,6 +186,20 @@ Mono> listByResourceGroup( @HeaderParam("Accept") String accept, Context context); + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine" + + "/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> startAssessment( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("sqlVirtualMachineName") String sqlVirtualMachineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) @@ -211,7 +240,8 @@ Mono> listByResourceGroupNext( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 sql virtual machines in a SQL virtual machine group. + * @return the list of sql virtual machines in a SQL virtual machine group along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listBySqlVmGroupSinglePageAsync( @@ -260,7 +290,7 @@ private Mono> listBySqlVmGroupSinglePageAs res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -273,7 +303,8 @@ private Mono> listBySqlVmGroupSinglePageAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 sql virtual machines in a SQL virtual machine group. + * @return the list of sql virtual machines in a SQL virtual machine group along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listBySqlVmGroupSinglePageAsync( @@ -331,7 +362,8 @@ private Mono> listBySqlVmGroupSinglePageAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 sql virtual machines in a SQL virtual machine group. + * @return the list of sql virtual machines in a SQL virtual machine group as paginated response with {@link + * PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listBySqlVmGroupAsync( @@ -351,7 +383,8 @@ private PagedFlux listBySqlVmGroupAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 sql virtual machines in a SQL virtual machine group. + * @return the list of sql virtual machines in a SQL virtual machine group as paginated response with {@link + * PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listBySqlVmGroupAsync( @@ -370,7 +403,8 @@ private PagedFlux listBySqlVmGroupAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 sql virtual machines in a SQL virtual machine group. + * @return the list of sql virtual machines in a SQL virtual machine group as paginated response with {@link + * PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listBySqlVmGroup( @@ -388,7 +422,8 @@ public PagedIterable listBySqlVmGroup( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 sql virtual machines in a SQL virtual machine group. + * @return the list of sql virtual machines in a SQL virtual machine group as paginated response with {@link + * PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listBySqlVmGroup( @@ -401,7 +436,8 @@ public PagedIterable listBySqlVmGroup( * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a subscription. + * @return all SQL virtual machines in a subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync() { @@ -437,7 +473,7 @@ private Mono> listSinglePageAsync() { res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -447,7 +483,8 @@ private Mono> listSinglePageAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a subscription. + * @return all SQL virtual machines in a subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(Context context) { @@ -488,7 +525,7 @@ private Mono> listSinglePageAsync(Context * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a subscription. + * @return all SQL virtual machines in a subscription as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync() { @@ -502,7 +539,7 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a subscription. + * @return all SQL virtual machines in a subscription as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { @@ -515,7 +552,7 @@ private PagedFlux listAsync(Context context) { * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a subscription. + * @return all SQL virtual machines in a subscription as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { @@ -529,13 +566,253 @@ public PagedIterable list() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a subscription. + * @return all SQL virtual machines in a subscription as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { return new PagedIterable<>(listAsync(context)); } + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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>> redeployWithResponseAsync( + String resourceGroupName, String sqlVirtualMachineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlVirtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlVirtualMachineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .redeploy( + this.client.getEndpoint(), + resourceGroupName, + sqlVirtualMachineName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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>> redeployWithResponseAsync( + String resourceGroupName, String sqlVirtualMachineName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlVirtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlVirtualMachineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .redeploy( + this.client.getEndpoint(), + resourceGroupName, + sqlVirtualMachineName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + context); + } + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginRedeployAsync( + String resourceGroupName, String sqlVirtualMachineName) { + Mono>> mono = redeployWithResponseAsync(resourceGroupName, sqlVirtualMachineName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginRedeployAsync( + String resourceGroupName, String sqlVirtualMachineName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + redeployWithResponseAsync(resourceGroupName, sqlVirtualMachineName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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> beginRedeploy(String resourceGroupName, String sqlVirtualMachineName) { + return beginRedeployAsync(resourceGroupName, sqlVirtualMachineName).getSyncPoller(); + } + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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> beginRedeploy( + String resourceGroupName, String sqlVirtualMachineName, Context context) { + return beginRedeployAsync(resourceGroupName, sqlVirtualMachineName, context).getSyncPoller(); + } + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 redeployAsync(String resourceGroupName, String sqlVirtualMachineName) { + return beginRedeployAsync(resourceGroupName, sqlVirtualMachineName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 redeployAsync(String resourceGroupName, String sqlVirtualMachineName, Context context) { + return beginRedeployAsync(resourceGroupName, sqlVirtualMachineName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void redeploy(String resourceGroupName, String sqlVirtualMachineName) { + redeployAsync(resourceGroupName, sqlVirtualMachineName).block(); + } + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void redeploy(String resourceGroupName, String sqlVirtualMachineName, Context context) { + redeployAsync(resourceGroupName, sqlVirtualMachineName, context).block(); + } + /** * Gets a SQL virtual machine. * @@ -546,7 +823,7 @@ public PagedIterable list(Context context) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getByResourceGroupWithResponseAsync( @@ -585,7 +862,7 @@ private Mono> getByResourceGroupWithResponseAsy this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -599,7 +876,7 @@ private Mono> getByResourceGroupWithResponseAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getByResourceGroupWithResponseAsync( @@ -648,7 +925,7 @@ private Mono> getByResourceGroupWithResponseAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono getByResourceGroupAsync( @@ -673,7 +950,7 @@ private Mono getByResourceGroupAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono getByResourceGroupAsync( @@ -718,7 +995,7 @@ public SqlVirtualMachineInner getByResourceGroup(String resourceGroupName, Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getByResourceGroupWithResponse( @@ -736,7 +1013,7 @@ public Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createOrUpdateWithResponseAsync( @@ -780,7 +1057,7 @@ private Mono>> createOrUpdateWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -794,7 +1071,7 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createOrUpdateWithResponseAsync( @@ -848,9 +1125,9 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return the {@link PollerFlux} for polling of a SQL virtual machine. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, SqlVirtualMachineInner> beginCreateOrUpdateAsync( String resourceGroupName, String sqlVirtualMachineName, SqlVirtualMachineInner parameters) { Mono>> mono = @@ -862,7 +1139,7 @@ private PollerFlux, SqlVirtualMachineInner> b this.client.getHttpPipeline(), SqlVirtualMachineInner.class, SqlVirtualMachineInner.class, - Context.NONE); + this.client.getContext()); } /** @@ -876,9 +1153,9 @@ private PollerFlux, SqlVirtualMachineInner> b * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return the {@link PollerFlux} for polling of a SQL virtual machine. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, SqlVirtualMachineInner> beginCreateOrUpdateAsync( String resourceGroupName, String sqlVirtualMachineName, SqlVirtualMachineInner parameters, Context context) { context = this.client.mergeContext(context); @@ -904,9 +1181,9 @@ private PollerFlux, SqlVirtualMachineInner> b * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return the {@link SyncPoller} for polling of a SQL virtual machine. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, SqlVirtualMachineInner> beginCreateOrUpdate( String resourceGroupName, String sqlVirtualMachineName, SqlVirtualMachineInner parameters) { return beginCreateOrUpdateAsync(resourceGroupName, sqlVirtualMachineName, parameters).getSyncPoller(); @@ -923,9 +1200,9 @@ public SyncPoller, SqlVirtualMachineInner> be * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return the {@link SyncPoller} for polling of a SQL virtual machine. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, SqlVirtualMachineInner> beginCreateOrUpdate( String resourceGroupName, String sqlVirtualMachineName, SqlVirtualMachineInner parameters, Context context) { return beginCreateOrUpdateAsync(resourceGroupName, sqlVirtualMachineName, parameters, context).getSyncPoller(); @@ -941,7 +1218,7 @@ public SyncPoller, SqlVirtualMachineInner> be * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync( @@ -962,7 +1239,7 @@ private Mono createOrUpdateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync( @@ -1018,7 +1295,7 @@ public SqlVirtualMachineInner createOrUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync( @@ -1054,7 +1331,7 @@ private Mono>> deleteWithResponseAsync( this.client.getSubscriptionId(), this.client.getApiVersion(), context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1067,7 +1344,7 @@ private Mono>> deleteWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync( @@ -1112,15 +1389,16 @@ private Mono>> deleteWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( String resourceGroupName, String sqlVirtualMachineName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, sqlVirtualMachineName); return this .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); } /** @@ -1133,9 +1411,9 @@ private PollerFlux, Void> beginDeleteAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( String resourceGroupName, String sqlVirtualMachineName, Context context) { context = this.client.mergeContext(context); @@ -1155,9 +1433,9 @@ private PollerFlux, Void> beginDeleteAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String sqlVirtualMachineName) { return beginDeleteAsync(resourceGroupName, sqlVirtualMachineName).getSyncPoller(); } @@ -1172,9 +1450,9 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( String resourceGroupName, String sqlVirtualMachineName, Context context) { return beginDeleteAsync(resourceGroupName, sqlVirtualMachineName, context).getSyncPoller(); @@ -1189,7 +1467,7 @@ public SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String sqlVirtualMachineName) { @@ -1208,7 +1486,7 @@ private Mono deleteAsync(String resourceGroupName, String sqlVirtualMachin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String sqlVirtualMachineName, Context context) { @@ -1258,7 +1536,7 @@ public void delete(String resourceGroupName, String sqlVirtualMachineName, Conte * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> updateWithResponseAsync( @@ -1302,7 +1580,7 @@ private Mono>> updateWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1316,7 +1594,7 @@ private Mono>> updateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> updateWithResponseAsync( @@ -1370,9 +1648,9 @@ private Mono>> updateWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return the {@link PollerFlux} for polling of a SQL virtual machine. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, SqlVirtualMachineInner> beginUpdateAsync( String resourceGroupName, String sqlVirtualMachineName, SqlVirtualMachineUpdate parameters) { Mono>> mono = @@ -1384,7 +1662,7 @@ private PollerFlux, SqlVirtualMachineInner> b this.client.getHttpPipeline(), SqlVirtualMachineInner.class, SqlVirtualMachineInner.class, - Context.NONE); + this.client.getContext()); } /** @@ -1398,9 +1676,9 @@ private PollerFlux, SqlVirtualMachineInner> b * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return the {@link PollerFlux} for polling of a SQL virtual machine. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, SqlVirtualMachineInner> beginUpdateAsync( String resourceGroupName, String sqlVirtualMachineName, SqlVirtualMachineUpdate parameters, Context context) { context = this.client.mergeContext(context); @@ -1426,9 +1704,9 @@ private PollerFlux, SqlVirtualMachineInner> b * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return the {@link SyncPoller} for polling of a SQL virtual machine. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, SqlVirtualMachineInner> beginUpdate( String resourceGroupName, String sqlVirtualMachineName, SqlVirtualMachineUpdate parameters) { return beginUpdateAsync(resourceGroupName, sqlVirtualMachineName, parameters).getSyncPoller(); @@ -1445,9 +1723,9 @@ public SyncPoller, SqlVirtualMachineInner> be * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return the {@link SyncPoller} for polling of a SQL virtual machine. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, SqlVirtualMachineInner> beginUpdate( String resourceGroupName, String sqlVirtualMachineName, SqlVirtualMachineUpdate parameters, Context context) { return beginUpdateAsync(resourceGroupName, sqlVirtualMachineName, parameters, context).getSyncPoller(); @@ -1463,7 +1741,7 @@ public SyncPoller, SqlVirtualMachineInner> be * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync( @@ -1484,7 +1762,7 @@ private Mono updateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync( @@ -1539,7 +1817,8 @@ public SqlVirtualMachineInner update( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a resource group. + * @return all SQL virtual machines in a resource group along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { @@ -1580,7 +1859,7 @@ private Mono> listByResourceGroupSinglePag res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1592,7 +1871,8 @@ private Mono> listByResourceGroupSinglePag * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a resource group. + * @return all SQL virtual machines in a resource group along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupSinglePageAsync( @@ -1642,7 +1922,7 @@ private Mono> listByResourceGroupSinglePag * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a resource group. + * @return all SQL virtual machines in a resource group as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName) { @@ -1660,7 +1940,7 @@ private PagedFlux listByResourceGroupAsync(String resour * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a resource group. + * @return all SQL virtual machines in a resource group as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { @@ -1677,7 +1957,7 @@ private PagedFlux listByResourceGroupAsync(String resour * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a resource group. + * @return all SQL virtual machines in a resource group as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName) { @@ -1693,13 +1973,255 @@ public PagedIterable listByResourceGroup(String 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 all SQL virtual machines in a resource group. + * @return all SQL virtual machines 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)); } + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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>> startAssessmentWithResponseAsync( + String resourceGroupName, String sqlVirtualMachineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlVirtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlVirtualMachineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .startAssessment( + this.client.getEndpoint(), + resourceGroupName, + sqlVirtualMachineName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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>> startAssessmentWithResponseAsync( + String resourceGroupName, String sqlVirtualMachineName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (sqlVirtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter sqlVirtualMachineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .startAssessment( + this.client.getEndpoint(), + resourceGroupName, + sqlVirtualMachineName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + context); + } + + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginStartAssessmentAsync( + String resourceGroupName, String sqlVirtualMachineName) { + Mono>> mono = + startAssessmentWithResponseAsync(resourceGroupName, sqlVirtualMachineName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginStartAssessmentAsync( + String resourceGroupName, String sqlVirtualMachineName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + startAssessmentWithResponseAsync(resourceGroupName, sqlVirtualMachineName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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> beginStartAssessment( + String resourceGroupName, String sqlVirtualMachineName) { + return beginStartAssessmentAsync(resourceGroupName, sqlVirtualMachineName).getSyncPoller(); + } + + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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> beginStartAssessment( + String resourceGroupName, String sqlVirtualMachineName, Context context) { + return beginStartAssessmentAsync(resourceGroupName, sqlVirtualMachineName, context).getSyncPoller(); + } + + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 startAssessmentAsync(String resourceGroupName, String sqlVirtualMachineName) { + return beginStartAssessmentAsync(resourceGroupName, sqlVirtualMachineName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 startAssessmentAsync(String resourceGroupName, String sqlVirtualMachineName, Context context) { + return beginStartAssessmentAsync(resourceGroupName, sqlVirtualMachineName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void startAssessment(String resourceGroupName, String sqlVirtualMachineName) { + startAssessmentAsync(resourceGroupName, sqlVirtualMachineName).block(); + } + + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void startAssessment(String resourceGroupName, String sqlVirtualMachineName, Context context) { + startAssessmentAsync(resourceGroupName, sqlVirtualMachineName, context).block(); + } + /** * Get the next page of items. * @@ -1707,7 +2229,7 @@ public PagedIterable listByResourceGroup(String 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 list of SQL virtual machines. + * @return a list of SQL virtual machines along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listBySqlVmGroupNextSinglePageAsync(String nextLink) { @@ -1732,7 +2254,7 @@ private Mono> listBySqlVmGroupNextSinglePa res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1743,7 +2265,7 @@ private Mono> listBySqlVmGroupNextSinglePa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SQL virtual machines. + * @return a list of SQL virtual machines along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listBySqlVmGroupNextSinglePageAsync( @@ -1779,7 +2301,7 @@ private Mono> listBySqlVmGroupNextSinglePa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SQL virtual machines. + * @return a list of SQL virtual machines along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink) { @@ -1804,7 +2326,7 @@ private Mono> listNextSinglePageAsync(Stri res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1815,7 +2337,7 @@ private Mono> listNextSinglePageAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SQL virtual machines. + * @return a list of SQL virtual machines along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink, Context context) { @@ -1850,7 +2372,7 @@ private Mono> listNextSinglePageAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SQL virtual machines. + * @return a list of SQL virtual machines along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { @@ -1876,7 +2398,7 @@ private Mono> listByResourceGroupNextSingl res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1887,7 +2409,7 @@ private Mono> listByResourceGroupNextSingl * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of SQL virtual machines. + * @return a list of SQL virtual machines along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupNextSinglePageAsync( diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachinesImpl.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachinesImpl.java index e6dca143477f..5125e2a7e525 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachinesImpl.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/SqlVirtualMachinesImpl.java @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager; import com.azure.resourcemanager.sqlvirtualmachine.fluent.SqlVirtualMachinesClient; import com.azure.resourcemanager.sqlvirtualmachine.fluent.models.SqlVirtualMachineInner; import com.azure.resourcemanager.sqlvirtualmachine.models.SqlVirtualMachine; @@ -21,9 +20,11 @@ public final class SqlVirtualMachinesImpl implements SqlVirtualMachines { private final SqlVirtualMachinesClient innerClient; - private final SqlVirtualMachineManager serviceManager; + private final com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager; - public SqlVirtualMachinesImpl(SqlVirtualMachinesClient innerClient, SqlVirtualMachineManager serviceManager) { + public SqlVirtualMachinesImpl( + SqlVirtualMachinesClient innerClient, + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -32,24 +33,32 @@ public PagedIterable listBySqlVmGroup( String resourceGroupName, String sqlVirtualMachineGroupName) { PagedIterable inner = this.serviceClient().listBySqlVmGroup(resourceGroupName, sqlVirtualMachineGroupName); - return inner.mapPage(inner1 -> new SqlVirtualMachineImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new SqlVirtualMachineImpl(inner1, this.manager())); } public PagedIterable listBySqlVmGroup( String resourceGroupName, String sqlVirtualMachineGroupName, Context context) { PagedIterable inner = this.serviceClient().listBySqlVmGroup(resourceGroupName, sqlVirtualMachineGroupName, context); - return inner.mapPage(inner1 -> new SqlVirtualMachineImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new SqlVirtualMachineImpl(inner1, this.manager())); } public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return inner.mapPage(inner1 -> new SqlVirtualMachineImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new SqlVirtualMachineImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return inner.mapPage(inner1 -> new SqlVirtualMachineImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new SqlVirtualMachineImpl(inner1, this.manager())); + } + + public void redeploy(String resourceGroupName, String sqlVirtualMachineName) { + this.serviceClient().redeploy(resourceGroupName, sqlVirtualMachineName); + } + + public void redeploy(String resourceGroupName, String sqlVirtualMachineName, Context context) { + this.serviceClient().redeploy(resourceGroupName, sqlVirtualMachineName, context); } public SqlVirtualMachine getByResourceGroup(String resourceGroupName, String sqlVirtualMachineName) { @@ -89,13 +98,21 @@ public void delete(String resourceGroupName, String sqlVirtualMachineName, Conte public PagedIterable listByResourceGroup(String resourceGroupName) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return inner.mapPage(inner1 -> new SqlVirtualMachineImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new SqlVirtualMachineImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return inner.mapPage(inner1 -> new SqlVirtualMachineImpl(inner1, this.manager())); + return Utils.mapPage(inner, inner1 -> new SqlVirtualMachineImpl(inner1, this.manager())); + } + + public void startAssessment(String resourceGroupName, String sqlVirtualMachineName) { + this.serviceClient().startAssessment(resourceGroupName, sqlVirtualMachineName); + } + + public void startAssessment(String resourceGroupName, String sqlVirtualMachineName, Context context) { + this.serviceClient().startAssessment(resourceGroupName, sqlVirtualMachineName, context); } public SqlVirtualMachine getById(String id) { @@ -189,7 +206,7 @@ private SqlVirtualMachinesClient serviceClient() { return this.innerClient; } - private SqlVirtualMachineManager manager() { + private com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager() { return this.serviceManager; } diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/Utils.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/Utils.java index 97d1f2cd7bc1..f85a94e65360 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/Utils.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/implementation/Utils.java @@ -4,12 +4,20 @@ package com.azure.resourcemanager.sqlvirtualmachine.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) { @@ -64,4 +72,133 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri } 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/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AgConfiguration.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AgConfiguration.java new file mode 100644 index 000000000000..2457a21efe5f --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AgConfiguration.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.sqlvirtualmachine.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Availability group configuration. */ +@Immutable +public final class AgConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AgConfiguration.class); + + /* + * Replica configurations. + */ + @JsonProperty(value = "replicas", access = JsonProperty.Access.WRITE_ONLY) + private List replicas; + + /** + * Get the replicas property: Replica configurations. + * + * @return the replicas value. + */ + public List replicas() { + return this.replicas; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (replicas() != null) { + replicas().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AgReplica.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AgReplica.java new file mode 100644 index 000000000000..8a82a3fd634a --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AgReplica.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.sqlvirtualmachine.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Availability group replica configuration. */ +@Fluent +public final class AgReplica { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AgReplica.class); + + /* + * Sql VirtualMachine Instance Id. + */ + @JsonProperty(value = "sqlVirtualMachineInstanceId") + private String sqlVirtualMachineInstanceId; + + /* + * Replica Role in availability group. + */ + @JsonProperty(value = "role") + private Role role; + + /* + * Replica commit mode in availability group. + */ + @JsonProperty(value = "commit") + private Commit commit; + + /* + * Replica failover mode in availability group. + */ + @JsonProperty(value = "failover") + private Failover failover; + + /* + * Replica readable secondary mode in availability group. + */ + @JsonProperty(value = "readableSecondary") + private ReadableSecondary readableSecondary; + + /** + * Get the sqlVirtualMachineInstanceId property: Sql VirtualMachine Instance Id. + * + * @return the sqlVirtualMachineInstanceId value. + */ + public String sqlVirtualMachineInstanceId() { + return this.sqlVirtualMachineInstanceId; + } + + /** + * Set the sqlVirtualMachineInstanceId property: Sql VirtualMachine Instance Id. + * + * @param sqlVirtualMachineInstanceId the sqlVirtualMachineInstanceId value to set. + * @return the AgReplica object itself. + */ + public AgReplica withSqlVirtualMachineInstanceId(String sqlVirtualMachineInstanceId) { + this.sqlVirtualMachineInstanceId = sqlVirtualMachineInstanceId; + return this; + } + + /** + * Get the role property: Replica Role in availability group. + * + * @return the role value. + */ + public Role role() { + return this.role; + } + + /** + * Set the role property: Replica Role in availability group. + * + * @param role the role value to set. + * @return the AgReplica object itself. + */ + public AgReplica withRole(Role role) { + this.role = role; + return this; + } + + /** + * Get the commit property: Replica commit mode in availability group. + * + * @return the commit value. + */ + public Commit commit() { + return this.commit; + } + + /** + * Set the commit property: Replica commit mode in availability group. + * + * @param commit the commit value to set. + * @return the AgReplica object itself. + */ + public AgReplica withCommit(Commit commit) { + this.commit = commit; + return this; + } + + /** + * Get the failover property: Replica failover mode in availability group. + * + * @return the failover value. + */ + public Failover failover() { + return this.failover; + } + + /** + * Set the failover property: Replica failover mode in availability group. + * + * @param failover the failover value to set. + * @return the AgReplica object itself. + */ + public AgReplica withFailover(Failover failover) { + this.failover = failover; + return this; + } + + /** + * Get the readableSecondary property: Replica readable secondary mode in availability group. + * + * @return the readableSecondary value. + */ + public ReadableSecondary readableSecondary() { + return this.readableSecondary; + } + + /** + * Set the readableSecondary property: Replica readable secondary mode in availability group. + * + * @param readableSecondary the readableSecondary value to set. + * @return the AgReplica object itself. + */ + public AgReplica withReadableSecondary(ReadableSecondary readableSecondary) { + this.readableSecondary = readableSecondary; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AssessmentSettings.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AssessmentSettings.java new file mode 100644 index 000000000000..ea25d5753c3b --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AssessmentSettings.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.sqlvirtualmachine.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Configure assessment for databases in your SQL virtual machine. */ +@Fluent +public final class AssessmentSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AssessmentSettings.class); + + /* + * Enable or disable assessment feature on SQL virtual machine. + */ + @JsonProperty(value = "enable") + private Boolean enable; + + /* + * Run assessment immediately on SQL virtual machine. + */ + @JsonProperty(value = "runImmediately") + private Boolean runImmediately; + + /* + * Schedule for Assessment. + */ + @JsonProperty(value = "schedule") + private Schedule schedule; + + /** + * Get the enable property: Enable or disable assessment feature on SQL virtual machine. + * + * @return the enable value. + */ + public Boolean enable() { + return this.enable; + } + + /** + * Set the enable property: Enable or disable assessment feature on SQL virtual machine. + * + * @param enable the enable value to set. + * @return the AssessmentSettings object itself. + */ + public AssessmentSettings withEnable(Boolean enable) { + this.enable = enable; + return this; + } + + /** + * Get the runImmediately property: Run assessment immediately on SQL virtual machine. + * + * @return the runImmediately value. + */ + public Boolean runImmediately() { + return this.runImmediately; + } + + /** + * Set the runImmediately property: Run assessment immediately on SQL virtual machine. + * + * @param runImmediately the runImmediately value to set. + * @return the AssessmentSettings object itself. + */ + public AssessmentSettings withRunImmediately(Boolean runImmediately) { + this.runImmediately = runImmediately; + return this; + } + + /** + * Get the schedule property: Schedule for Assessment. + * + * @return the schedule value. + */ + public Schedule schedule() { + return this.schedule; + } + + /** + * Set the schedule property: Schedule for Assessment. + * + * @param schedule the schedule value to set. + * @return the AssessmentSettings object itself. + */ + public AssessmentSettings withSchedule(Schedule 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/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AutoBackupSettings.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AutoBackupSettings.java index c06fe261c250..4f3341d6938e 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AutoBackupSettings.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AutoBackupSettings.java @@ -8,6 +8,7 @@ import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; /** Configure backups for databases in your SQL virtual machine. */ @Fluent @@ -27,7 +28,7 @@ public final class AutoBackupSettings { private Boolean enableEncryption; /* - * Retention period of backup: 1-30 days. + * Retention period of backup: 1-90 days. */ @JsonProperty(value = "retentionPeriod") private Integer retentionPeriod; @@ -38,6 +39,12 @@ public final class AutoBackupSettings { @JsonProperty(value = "storageAccountUrl") private String storageAccountUrl; + /* + * Storage container name where backup will be taken to. + */ + @JsonProperty(value = "storageContainerName") + private String storageContainerName; + /* * Storage account key where backup will be taken to. */ @@ -69,6 +76,13 @@ public final class AutoBackupSettings { @JsonProperty(value = "fullBackupFrequency") private FullBackupFrequencyType fullBackupFrequency; + /* + * Days of the week for the backups when FullBackupFrequency is set to + * Weekly. + */ + @JsonProperty(value = "daysOfWeek") + private List daysOfWeek; + /* * Start time of a given day during which full backups can take place. 0-23 * hours. @@ -130,7 +144,7 @@ public AutoBackupSettings withEnableEncryption(Boolean enableEncryption) { } /** - * Get the retentionPeriod property: Retention period of backup: 1-30 days. + * Get the retentionPeriod property: Retention period of backup: 1-90 days. * * @return the retentionPeriod value. */ @@ -139,7 +153,7 @@ public Integer retentionPeriod() { } /** - * Set the retentionPeriod property: Retention period of backup: 1-30 days. + * Set the retentionPeriod property: Retention period of backup: 1-90 days. * * @param retentionPeriod the retentionPeriod value to set. * @return the AutoBackupSettings object itself. @@ -169,6 +183,26 @@ public AutoBackupSettings withStorageAccountUrl(String storageAccountUrl) { return this; } + /** + * Get the storageContainerName property: Storage container name where backup will be taken to. + * + * @return the storageContainerName value. + */ + public String storageContainerName() { + return this.storageContainerName; + } + + /** + * Set the storageContainerName property: Storage container name where backup will be taken to. + * + * @param storageContainerName the storageContainerName value to set. + * @return the AutoBackupSettings object itself. + */ + public AutoBackupSettings withStorageContainerName(String storageContainerName) { + this.storageContainerName = storageContainerName; + return this; + } + /** * Get the storageAccessKey property: Storage account key where backup will be taken to. * @@ -271,6 +305,26 @@ public AutoBackupSettings withFullBackupFrequency(FullBackupFrequencyType fullBa return this; } + /** + * Get the daysOfWeek property: Days of the week for the backups when FullBackupFrequency is set to Weekly. + * + * @return the daysOfWeek value. + */ + public List daysOfWeek() { + return this.daysOfWeek; + } + + /** + * Set the daysOfWeek property: Days of the week for the backups when FullBackupFrequency is set to Weekly. + * + * @param daysOfWeek the daysOfWeek value to set. + * @return the AutoBackupSettings object itself. + */ + public AutoBackupSettings withDaysOfWeek(List daysOfWeek) { + this.daysOfWeek = daysOfWeek; + return this; + } + /** * Get the fullBackupStartTime property: Start time of a given day during which full backups can take place. 0-23 * hours. diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AvailabilityGroupListener.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AvailabilityGroupListener.java index e365be413e28..d49cf34a4c31 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AvailabilityGroupListener.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AvailabilityGroupListener.java @@ -4,6 +4,7 @@ package com.azure.resourcemanager.sqlvirtualmachine.models; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.sqlvirtualmachine.fluent.models.AvailabilityGroupListenerInner; import java.util.List; @@ -31,6 +32,13 @@ public interface AvailabilityGroupListener { */ String type(); + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the provisioningState property: Provisioning state to track the async operation status. * @@ -68,6 +76,13 @@ public interface AvailabilityGroupListener { */ Integer port(); + /** + * Gets the availabilityGroupConfiguration property: Availability Group configuration. + * + * @return the availabilityGroupConfiguration value. + */ + AgConfiguration availabilityGroupConfiguration(); + /** * Gets the inner com.azure.resourcemanager.sqlvirtualmachine.fluent.models.AvailabilityGroupListenerInner object. * @@ -104,7 +119,8 @@ interface WithCreate extends DefinitionStages.WithAvailabilityGroupName, DefinitionStages.WithLoadBalancerConfigurations, DefinitionStages.WithCreateDefaultAvailabilityGroupIfNotExist, - DefinitionStages.WithPort { + DefinitionStages.WithPort, + DefinitionStages.WithAvailabilityGroupConfiguration { /** * Executes the create request. * @@ -166,6 +182,16 @@ interface WithPort { */ WithCreate withPort(Integer port); } + /** The stage of the AvailabilityGroupListener definition allowing to specify availabilityGroupConfiguration. */ + interface WithAvailabilityGroupConfiguration { + /** + * Specifies the availabilityGroupConfiguration property: Availability Group configuration.. + * + * @param availabilityGroupConfiguration Availability Group configuration. + * @return the next definition stage. + */ + WithCreate withAvailabilityGroupConfiguration(AgConfiguration availabilityGroupConfiguration); + } } /** * Begins update for the AvailabilityGroupListener resource. @@ -179,7 +205,8 @@ interface Update extends UpdateStages.WithAvailabilityGroupName, UpdateStages.WithLoadBalancerConfigurations, UpdateStages.WithCreateDefaultAvailabilityGroupIfNotExist, - UpdateStages.WithPort { + UpdateStages.WithPort, + UpdateStages.WithAvailabilityGroupConfiguration { /** * Executes the update request. * @@ -243,6 +270,16 @@ interface WithPort { */ Update withPort(Integer port); } + /** The stage of the AvailabilityGroupListener update allowing to specify availabilityGroupConfiguration. */ + interface WithAvailabilityGroupConfiguration { + /** + * Specifies the availabilityGroupConfiguration property: Availability Group configuration.. + * + * @param availabilityGroupConfiguration Availability Group configuration. + * @return the next definition stage. + */ + Update withAvailabilityGroupConfiguration(AgConfiguration availabilityGroupConfiguration); + } } /** * Refreshes the resource to sync with Azure. diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AvailabilityGroupListeners.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AvailabilityGroupListeners.java index 627ccdefec62..c379aa3c7714 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AvailabilityGroupListeners.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/AvailabilityGroupListeners.java @@ -32,16 +32,18 @@ AvailabilityGroupListener get( * the Azure Resource Manager API or the portal. * @param sqlVirtualMachineGroupName Name of the SQL virtual machine group. * @param availabilityGroupListenerName Name of the availability group listener. + * @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 an availability group listener. + * @return an availability group listener along with {@link Response}. */ Response getWithResponse( String resourceGroupName, String sqlVirtualMachineGroupName, String availabilityGroupListenerName, + String expand, Context context); /** @@ -84,7 +86,7 @@ void 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 a list of availability group listeners. + * @return a list of availability group listeners as paginated response with {@link PagedIterable}. */ PagedIterable listByGroup(String resourceGroupName, String sqlVirtualMachineGroupName); @@ -98,7 +100,7 @@ void 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 a list of availability group listeners. + * @return a list of availability group listeners as paginated response with {@link PagedIterable}. */ PagedIterable listByGroup( String resourceGroupName, String sqlVirtualMachineGroupName, Context context); @@ -110,7 +112,7 @@ PagedIterable listByGroup( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an availability group listener. + * @return an availability group listener along with {@link Response}. */ AvailabilityGroupListener getById(String id); @@ -118,13 +120,14 @@ PagedIterable listByGroup( * Gets an availability group listener. * * @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 an availability group listener. + * @return an availability group listener along with {@link Response}. */ - Response getByIdWithResponse(String id, Context context); + Response getByIdWithResponse(String id, String expand, Context context); /** * Deletes an availability group listener. diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Commit.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Commit.java new file mode 100644 index 000000000000..a71c7c303bce --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Commit.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.sqlvirtualmachine.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Commit. */ +public final class Commit extends ExpandableStringEnum { + /** Static value SYNCHRONOUS_COMMIT for Commit. */ + public static final Commit SYNCHRONOUS_COMMIT = fromString("SYNCHRONOUS_COMMIT"); + + /** Static value ASYNCHRONOUS_COMMIT for Commit. */ + public static final Commit ASYNCHRONOUS_COMMIT = fromString("ASYNCHRONOUS_COMMIT"); + + /** + * Creates or finds a Commit from its string representation. + * + * @param name a name to look for. + * @return the corresponding Commit. + */ + @JsonCreator + public static Commit fromString(String name) { + return fromString(name, Commit.class); + } + + /** @return known Commit values. */ + public static Collection values() { + return values(Commit.class); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/DaysOfWeek.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/DaysOfWeek.java new file mode 100644 index 000000000000..6332ebd40578 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/DaysOfWeek.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.sqlvirtualmachine.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DaysOfWeek. */ +public final class DaysOfWeek extends ExpandableStringEnum { + /** Static value Monday for DaysOfWeek. */ + public static final DaysOfWeek MONDAY = fromString("Monday"); + + /** Static value Tuesday for DaysOfWeek. */ + public static final DaysOfWeek TUESDAY = fromString("Tuesday"); + + /** Static value Wednesday for DaysOfWeek. */ + public static final DaysOfWeek WEDNESDAY = fromString("Wednesday"); + + /** Static value Thursday for DaysOfWeek. */ + public static final DaysOfWeek THURSDAY = fromString("Thursday"); + + /** Static value Friday for DaysOfWeek. */ + public static final DaysOfWeek FRIDAY = fromString("Friday"); + + /** Static value Saturday for DaysOfWeek. */ + public static final DaysOfWeek SATURDAY = fromString("Saturday"); + + /** Static value Sunday for DaysOfWeek. */ + public static final DaysOfWeek SUNDAY = fromString("Sunday"); + + /** + * Creates or finds a DaysOfWeek from its string representation. + * + * @param name a name to look for. + * @return the corresponding DaysOfWeek. + */ + @JsonCreator + public static DaysOfWeek fromString(String name) { + return fromString(name, DaysOfWeek.class); + } + + /** @return known DaysOfWeek values. */ + public static Collection values() { + return values(DaysOfWeek.class); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Failover.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Failover.java new file mode 100644 index 000000000000..634c1314693f --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Failover.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.sqlvirtualmachine.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Failover. */ +public final class Failover extends ExpandableStringEnum { + /** Static value AUTOMATIC for Failover. */ + public static final Failover AUTOMATIC = fromString("AUTOMATIC"); + + /** Static value MANUAL for Failover. */ + public static final Failover MANUAL = fromString("MANUAL"); + + /** + * Creates or finds a Failover from its string representation. + * + * @param name a name to look for. + * @return the corresponding Failover. + */ + @JsonCreator + public static Failover fromString(String name) { + return fromString(name, Failover.class); + } + + /** @return known Failover values. */ + public static Collection values() { + return values(Failover.class); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/IdentityType.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/IdentityType.java index 6d1b34f88ba4..900b7dc9a6df 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/IdentityType.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/IdentityType.java @@ -10,6 +10,9 @@ /** 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"); diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Operations.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Operations.java index 539994ba2d60..e7ff4d384820 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Operations.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Operations.java @@ -10,22 +10,22 @@ /** Resource collection API of Operations. */ public interface Operations { /** - * Lists all of the available SQL Rest API operations. + * Lists all of the available SQL Virtual Machine 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. + * @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. + * Lists all of the available SQL Virtual Machine 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. + * @return result of the request to list SQL operations as paginated response with {@link PagedIterable}. */ PagedIterable list(Context context); } diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/ReadableSecondary.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/ReadableSecondary.java new file mode 100644 index 000000000000..852c255639a5 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/ReadableSecondary.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.sqlvirtualmachine.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReadableSecondary. */ +public final class ReadableSecondary extends ExpandableStringEnum { + /** Static value NO for ReadableSecondary. */ + public static final ReadableSecondary NO = fromString("NO"); + + /** Static value ALL for ReadableSecondary. */ + public static final ReadableSecondary ALL = fromString("ALL"); + + /** Static value READ_ONLY for ReadableSecondary. */ + public static final ReadableSecondary READ_ONLY = fromString("READ_ONLY"); + + /** + * Creates or finds a ReadableSecondary from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReadableSecondary. + */ + @JsonCreator + public static ReadableSecondary fromString(String name) { + return fromString(name, ReadableSecondary.class); + } + + /** @return known ReadableSecondary values. */ + public static Collection values() { + return values(ReadableSecondary.class); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Role.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Role.java new file mode 100644 index 000000000000..2dced7199d7c --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Role.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.sqlvirtualmachine.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Role. */ +public final class Role extends ExpandableStringEnum { + /** Static value PRIMARY for Role. */ + public static final Role PRIMARY = fromString("PRIMARY"); + + /** Static value SECONDARY for Role. */ + public static final Role SECONDARY = fromString("SECONDARY"); + + /** + * Creates or finds a Role from its string representation. + * + * @param name a name to look for. + * @return the corresponding Role. + */ + @JsonCreator + public static Role fromString(String name) { + return fromString(name, Role.class); + } + + /** @return known Role values. */ + public static Collection values() { + return values(Role.class); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Schedule.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Schedule.java new file mode 100644 index 000000000000..752dcb8914d0 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/Schedule.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.sqlvirtualmachine.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Schedule model. */ +@Fluent +public final class Schedule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Schedule.class); + + /* + * Enable or disable assessment schedule on SQL virtual machine. + */ + @JsonProperty(value = "enable") + private Boolean enable; + + /* + * Number of weeks to schedule between 2 assessment runs. Takes value from + * 1-6 + */ + @JsonProperty(value = "weeklyInterval") + private Integer weeklyInterval; + + /* + * Occurrence of the DayOfWeek day within a month to schedule assessment. + * Takes values: 1,2,3,4 and -1. Use -1 for last DayOfWeek day of the month + */ + @JsonProperty(value = "monthlyOccurrence") + private Integer monthlyOccurrence; + + /* + * Day of the week to run assessment. + */ + @JsonProperty(value = "dayOfWeek") + private DayOfWeek dayOfWeek; + + /* + * Time of the day in HH:mm format. Eg. 17:30 + */ + @JsonProperty(value = "startTime") + private String startTime; + + /** + * Get the enable property: Enable or disable assessment schedule on SQL virtual machine. + * + * @return the enable value. + */ + public Boolean enable() { + return this.enable; + } + + /** + * Set the enable property: Enable or disable assessment schedule on SQL virtual machine. + * + * @param enable the enable value to set. + * @return the Schedule object itself. + */ + public Schedule withEnable(Boolean enable) { + this.enable = enable; + return this; + } + + /** + * Get the weeklyInterval property: Number of weeks to schedule between 2 assessment runs. Takes value from 1-6. + * + * @return the weeklyInterval value. + */ + public Integer weeklyInterval() { + return this.weeklyInterval; + } + + /** + * Set the weeklyInterval property: Number of weeks to schedule between 2 assessment runs. Takes value from 1-6. + * + * @param weeklyInterval the weeklyInterval value to set. + * @return the Schedule object itself. + */ + public Schedule withWeeklyInterval(Integer weeklyInterval) { + this.weeklyInterval = weeklyInterval; + return this; + } + + /** + * Get the monthlyOccurrence property: Occurrence of the DayOfWeek day within a month to schedule assessment. Takes + * values: 1,2,3,4 and -1. Use -1 for last DayOfWeek day of the month. + * + * @return the monthlyOccurrence value. + */ + public Integer monthlyOccurrence() { + return this.monthlyOccurrence; + } + + /** + * Set the monthlyOccurrence property: Occurrence of the DayOfWeek day within a month to schedule assessment. Takes + * values: 1,2,3,4 and -1. Use -1 for last DayOfWeek day of the month. + * + * @param monthlyOccurrence the monthlyOccurrence value to set. + * @return the Schedule object itself. + */ + public Schedule withMonthlyOccurrence(Integer monthlyOccurrence) { + this.monthlyOccurrence = monthlyOccurrence; + return this; + } + + /** + * Get the dayOfWeek property: Day of the week to run assessment. + * + * @return the dayOfWeek value. + */ + public DayOfWeek dayOfWeek() { + return this.dayOfWeek; + } + + /** + * Set the dayOfWeek property: Day of the week to run assessment. + * + * @param dayOfWeek the dayOfWeek value to set. + * @return the Schedule object itself. + */ + public Schedule withDayOfWeek(DayOfWeek dayOfWeek) { + this.dayOfWeek = dayOfWeek; + return this; + } + + /** + * Get the startTime property: Time of the day in HH:mm format. Eg. 17:30. + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Time of the day in HH:mm format. Eg. 17:30. + * + * @param startTime the startTime value to set. + * @return the Schedule object itself. + */ + public Schedule withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/ServerConfigurationsManagementSettings.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/ServerConfigurationsManagementSettings.java index 1a0ba9dafcbb..9f99425aa4be 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/ServerConfigurationsManagementSettings.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/ServerConfigurationsManagementSettings.java @@ -38,6 +38,12 @@ public final class ServerConfigurationsManagementSettings { @JsonProperty(value = "additionalFeaturesServerConfigurations") private AdditionalFeaturesServerConfigurations additionalFeaturesServerConfigurations; + /* + * SQL Instance settings. + */ + @JsonProperty(value = "sqlInstanceSettings") + private SqlInstanceSettings sqlInstanceSettings; + /** * Get the sqlConnectivityUpdateSettings property: SQL connectivity type settings. * @@ -122,6 +128,26 @@ public ServerConfigurationsManagementSettings withAdditionalFeaturesServerConfig return this; } + /** + * Get the sqlInstanceSettings property: SQL Instance settings. + * + * @return the sqlInstanceSettings value. + */ + public SqlInstanceSettings sqlInstanceSettings() { + return this.sqlInstanceSettings; + } + + /** + * Set the sqlInstanceSettings property: SQL Instance settings. + * + * @param sqlInstanceSettings the sqlInstanceSettings value to set. + * @return the ServerConfigurationsManagementSettings object itself. + */ + public ServerConfigurationsManagementSettings withSqlInstanceSettings(SqlInstanceSettings sqlInstanceSettings) { + this.sqlInstanceSettings = sqlInstanceSettings; + return this; + } + /** * Validates the instance. * @@ -140,5 +166,8 @@ public void validate() { if (additionalFeaturesServerConfigurations() != null) { additionalFeaturesServerConfigurations().validate(); } + if (sqlInstanceSettings() != null) { + sqlInstanceSettings().validate(); + } } } diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlInstanceSettings.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlInstanceSettings.java new file mode 100644 index 000000000000..f315be86eb10 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlInstanceSettings.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.sqlvirtualmachine.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Set the server/instance-level settings for SQL Server. */ +@Fluent +public final class SqlInstanceSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlInstanceSettings.class); + + /* + * SQL Server Collation. + */ + @JsonProperty(value = "collation") + private String collation; + + /* + * SQL Server MAXDOP. + */ + @JsonProperty(value = "maxDop") + private Integer maxDop; + + /* + * SQL Server Optimize for Adhoc workloads. + */ + @JsonProperty(value = "isOptimizeForAdHocWorkloadsEnabled") + private Boolean isOptimizeForAdHocWorkloadsEnabled; + + /* + * SQL Server minimum memory. + */ + @JsonProperty(value = "minServerMemoryMB") + private Integer minServerMemoryMB; + + /* + * SQL Server maximum memory. + */ + @JsonProperty(value = "maxServerMemoryMB") + private Integer maxServerMemoryMB; + + /** + * Get the collation property: SQL Server Collation. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation property: SQL Server Collation. + * + * @param collation the collation value to set. + * @return the SqlInstanceSettings object itself. + */ + public SqlInstanceSettings withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the maxDop property: SQL Server MAXDOP. + * + * @return the maxDop value. + */ + public Integer maxDop() { + return this.maxDop; + } + + /** + * Set the maxDop property: SQL Server MAXDOP. + * + * @param maxDop the maxDop value to set. + * @return the SqlInstanceSettings object itself. + */ + public SqlInstanceSettings withMaxDop(Integer maxDop) { + this.maxDop = maxDop; + return this; + } + + /** + * Get the isOptimizeForAdHocWorkloadsEnabled property: SQL Server Optimize for Adhoc workloads. + * + * @return the isOptimizeForAdHocWorkloadsEnabled value. + */ + public Boolean isOptimizeForAdHocWorkloadsEnabled() { + return this.isOptimizeForAdHocWorkloadsEnabled; + } + + /** + * Set the isOptimizeForAdHocWorkloadsEnabled property: SQL Server Optimize for Adhoc workloads. + * + * @param isOptimizeForAdHocWorkloadsEnabled the isOptimizeForAdHocWorkloadsEnabled value to set. + * @return the SqlInstanceSettings object itself. + */ + public SqlInstanceSettings withIsOptimizeForAdHocWorkloadsEnabled(Boolean isOptimizeForAdHocWorkloadsEnabled) { + this.isOptimizeForAdHocWorkloadsEnabled = isOptimizeForAdHocWorkloadsEnabled; + return this; + } + + /** + * Get the minServerMemoryMB property: SQL Server minimum memory. + * + * @return the minServerMemoryMB value. + */ + public Integer minServerMemoryMB() { + return this.minServerMemoryMB; + } + + /** + * Set the minServerMemoryMB property: SQL Server minimum memory. + * + * @param minServerMemoryMB the minServerMemoryMB value to set. + * @return the SqlInstanceSettings object itself. + */ + public SqlInstanceSettings withMinServerMemoryMB(Integer minServerMemoryMB) { + this.minServerMemoryMB = minServerMemoryMB; + return this; + } + + /** + * Get the maxServerMemoryMB property: SQL Server maximum memory. + * + * @return the maxServerMemoryMB value. + */ + public Integer maxServerMemoryMB() { + return this.maxServerMemoryMB; + } + + /** + * Set the maxServerMemoryMB property: SQL Server maximum memory. + * + * @param maxServerMemoryMB the maxServerMemoryMB value to set. + * @return the SqlInstanceSettings object itself. + */ + public SqlInstanceSettings withMaxServerMemoryMB(Integer maxServerMemoryMB) { + this.maxServerMemoryMB = maxServerMemoryMB; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlTempDbSettings.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlTempDbSettings.java new file mode 100644 index 000000000000..34c50c839abf --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlTempDbSettings.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.sqlvirtualmachine.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The SqlTempDbSettings model. */ +@Fluent +public final class SqlTempDbSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SqlTempDbSettings.class); + + /* + * SQL Server default file size + */ + @JsonProperty(value = "dataFileSize") + private Integer dataFileSize; + + /* + * SQL Server default file autoGrowth size + */ + @JsonProperty(value = "dataGrowth") + private Integer dataGrowth; + + /* + * SQL Server default file size + */ + @JsonProperty(value = "logFileSize") + private Integer logFileSize; + + /* + * SQL Server default file autoGrowth size + */ + @JsonProperty(value = "logGrowth") + private Integer logGrowth; + + /* + * SQL Server default file count + */ + @JsonProperty(value = "dataFileCount") + private Integer dataFileCount; + + /* + * Logical Unit Numbers for the disks. + */ + @JsonProperty(value = "luns") + private List luns; + + /* + * SQL Server default file path + */ + @JsonProperty(value = "defaultFilePath") + private String defaultFilePath; + + /** + * Get the dataFileSize property: SQL Server default file size. + * + * @return the dataFileSize value. + */ + public Integer dataFileSize() { + return this.dataFileSize; + } + + /** + * Set the dataFileSize property: SQL Server default file size. + * + * @param dataFileSize the dataFileSize value to set. + * @return the SqlTempDbSettings object itself. + */ + public SqlTempDbSettings withDataFileSize(Integer dataFileSize) { + this.dataFileSize = dataFileSize; + return this; + } + + /** + * Get the dataGrowth property: SQL Server default file autoGrowth size. + * + * @return the dataGrowth value. + */ + public Integer dataGrowth() { + return this.dataGrowth; + } + + /** + * Set the dataGrowth property: SQL Server default file autoGrowth size. + * + * @param dataGrowth the dataGrowth value to set. + * @return the SqlTempDbSettings object itself. + */ + public SqlTempDbSettings withDataGrowth(Integer dataGrowth) { + this.dataGrowth = dataGrowth; + return this; + } + + /** + * Get the logFileSize property: SQL Server default file size. + * + * @return the logFileSize value. + */ + public Integer logFileSize() { + return this.logFileSize; + } + + /** + * Set the logFileSize property: SQL Server default file size. + * + * @param logFileSize the logFileSize value to set. + * @return the SqlTempDbSettings object itself. + */ + public SqlTempDbSettings withLogFileSize(Integer logFileSize) { + this.logFileSize = logFileSize; + return this; + } + + /** + * Get the logGrowth property: SQL Server default file autoGrowth size. + * + * @return the logGrowth value. + */ + public Integer logGrowth() { + return this.logGrowth; + } + + /** + * Set the logGrowth property: SQL Server default file autoGrowth size. + * + * @param logGrowth the logGrowth value to set. + * @return the SqlTempDbSettings object itself. + */ + public SqlTempDbSettings withLogGrowth(Integer logGrowth) { + this.logGrowth = logGrowth; + return this; + } + + /** + * Get the dataFileCount property: SQL Server default file count. + * + * @return the dataFileCount value. + */ + public Integer dataFileCount() { + return this.dataFileCount; + } + + /** + * Set the dataFileCount property: SQL Server default file count. + * + * @param dataFileCount the dataFileCount value to set. + * @return the SqlTempDbSettings object itself. + */ + public SqlTempDbSettings withDataFileCount(Integer dataFileCount) { + this.dataFileCount = dataFileCount; + return this; + } + + /** + * Get the luns property: Logical Unit Numbers for the disks. + * + * @return the luns value. + */ + public List luns() { + return this.luns; + } + + /** + * Set the luns property: Logical Unit Numbers for the disks. + * + * @param luns the luns value to set. + * @return the SqlTempDbSettings object itself. + */ + public SqlTempDbSettings withLuns(List luns) { + this.luns = luns; + return this; + } + + /** + * Get the defaultFilePath property: SQL Server default file path. + * + * @return the defaultFilePath value. + */ + public String defaultFilePath() { + return this.defaultFilePath; + } + + /** + * Set the defaultFilePath property: SQL Server default file path. + * + * @param defaultFilePath the defaultFilePath value to set. + * @return the SqlTempDbSettings object itself. + */ + public SqlTempDbSettings withDefaultFilePath(String defaultFilePath) { + this.defaultFilePath = defaultFilePath; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachine.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachine.java index 662eb0f42076..f9ae74c3c7bb 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachine.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachine.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.sqlvirtualmachine.models; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.sqlvirtualmachine.fluent.models.SqlVirtualMachineInner; import java.util.Map; @@ -53,6 +54,13 @@ public interface SqlVirtualMachine { */ ResourceIdentity identity(); + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the virtualMachineResourceId property: ARM Resource id of underlying virtual machine created from SQL * marketplace image. @@ -148,6 +156,13 @@ public interface SqlVirtualMachine { */ StorageConfigurationSettings storageConfigurationSettings(); + /** + * Gets the assessmentSettings property: Assessment Settings. + * + * @return the assessmentSettings value. + */ + AssessmentSettings assessmentSettings(); + /** * Gets the region of the resource. * @@ -222,13 +237,13 @@ interface WithCreate DefinitionStages.WithSqlServerLicenseType, DefinitionStages.WithSqlManagement, DefinitionStages.WithSqlImageSku, - DefinitionStages.WithSqlVirtualMachineGroupResourceId, DefinitionStages.WithWsfcDomainCredentials, DefinitionStages.WithAutoPatchingSettings, DefinitionStages.WithAutoBackupSettings, DefinitionStages.WithKeyVaultCredentialSettings, DefinitionStages.WithServerConfigurationsManagementSettings, - DefinitionStages.WithStorageConfigurationSettings { + DefinitionStages.WithStorageConfigurationSettings, + DefinitionStages.WithAssessmentSettings { /** * Executes the create request. * @@ -316,18 +331,6 @@ interface WithSqlImageSku { */ WithCreate withSqlImageSku(SqlImageSku sqlImageSku); } - /** The stage of the SqlVirtualMachine definition allowing to specify sqlVirtualMachineGroupResourceId. */ - interface WithSqlVirtualMachineGroupResourceId { - /** - * Specifies the sqlVirtualMachineGroupResourceId property: ARM resource id of the SQL virtual machine group - * this SQL virtual machine is or will be part of.. - * - * @param sqlVirtualMachineGroupResourceId ARM resource id of the SQL virtual machine group this SQL virtual - * machine is or will be part of. - * @return the next definition stage. - */ - WithCreate withSqlVirtualMachineGroupResourceId(String sqlVirtualMachineGroupResourceId); - } /** The stage of the SqlVirtualMachine definition allowing to specify wsfcDomainCredentials. */ interface WithWsfcDomainCredentials { /** @@ -394,6 +397,16 @@ interface WithStorageConfigurationSettings { */ WithCreate withStorageConfigurationSettings(StorageConfigurationSettings storageConfigurationSettings); } + /** The stage of the SqlVirtualMachine definition allowing to specify assessmentSettings. */ + interface WithAssessmentSettings { + /** + * Specifies the assessmentSettings property: Assessment Settings.. + * + * @param assessmentSettings Assessment Settings. + * @return the next definition stage. + */ + WithCreate withAssessmentSettings(AssessmentSettings assessmentSettings); + } } /** * Begins update for the SqlVirtualMachine resource. @@ -446,4 +459,40 @@ interface WithTags { * @return the refreshed resource. */ SqlVirtualMachine refresh(Context context); + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(); + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(Context context); + + /** + * Starts Assessment on SQL virtual machine. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void startAssessment(); + + /** + * Starts Assessment on SQL virtual machine. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void startAssessment(Context context); } diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineGroup.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineGroup.java index 6f7897fbad12..c96d2605649f 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineGroup.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineGroup.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.sqlvirtualmachine.models; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.sqlvirtualmachine.fluent.models.SqlVirtualMachineGroupInner; import java.util.Map; @@ -46,6 +47,13 @@ public interface SqlVirtualMachineGroup { */ Map tags(); + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the provisioningState property: Provisioning state to track the async operation status. * diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineGroupUpdate.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineGroupUpdate.java index 0dc9fe14d565..47019f3567cb 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineGroupUpdate.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineGroupUpdate.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -19,6 +20,7 @@ public final class SqlVirtualMachineGroupUpdate { * Resource tags. */ @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /** diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineGroups.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineGroups.java index cea0160b60ee..c57691649998 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineGroups.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineGroups.java @@ -33,7 +33,7 @@ public interface SqlVirtualMachineGroups { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group along with {@link Response}. */ Response getByResourceGroupWithResponse( String resourceGroupName, String sqlVirtualMachineGroupName, Context context); @@ -71,7 +71,7 @@ Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a resource group. + * @return all SQL virtual machine groups in a resource group as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName); @@ -84,7 +84,7 @@ Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a resource group. + * @return all SQL virtual machine groups in a resource group as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName, Context context); @@ -93,7 +93,7 @@ Response getByResourceGroupWithResponse( * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a subscription. + * @return all SQL virtual machine groups in a subscription as paginated response with {@link PagedIterable}. */ PagedIterable list(); @@ -104,7 +104,7 @@ Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machine groups in a subscription. + * @return all SQL virtual machine groups in a subscription as paginated response with {@link PagedIterable}. */ PagedIterable list(Context context); @@ -115,7 +115,7 @@ Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group along with {@link Response}. */ SqlVirtualMachineGroup getById(String id); @@ -127,7 +127,7 @@ Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine group. + * @return a SQL virtual machine group along with {@link Response}. */ Response getByIdWithResponse(String id, Context context); diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineUpdate.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineUpdate.java index 6b38f0aeda27..232ee4674c3f 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineUpdate.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachineUpdate.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -19,6 +20,7 @@ public final class SqlVirtualMachineUpdate { * Resource tags. */ @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /** diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachines.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachines.java index 11abc4ac89de..da22c4642a84 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachines.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/SqlVirtualMachines.java @@ -19,7 +19,8 @@ public interface SqlVirtualMachines { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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 sql virtual machines in a SQL virtual machine group. + * @return the list of sql virtual machines in a SQL virtual machine group as paginated response with {@link + * PagedIterable}. */ PagedIterable listBySqlVmGroup(String resourceGroupName, String sqlVirtualMachineGroupName); @@ -33,7 +34,8 @@ public interface SqlVirtualMachines { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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 sql virtual machines in a SQL virtual machine group. + * @return the list of sql virtual machines in a SQL virtual machine group as paginated response with {@link + * PagedIterable}. */ PagedIterable listBySqlVmGroup( String resourceGroupName, String sqlVirtualMachineGroupName, Context context); @@ -43,7 +45,7 @@ PagedIterable listBySqlVmGroup( * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a subscription. + * @return all SQL virtual machines in a subscription as paginated response with {@link PagedIterable}. */ PagedIterable list(); @@ -54,10 +56,35 @@ PagedIterable listBySqlVmGroup( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a subscription. + * @return all SQL virtual machines in a subscription as paginated response with {@link PagedIterable}. */ PagedIterable list(Context context); + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(String resourceGroupName, String sqlVirtualMachineName); + + /** + * Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(String resourceGroupName, String sqlVirtualMachineName, Context context); + /** * Gets a SQL virtual machine. * @@ -82,7 +109,7 @@ PagedIterable listBySqlVmGroup( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine along with {@link Response}. */ Response getByResourceGroupWithResponse( String resourceGroupName, String sqlVirtualMachineName, String expand, Context context); @@ -120,7 +147,7 @@ Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a resource group. + * @return all SQL virtual machines in a resource group as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName); @@ -133,10 +160,35 @@ Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all SQL virtual machines in a resource group. + * @return all SQL virtual machines in a resource group as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName, Context context); + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void startAssessment(String resourceGroupName, String sqlVirtualMachineName); + + /** + * Starts Assessment on SQL virtual machine. + * + * @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from + * the Azure Resource Manager API or the portal. + * @param sqlVirtualMachineName Name of the SQL virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void startAssessment(String resourceGroupName, String sqlVirtualMachineName, Context context); + /** * Gets a SQL virtual machine. * @@ -144,7 +196,7 @@ Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine along with {@link Response}. */ SqlVirtualMachine getById(String id); @@ -157,7 +209,7 @@ Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SQL virtual machine. + * @return a SQL virtual machine along with {@link Response}. */ Response getByIdWithResponse(String id, String expand, Context context); diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/StorageConfigurationSettings.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/StorageConfigurationSettings.java index 58674cdfcfb4..c49a1696e58b 100644 --- a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/StorageConfigurationSettings.java +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/main/java/com/azure/resourcemanager/sqlvirtualmachine/models/StorageConfigurationSettings.java @@ -30,7 +30,13 @@ public final class StorageConfigurationSettings { * SQL Server TempDb Storage Settings. */ @JsonProperty(value = "sqlTempDbSettings") - private SqlStorageSettings sqlTempDbSettings; + private SqlTempDbSettings sqlTempDbSettings; + + /* + * SQL Server SystemDb Storage on DataPool if true. + */ + @JsonProperty(value = "sqlSystemDbOnDataDisk") + private Boolean sqlSystemDbOnDataDisk; /* * Disk configuration to apply to SQL Server. @@ -89,7 +95,7 @@ public StorageConfigurationSettings withSqlLogSettings(SqlStorageSettings sqlLog * * @return the sqlTempDbSettings value. */ - public SqlStorageSettings sqlTempDbSettings() { + public SqlTempDbSettings sqlTempDbSettings() { return this.sqlTempDbSettings; } @@ -99,11 +105,31 @@ public SqlStorageSettings sqlTempDbSettings() { * @param sqlTempDbSettings the sqlTempDbSettings value to set. * @return the StorageConfigurationSettings object itself. */ - public StorageConfigurationSettings withSqlTempDbSettings(SqlStorageSettings sqlTempDbSettings) { + public StorageConfigurationSettings withSqlTempDbSettings(SqlTempDbSettings sqlTempDbSettings) { this.sqlTempDbSettings = sqlTempDbSettings; return this; } + /** + * Get the sqlSystemDbOnDataDisk property: SQL Server SystemDb Storage on DataPool if true. + * + * @return the sqlSystemDbOnDataDisk value. + */ + public Boolean sqlSystemDbOnDataDisk() { + return this.sqlSystemDbOnDataDisk; + } + + /** + * Set the sqlSystemDbOnDataDisk property: SQL Server SystemDb Storage on DataPool if true. + * + * @param sqlSystemDbOnDataDisk the sqlSystemDbOnDataDisk value to set. + * @return the StorageConfigurationSettings object itself. + */ + public StorageConfigurationSettings withSqlSystemDbOnDataDisk(Boolean sqlSystemDbOnDataDisk) { + this.sqlSystemDbOnDataDisk = sqlSystemDbOnDataDisk; + return this; + } + /** * Get the diskConfigurationType property: Disk configuration to apply to SQL Server. * diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/AvailabilityGroupListenersCreateOrUpdateSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/AvailabilityGroupListenersCreateOrUpdateSamples.java new file mode 100644 index 000000000000..ae4023cd6850 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/AvailabilityGroupListenersCreateOrUpdateSamples.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.sqlvirtualmachine.generated; + +import com.azure.resourcemanager.sqlvirtualmachine.models.LoadBalancerConfiguration; +import com.azure.resourcemanager.sqlvirtualmachine.models.PrivateIpAddress; +import java.util.Arrays; + +/** Samples for AvailabilityGroupListeners CreateOrUpdate. */ +public final class AvailabilityGroupListenersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateAvailabilityGroupListener.json + */ + /** + * Sample code: Creates or updates an availability group listener. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void createsOrUpdatesAnAvailabilityGroupListener( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .availabilityGroupListeners() + .define("agl-test") + .withExistingSqlVirtualMachineGroup("testrg", "testvmgroup") + .withAvailabilityGroupName("ag-test") + .withLoadBalancerConfigurations( + Arrays + .asList( + new LoadBalancerConfiguration() + .withPrivateIpAddress( + new PrivateIpAddress() + .withIpAddress("10.1.0.112") + .withSubnetResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default")) + .withLoadBalancerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb-test") + .withProbePort(59983) + .withSqlVirtualMachineInstances( + Arrays + .asList( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm2", + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm3")))) + .withPort(1433) + .create(); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/AvailabilityGroupListenersDeleteSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/AvailabilityGroupListenersDeleteSamples.java new file mode 100644 index 000000000000..f7868881fea7 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/AvailabilityGroupListenersDeleteSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailabilityGroupListeners Delete. */ +public final class AvailabilityGroupListenersDeleteSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/DeleteAvailabilityGroupListener.json + */ + /** + * Sample code: Deletes an availability group listener. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void deletesAnAvailabilityGroupListener( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.availabilityGroupListeners().delete("testrg", "testvmgroup", "agl-test", Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/AvailabilityGroupListenersGetSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/AvailabilityGroupListenersGetSamples.java new file mode 100644 index 000000000000..97859838acae --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/AvailabilityGroupListenersGetSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailabilityGroupListeners Get. */ +public final class AvailabilityGroupListenersGetSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/GetAvailabilityGroupListener.json + */ + /** + * Sample code: Gets an availability group listener. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsAnAvailabilityGroupListener( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.availabilityGroupListeners().getWithResponse("testrg", "testvmgroup", "agl-test", null, Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/AvailabilityGroupListenersListByGroupSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/AvailabilityGroupListenersListByGroupSamples.java new file mode 100644 index 000000000000..66526c41785e --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/AvailabilityGroupListenersListByGroupSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailabilityGroupListeners ListByGroup. */ +public final class AvailabilityGroupListenersListByGroupSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListByGroupAvailabilityGroupListener.json + */ + /** + * Sample code: Lists all availability group listeners in a SQL virtual machine group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void listsAllAvailabilityGroupListenersInASQLVirtualMachineGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.availabilityGroupListeners().listByGroup("testrg", "testvmgroup", Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/OperationsListSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/OperationsListSamples.java new file mode 100644 index 000000000000..e717c37fe20e --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/OperationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListOperation.json + */ + /** + * Sample code: Lists all of the available SQL Virtual Machine Rest API operations. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void listsAllOfTheAvailableSQLVirtualMachineRestAPIOperations( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsCreateOrUpdateSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..ad406fe7d0dc --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsCreateOrUpdateSamples.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.sqlvirtualmachine.generated; + +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlVmGroupImageSku; +import com.azure.resourcemanager.sqlvirtualmachine.models.WsfcDomainProfile; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlVirtualMachineGroups CreateOrUpdate. */ +public final class SqlVirtualMachineGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateSqlVirtualMachineGroup.json + */ + /** + * Sample code: Creates or updates a SQL virtual machine group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void createsOrUpdatesASQLVirtualMachineGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .sqlVirtualMachineGroups() + .define("testvmgroup") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withTags(mapOf("mytag", "myval")) + .withSqlImageOffer("SQL2016-WS2016") + .withSqlImageSku(SqlVmGroupImageSku.ENTERPRISE) + .withWsfcDomainProfile( + new WsfcDomainProfile() + .withDomainFqdn("testdomain.com") + .withOuPath("OU=WSCluster,DC=testdomain,DC=com") + .withClusterBootstrapAccount("testrpadmin") + .withClusterOperatorAccount("testrp@testdomain.com") + .withSqlServiceAccount("sqlservice@testdomain.com") + .withStorageAccountUrl("https://storgact.blob.core.windows.net/") + .withStorageAccountPrimaryKey("")) + .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/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsDeleteSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsDeleteSamples.java new file mode 100644 index 000000000000..020d66afa47a --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsDeleteSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachineGroups Delete. */ +public final class SqlVirtualMachineGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/DeleteSqlVirtualMachineGroup.json + */ + /** + * Sample code: Deletes a SQL virtual machine group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void deletesASQLVirtualMachineGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachineGroups().delete("testrg", "testvmgroup", Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsGetByResourceGroupSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..998c2d9c51a0 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsGetByResourceGroupSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachineGroups GetByResourceGroup. */ +public final class SqlVirtualMachineGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/GetSqlVirtualMachineGroup.json + */ + /** + * Sample code: Gets a SQL virtual machine group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsASQLVirtualMachineGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachineGroups().getByResourceGroupWithResponse("testrg", "testvmgroup", Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsListByResourceGroupSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsListByResourceGroupSamples.java new file mode 100644 index 000000000000..1734486b607a --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsListByResourceGroupSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachineGroups ListByResourceGroup. */ +public final class SqlVirtualMachineGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListByResourceGroupSqlVirtualMachineGroup.json + */ + /** + * Sample code: Gets all SQL virtual machine groups in a resource group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsAllSQLVirtualMachineGroupsInAResourceGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachineGroups().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsListSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsListSamples.java new file mode 100644 index 000000000000..02d051c06255 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsListSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachineGroups List. */ +public final class SqlVirtualMachineGroupsListSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListSubscriptionSqlVirtualMachineGroup.json + */ + /** + * Sample code: Gets all SQL virtual machine groups in a subscription. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsAllSQLVirtualMachineGroupsInASubscription( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachineGroups().list(Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsUpdateSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsUpdateSamples.java new file mode 100644 index 000000000000..04b46d25c435 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachineGroupsUpdateSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlVirtualMachineGroup; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlVirtualMachineGroups Update. */ +public final class SqlVirtualMachineGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/UpdateSqlVirtualMachineGroup.json + */ + /** + * Sample code: Updates a SQL virtual machine group tags. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void updatesASQLVirtualMachineGroupTags( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + SqlVirtualMachineGroup resource = + manager + .sqlVirtualMachineGroups() + .getByResourceGroupWithResponse("testrg", "testvmgroup", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesCreateOrUpdateSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..a749546098b1 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesCreateOrUpdateSamples.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sqlvirtualmachine.generated; + +import com.azure.resourcemanager.sqlvirtualmachine.models.AdditionalFeaturesServerConfigurations; +import com.azure.resourcemanager.sqlvirtualmachine.models.AssessmentSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.AutoBackupSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.AutoPatchingSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.BackupScheduleType; +import com.azure.resourcemanager.sqlvirtualmachine.models.ConnectivityType; +import com.azure.resourcemanager.sqlvirtualmachine.models.DayOfWeek; +import com.azure.resourcemanager.sqlvirtualmachine.models.DaysOfWeek; +import com.azure.resourcemanager.sqlvirtualmachine.models.DiskConfigurationType; +import com.azure.resourcemanager.sqlvirtualmachine.models.FullBackupFrequencyType; +import com.azure.resourcemanager.sqlvirtualmachine.models.KeyVaultCredentialSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.Schedule; +import com.azure.resourcemanager.sqlvirtualmachine.models.ServerConfigurationsManagementSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlConnectivityUpdateSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlImageSku; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlInstanceSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlManagementMode; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlServerLicenseType; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlStorageSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlStorageUpdateSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlTempDbSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlWorkloadType; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlWorkloadTypeUpdateSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.StorageConfigurationSettings; +import com.azure.resourcemanager.sqlvirtualmachine.models.StorageWorkloadType; +import com.azure.resourcemanager.sqlvirtualmachine.models.WsfcDomainCredentials; +import java.util.Arrays; + +/** Samples for SqlVirtualMachines CreateOrUpdate. */ +public final class SqlVirtualMachinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateSqlVirtualMachineStorageConfigurationEXTEND.json + */ + /** + * Sample code: Creates or updates a SQL virtual machine for Storage Configuration Settings to EXTEND Data, Log or + * TempDB storage pool. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void + createsOrUpdatesASQLVirtualMachineForStorageConfigurationSettingsToEXTENDDataLogOrTempDBStoragePool( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .sqlVirtualMachines() + .define("testvm") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withVirtualMachineResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm") + .withStorageConfigurationSettings( + new StorageConfigurationSettings() + .withSqlDataSettings(new SqlStorageSettings().withLuns(Arrays.asList(2))) + .withDiskConfigurationType(DiskConfigurationType.EXTEND)) + .create(); + } + + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateVirtualMachineWithVMGroup.json + */ + /** + * Sample code: Creates or updates a SQL virtual machine and joins it to a SQL virtual machine group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void createsOrUpdatesASQLVirtualMachineAndJoinsItToASQLVirtualMachineGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .sqlVirtualMachines() + .define("testvm") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withVirtualMachineResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm2") + .withWsfcDomainCredentials( + new WsfcDomainCredentials() + .withClusterBootstrapAccountPassword("") + .withClusterOperatorAccountPassword("") + .withSqlServiceAccountPassword("")) + .create(); + } + + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateSqlVirtualMachineAutomatedBackupWeekly.json + */ + /** + * Sample code: Creates or updates a SQL virtual machine for Automated Back up Settings with Weekly and Days of the + * week to run the back up. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void + createsOrUpdatesASQLVirtualMachineForAutomatedBackUpSettingsWithWeeklyAndDaysOfTheWeekToRunTheBackUp( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .sqlVirtualMachines() + .define("testvm") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withVirtualMachineResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm") + .withSqlServerLicenseType(SqlServerLicenseType.PAYG) + .withSqlManagement(SqlManagementMode.FULL) + .withSqlImageSku(SqlImageSku.ENTERPRISE) + .withAutoPatchingSettings( + new AutoPatchingSettings() + .withEnable(true) + .withDayOfWeek(DayOfWeek.SUNDAY) + .withMaintenanceWindowStartingHour(2) + .withMaintenanceWindowDuration(60)) + .withAutoBackupSettings( + new AutoBackupSettings() + .withEnable(true) + .withEnableEncryption(true) + .withRetentionPeriod(17) + .withStorageAccountUrl("https://teststorage.blob.core.windows.net/") + .withStorageContainerName("testcontainer") + .withStorageAccessKey("") + .withPassword("") + .withBackupSystemDbs(true) + .withBackupScheduleType(BackupScheduleType.MANUAL) + .withFullBackupFrequency(FullBackupFrequencyType.WEEKLY) + .withDaysOfWeek(Arrays.asList(DaysOfWeek.MONDAY, DaysOfWeek.FRIDAY)) + .withFullBackupStartTime(6) + .withFullBackupWindowHours(11) + .withLogBackupFrequency(10)) + .withKeyVaultCredentialSettings(new KeyVaultCredentialSettings().withEnable(false)) + .withServerConfigurationsManagementSettings( + new ServerConfigurationsManagementSettings() + .withSqlConnectivityUpdateSettings( + new SqlConnectivityUpdateSettings() + .withConnectivityType(ConnectivityType.PRIVATE) + .withPort(1433) + .withSqlAuthUpdateUsername("sqllogin") + .withSqlAuthUpdatePassword("")) + .withSqlWorkloadTypeUpdateSettings( + new SqlWorkloadTypeUpdateSettings().withSqlWorkloadType(SqlWorkloadType.OLTP)) + .withSqlStorageUpdateSettings( + new SqlStorageUpdateSettings() + .withDiskCount(1) + .withStartingDeviceId(2) + .withDiskConfigurationType(DiskConfigurationType.NEW)) + .withAdditionalFeaturesServerConfigurations( + new AdditionalFeaturesServerConfigurations().withIsRServicesEnabled(false))) + .create(); + } + + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateSqlVirtualMachineStorageConfigurationNEW.json + */ + /** + * Sample code: Creates or updates a SQL virtual machine for Storage Configuration Settings to NEW Data, Log and + * TempDB storage pool. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void + createsOrUpdatesASQLVirtualMachineForStorageConfigurationSettingsToNEWDataLogAndTempDBStoragePool( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .sqlVirtualMachines() + .define("testvm") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withVirtualMachineResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm") + .withStorageConfigurationSettings( + new StorageConfigurationSettings() + .withSqlDataSettings( + new SqlStorageSettings().withLuns(Arrays.asList(0)).withDefaultFilePath("F:\\folderpath\\")) + .withSqlLogSettings( + new SqlStorageSettings().withLuns(Arrays.asList(1)).withDefaultFilePath("G:\\folderpath\\")) + .withSqlTempDbSettings( + new SqlTempDbSettings() + .withDataFileSize(256) + .withDataGrowth(512) + .withLogFileSize(256) + .withLogGrowth(512) + .withDataFileCount(8) + .withDefaultFilePath("D:\\TEMP")) + .withSqlSystemDbOnDataDisk(true) + .withDiskConfigurationType(DiskConfigurationType.NEW) + .withStorageWorkloadType(StorageWorkloadType.OLTP)) + .create(); + } + + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateSqlVirtualMachineMAX.json + */ + /** + * Sample code: Creates or updates a SQL virtual machine with max parameters. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void createsOrUpdatesASQLVirtualMachineWithMaxParameters( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .sqlVirtualMachines() + .define("testvm") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withVirtualMachineResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm") + .withSqlServerLicenseType(SqlServerLicenseType.PAYG) + .withSqlManagement(SqlManagementMode.FULL) + .withSqlImageSku(SqlImageSku.ENTERPRISE) + .withAutoPatchingSettings( + new AutoPatchingSettings() + .withEnable(true) + .withDayOfWeek(DayOfWeek.SUNDAY) + .withMaintenanceWindowStartingHour(2) + .withMaintenanceWindowDuration(60)) + .withAutoBackupSettings( + new AutoBackupSettings() + .withEnable(true) + .withEnableEncryption(true) + .withRetentionPeriod(17) + .withStorageAccountUrl("https://teststorage.blob.core.windows.net/") + .withStorageContainerName("testcontainer") + .withStorageAccessKey("") + .withPassword("") + .withBackupSystemDbs(true) + .withBackupScheduleType(BackupScheduleType.MANUAL) + .withFullBackupFrequency(FullBackupFrequencyType.DAILY) + .withFullBackupStartTime(6) + .withFullBackupWindowHours(11) + .withLogBackupFrequency(10)) + .withKeyVaultCredentialSettings(new KeyVaultCredentialSettings().withEnable(false)) + .withServerConfigurationsManagementSettings( + new ServerConfigurationsManagementSettings() + .withSqlConnectivityUpdateSettings( + new SqlConnectivityUpdateSettings() + .withConnectivityType(ConnectivityType.PRIVATE) + .withPort(1433) + .withSqlAuthUpdateUsername("sqllogin") + .withSqlAuthUpdatePassword("")) + .withSqlWorkloadTypeUpdateSettings( + new SqlWorkloadTypeUpdateSettings().withSqlWorkloadType(SqlWorkloadType.OLTP)) + .withSqlStorageUpdateSettings( + new SqlStorageUpdateSettings() + .withDiskCount(1) + .withStartingDeviceId(2) + .withDiskConfigurationType(DiskConfigurationType.NEW)) + .withAdditionalFeaturesServerConfigurations( + new AdditionalFeaturesServerConfigurations().withIsRServicesEnabled(false)) + .withSqlInstanceSettings( + new SqlInstanceSettings() + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withMaxDop(8) + .withIsOptimizeForAdHocWorkloadsEnabled(true) + .withMinServerMemoryMB(0) + .withMaxServerMemoryMB(128))) + .withAssessmentSettings( + new AssessmentSettings() + .withEnable(true) + .withRunImmediately(true) + .withSchedule( + new Schedule() + .withEnable(true) + .withWeeklyInterval(1) + .withDayOfWeek(DayOfWeek.SUNDAY) + .withStartTime("23:17"))) + .create(); + } + + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/CreateOrUpdateSqlVirtualMachineMIN.json + */ + /** + * Sample code: Creates or updates a SQL virtual machine with min parameters. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void createsOrUpdatesASQLVirtualMachineWithMinParameters( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager + .sqlVirtualMachines() + .define("testvm") + .withRegion("northeurope") + .withExistingResourceGroup("testrg") + .withVirtualMachineResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm") + .create(); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesDeleteSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesDeleteSamples.java new file mode 100644 index 000000000000..ee14a3bc94dd --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesDeleteSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachines Delete. */ +public final class SqlVirtualMachinesDeleteSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/DeleteSqlVirtualMachine.json + */ + /** + * Sample code: Deletes a SQL virtual machine. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void deletesASQLVirtualMachine( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachines().delete("testrg", "testvm1", Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesGetByResourceGroupSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..92ec65adcdf8 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesGetByResourceGroupSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachines GetByResourceGroup. */ +public final class SqlVirtualMachinesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/GetSqlVirtualMachine.json + */ + /** + * Sample code: Gets a SQL virtual machine. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsASQLVirtualMachine( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachines().getByResourceGroupWithResponse("testrg", "testvm", null, Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesListByResourceGroupSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesListByResourceGroupSamples.java new file mode 100644 index 000000000000..2ef0962bb0f8 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesListByResourceGroupSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachines ListByResourceGroup. */ +public final class SqlVirtualMachinesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListByResourceGroupSqlVirtualMachine.json + */ + /** + * Sample code: Gets all SQL virtual machines in a resource group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsAllSQLVirtualMachinesInAResourceGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachines().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesListBySqlVmGroupSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesListBySqlVmGroupSamples.java new file mode 100644 index 000000000000..c4d25a7196cd --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesListBySqlVmGroupSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachines ListBySqlVmGroup. */ +public final class SqlVirtualMachinesListBySqlVmGroupSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListBySqlVirtualMachineGroupSqlVirtualMachine.json + */ + /** + * Sample code: Gets the list of sql virtual machines in a SQL virtual machine group. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsTheListOfSqlVirtualMachinesInASQLVirtualMachineGroup( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachines().listBySqlVmGroup("testrg", "testvm", Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesListSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesListSamples.java new file mode 100644 index 000000000000..8cedf72e3c6c --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesListSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachines List. */ +public final class SqlVirtualMachinesListSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/ListSubscriptionSqlVirtualMachine.json + */ + /** + * Sample code: Gets all SQL virtual machines in a subscription. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void getsAllSQLVirtualMachinesInASubscription( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachines().list(Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesRedeploySamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesRedeploySamples.java new file mode 100644 index 000000000000..6092e5269504 --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesRedeploySamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachines Redeploy. */ +public final class SqlVirtualMachinesRedeploySamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/RedeploySqlVirtualMachine.json + */ + /** + * Sample code: Uninstalls and reinstalls the SQL Iaas Extension. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void uninstallsAndReinstallsTheSQLIaasExtension( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachines().redeploy("testrg", "testvm", Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesStartAssessmentSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesStartAssessmentSamples.java new file mode 100644 index 000000000000..f10c0b4bef5d --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesStartAssessmentSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlVirtualMachines StartAssessment. */ +public final class SqlVirtualMachinesStartAssessmentSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/StartAssessmentOnSqlVirtualMachine.json + */ + /** + * Sample code: Starts Assessment on SQL virtual machine. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void startsAssessmentOnSQLVirtualMachine( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + manager.sqlVirtualMachines().startAssessment("testrg", "testvm", Context.NONE); + } +} diff --git a/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesUpdateSamples.java b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesUpdateSamples.java new file mode 100644 index 000000000000..301d8dcef25b --- /dev/null +++ b/sdk/sqlvirtualmachine/azure-resourcemanager-sqlvirtualmachine/src/samples/java/com/azure/resourcemanager/sqlvirtualmachine/generated/SqlVirtualMachinesUpdateSamples.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.sqlvirtualmachine.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sqlvirtualmachine.models.SqlVirtualMachine; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlVirtualMachines Update. */ +public final class SqlVirtualMachinesUpdateSamples { + /* + * x-ms-original-file: specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2021-11-01-preview/examples/UpdateSqlVirtualMachine.json + */ + /** + * Sample code: Updates a SQL virtual machine tags. + * + * @param manager Entry point to SqlVirtualMachineManager. + */ + public static void updatesASQLVirtualMachineTags( + com.azure.resourcemanager.sqlvirtualmachine.SqlVirtualMachineManager manager) { + SqlVirtualMachine resource = + manager + .sqlVirtualMachines() + .getByResourceGroupWithResponse("testrg", "testvm", null, Context.NONE) + .getValue(); + resource.update().withTags(mapOf("mytag", "myval")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +}