From f6d75135992ec70369835cd9c6932aebc47f4a49 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Tue, 10 Dec 2019 10:39:40 +0000 Subject: [PATCH] Generated from db4f6148f63b27fc164553742720b55ba08e3ef9 Fixed readme --- sdk/sql/mgmt-v2015_05_01_preview/pom.xml | 4 +- .../DatabaseBlobAuditingPolicies.java | 11 + .../DatabaseBlobAuditingPolicy.java | 43 +- .../EncryptionProtectors.java | 11 + .../v2015_05_01_preview/ManagedInstance.java | 242 ++++- .../ManagedInstanceLicenseType.java | 41 + .../ManagedInstanceProxyOverride.java | 44 + .../ManagedInstanceUpdate.java | 244 ++++- .../ManagedServerCreateMode.java | 41 + .../RecommendedActionStateInfo.java | 10 +- .../sql/v2015_05_01_preview/Sku.java | 30 +- .../v2015_05_01_preview/VirtualCluster.java | 65 ++ .../VirtualClusterUpdate.java | 104 ++ .../v2015_05_01_preview/VirtualClusters.java | 24 + .../implementation/AdvisorInner.java | 8 +- .../implementation/DatabaseAdvisorsImpl.java | 10 +- .../DatabaseBlobAuditingPoliciesImpl.java | 27 +- .../DatabaseBlobAuditingPoliciesInner.java | 256 +++++ .../DatabaseBlobAuditingPolicyImpl.java | 11 + .../DatabaseBlobAuditingPolicyInner.java | 45 +- .../DatabaseRecommendedActionsImpl.java | 10 +- .../EncryptionProtectorInner.java | 13 +- .../EncryptionProtectorsImpl.java | 7 + .../EncryptionProtectorsInner.java | 165 +++ .../implementation/FailoverGroupsImpl.java | 10 +- .../implementation/FirewallRulesImpl.java | 10 +- .../implementation/ManagedInstanceImpl.java | 113 +- .../implementation/ManagedInstanceInner.java | 254 ++++- .../implementation/ManagedInstancesInner.java | 268 ++--- .../implementation/ServerAdvisorsImpl.java | 10 +- .../implementation/ServerKeysImpl.java | 10 +- .../SqlManagementClientImpl.java | 14 + .../implementation/SqlManager.java | 12 + .../SubscriptionUsagesImpl.java | 10 +- .../implementation/SyncAgentsImpl.java | 10 +- .../implementation/SyncGroupsImpl.java | 10 +- .../implementation/SyncMembersImpl.java | 10 +- .../implementation/VirtualClusterImpl.java | 81 ++ .../implementation/VirtualClusterInner.java | 78 ++ .../implementation/VirtualClustersImpl.java | 133 +++ .../implementation/VirtualClustersInner.java | 963 ++++++++++++++++++ .../VirtualNetworkRulesImpl.java | 10 +- 42 files changed, 3210 insertions(+), 262 deletions(-) create mode 100644 sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceLicenseType.java create mode 100644 sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceProxyOverride.java create mode 100644 sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedServerCreateMode.java create mode 100644 sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualCluster.java create mode 100644 sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusterUpdate.java create mode 100644 sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusters.java create mode 100644 sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClusterImpl.java create mode 100644 sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClusterInner.java create mode 100644 sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersImpl.java create mode 100644 sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersInner.java diff --git a/sdk/sql/mgmt-v2015_05_01_preview/pom.xml b/sdk/sql/mgmt-v2015_05_01_preview/pom.xml index 912ddf36f0117..09e4810affde8 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/pom.xml +++ b/sdk/sql/mgmt-v2015_05_01_preview/pom.xml @@ -11,7 +11,7 @@ com.microsoft.azure azure-arm-parent - 1.2.0 + 1.1.0 ../../../pom.management.xml azure-mgmt-sql @@ -71,6 +71,8 @@ azure-arm-client-runtime test-jar test + + 1.6.5 diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicies.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicies.java index 70855776d91e7..cd93786db3b02 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicies.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicies.java @@ -28,4 +28,15 @@ public interface DatabaseBlobAuditingPolicies extends SupportsCreating getAsync(String resourceGroupName, String serverName, String databaseName); + /** + * Lists auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName); + } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicy.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicy.java index 297a35975dea4..24d593535b5ea 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicy.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/DatabaseBlobAuditingPolicy.java @@ -54,6 +54,11 @@ public interface DatabaseBlobAuditingPolicy extends HasInner, DefinitionStages.WithAuditActionsAndGroups, DefinitionStages.WithIsAzureMonitorTargetEnabled, DefinitionStages.WithIsStorageSecondaryKeyInUse, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageAccountSubscriptionId, DefinitionStages.WithStorageEndpoint { + interface WithCreate extends Creatable, DefinitionStages.WithAuditActionsAndGroups, DefinitionStages.WithIsAzureMonitorTargetEnabled, DefinitionStages.WithIsStorageSecondaryKeyInUse, DefinitionStages.WithQueueDelayMs, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageAccountSubscriptionId, DefinitionStages.WithStorageEndpoint { } } /** * The template for a DatabaseBlobAuditingPolicy update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, UpdateStages.WithAuditActionsAndGroups, UpdateStages.WithIsAzureMonitorTargetEnabled, UpdateStages.WithIsStorageSecondaryKeyInUse, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageAccountSubscriptionId, UpdateStages.WithStorageEndpoint { + interface Update extends Appliable, UpdateStages.WithAuditActionsAndGroups, UpdateStages.WithIsAzureMonitorTargetEnabled, UpdateStages.WithIsStorageSecondaryKeyInUse, UpdateStages.WithQueueDelayMs, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageAccountSubscriptionId, UpdateStages.WithStorageEndpoint { } /** @@ -342,7 +360,7 @@ interface WithIsAzureMonitorTargetEnabled { /** * Specifies isAzureMonitorTargetEnabled. * @param isAzureMonitorTargetEnabled Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. Note that for server level audit you should use the 'master' database as {databaseName}. Diagnostic Settings URI format: @@ -366,6 +384,19 @@ interface WithIsStorageSecondaryKeyInUse { Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); } + /** + * The stage of the databaseblobauditingpolicy update allowing to specify QueueDelayMs. + */ + interface WithQueueDelayMs { + /** + * Specifies queueDelayMs. + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. + The default minimum value is 1000 (1 second). The maximum is 2,147,483,647 + * @return the next update stage + */ + Update withQueueDelayMs(Integer queueDelayMs); + } + /** * The stage of the databaseblobauditingpolicy update allowing to specify RetentionDays. */ @@ -408,7 +439,7 @@ interface WithStorageAccountSubscriptionId { interface WithStorageEndpoint { /** * Specifies storageEndpoint. - * @param storageEndpoint Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required + * @param storageEndpoint Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required * @return the next update stage */ Update withStorageEndpoint(String storageEndpoint); diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/EncryptionProtectors.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/EncryptionProtectors.java index 1d29b5ef76574..bf046d30cfb1d 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/EncryptionProtectors.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/EncryptionProtectors.java @@ -8,6 +8,7 @@ package com.microsoft.azure.management.sql.v2015_05_01_preview; +import rx.Completable; import rx.Observable; import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.EncryptionProtectorInner; import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.EncryptionProtectorsInner; @@ -17,6 +18,16 @@ * Type representing EncryptionProtectors. */ public interface EncryptionProtectors extends HasInner { + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable revalidateAsync(String resourceGroupName, String serverName); + /** * Gets a list of server encryption protectors. * diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java index 8b419867091bb..4b8baf1a2c5ff 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java @@ -18,6 +18,7 @@ import com.microsoft.azure.arm.model.Creatable; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.ManagedInstanceInner; /** @@ -59,16 +60,46 @@ public interface ManagedInstance extends HasInner, Resourc */ ResourceIdentity identity(); + /** + * @return the instancePoolId value. + */ + String instancePoolId(); + /** * @return the licenseType value. */ - String licenseType(); + ManagedInstanceLicenseType licenseType(); + + /** + * @return the managedInstanceCreateMode value. + */ + ManagedServerCreateMode managedInstanceCreateMode(); + + /** + * @return the proxyOverride value. + */ + ManagedInstanceProxyOverride proxyOverride(); + + /** + * @return the publicDataEndpointEnabled value. + */ + Boolean publicDataEndpointEnabled(); + + /** + * @return the restorePointInTime value. + */ + DateTime restorePointInTime(); /** * @return the sku value. */ Sku sku(); + /** + * @return the sourceManagedInstanceId value. + */ + String sourceManagedInstanceId(); + /** * @return the state value. */ @@ -84,6 +115,11 @@ public interface ManagedInstance extends HasInner, Resourc */ String subnetId(); + /** + * @return the timezoneId value. + */ + String timezoneId(); + /** * @return the vCores value. */ @@ -171,16 +207,78 @@ interface WithIdentity { WithCreate withIdentity(ResourceIdentity identity); } + /** + * The stage of the managedinstance definition allowing to specify InstancePoolId. + */ + interface WithInstancePoolId { + /** + * Specifies instancePoolId. + * @param instancePoolId The Id of the instance pool this managed server belongs to + * @return the next definition stage + */ + WithCreate withInstancePoolId(String instancePoolId); + } + /** * The stage of the managedinstance definition allowing to specify LicenseType. */ interface WithLicenseType { /** * Specifies licenseType. - * @param licenseType The license type. Possible values are 'LicenseIncluded' and 'BasePrice' + * @param licenseType The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice' + * @return the next definition stage + */ + WithCreate withLicenseType(ManagedInstanceLicenseType licenseType); + } + + /** + * The stage of the managedinstance definition allowing to specify ManagedInstanceCreateMode. + */ + interface WithManagedInstanceCreateMode { + /** + * Specifies managedInstanceCreateMode. + * @param managedInstanceCreateMode Specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore' + * @return the next definition stage + */ + WithCreate withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode); + } + + /** + * The stage of the managedinstance definition allowing to specify ProxyOverride. + */ + interface WithProxyOverride { + /** + * Specifies proxyOverride. + * @param proxyOverride Connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default' + * @return the next definition stage + */ + WithCreate withProxyOverride(ManagedInstanceProxyOverride proxyOverride); + } + + /** + * The stage of the managedinstance definition allowing to specify PublicDataEndpointEnabled. + */ + interface WithPublicDataEndpointEnabled { + /** + * Specifies publicDataEndpointEnabled. + * @param publicDataEndpointEnabled Whether or not the public data endpoint is enabled * @return the next definition stage */ - WithCreate withLicenseType(String licenseType); + WithCreate withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled); + } + + /** + * The stage of the managedinstance definition allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + * @param restorePointInTime Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database + * @return the next definition stage + */ + WithCreate withRestorePointInTime(DateTime restorePointInTime); } /** @@ -189,19 +287,31 @@ interface WithLicenseType { interface WithSku { /** * Specifies sku. - * @param sku Managed instance sku + * @param sku Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5 * @return the next definition stage */ WithCreate withSku(Sku sku); } + /** + * The stage of the managedinstance definition allowing to specify SourceManagedInstanceId. + */ + interface WithSourceManagedInstanceId { + /** + * Specifies sourceManagedInstanceId. + * @param sourceManagedInstanceId The resource identifier of the source managed instance associated with create operation of this instance + * @return the next definition stage + */ + WithCreate withSourceManagedInstanceId(String sourceManagedInstanceId); + } + /** * The stage of the managedinstance definition allowing to specify StorageSizeInGB. */ interface WithStorageSizeInGB { /** * Specifies storageSizeInGB. - * @param storageSizeInGB The maximum storage size in GB + * @param storageSizeInGB Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only * @return the next definition stage */ WithCreate withStorageSizeInGB(Integer storageSizeInGB); @@ -219,13 +329,30 @@ interface WithSubnetId { WithCreate withSubnetId(String subnetId); } + /** + * The stage of the managedinstance definition allowing to specify TimezoneId. + */ + interface WithTimezoneId { + /** + * Specifies timezoneId. + * @param timezoneId Id of the timezone. Allowed values are timezones supported by Windows. + Windows keeps details on supported timezones, including the id, in registry under + KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time" + * @return the next definition stage + */ + WithCreate withTimezoneId(String timezoneId); + } + /** * The stage of the managedinstance definition allowing to specify VCores. */ interface WithVCores { /** * Specifies vCores. - * @param vCores The number of VCores + * @param vCores The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80 * @return the next definition stage */ WithCreate withVCores(Integer vCores); @@ -236,13 +363,13 @@ interface WithVCores { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithCollation, DefinitionStages.WithDnsZonePartner, DefinitionStages.WithIdentity, DefinitionStages.WithLicenseType, DefinitionStages.WithSku, DefinitionStages.WithStorageSizeInGB, DefinitionStages.WithSubnetId, DefinitionStages.WithVCores { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithCollation, DefinitionStages.WithDnsZonePartner, DefinitionStages.WithIdentity, DefinitionStages.WithInstancePoolId, DefinitionStages.WithLicenseType, DefinitionStages.WithManagedInstanceCreateMode, DefinitionStages.WithProxyOverride, DefinitionStages.WithPublicDataEndpointEnabled, DefinitionStages.WithRestorePointInTime, DefinitionStages.WithSku, DefinitionStages.WithSourceManagedInstanceId, DefinitionStages.WithStorageSizeInGB, DefinitionStages.WithSubnetId, DefinitionStages.WithTimezoneId, DefinitionStages.WithVCores { } } /** * The template for a ManagedInstance update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAdministratorLogin, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithCollation, UpdateStages.WithDnsZonePartner, UpdateStages.WithLicenseType, UpdateStages.WithSku, UpdateStages.WithStorageSizeInGB, UpdateStages.WithSubnetId, UpdateStages.WithVCores { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAdministratorLogin, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithCollation, UpdateStages.WithDnsZonePartner, UpdateStages.WithInstancePoolId, UpdateStages.WithLicenseType, UpdateStages.WithManagedInstanceCreateMode, UpdateStages.WithProxyOverride, UpdateStages.WithPublicDataEndpointEnabled, UpdateStages.WithRestorePointInTime, UpdateStages.WithSku, UpdateStages.WithSourceManagedInstanceId, UpdateStages.WithStorageSizeInGB, UpdateStages.WithSubnetId, UpdateStages.WithTimezoneId, UpdateStages.WithVCores { } /** @@ -297,16 +424,78 @@ interface WithDnsZonePartner { Update withDnsZonePartner(String dnsZonePartner); } + /** + * The stage of the managedinstance update allowing to specify InstancePoolId. + */ + interface WithInstancePoolId { + /** + * Specifies instancePoolId. + * @param instancePoolId The Id of the instance pool this managed server belongs to + * @return the next update stage + */ + Update withInstancePoolId(String instancePoolId); + } + /** * The stage of the managedinstance update allowing to specify LicenseType. */ interface WithLicenseType { /** * Specifies licenseType. - * @param licenseType The license type. Possible values are 'LicenseIncluded' and 'BasePrice' + * @param licenseType The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice' + * @return the next update stage + */ + Update withLicenseType(ManagedInstanceLicenseType licenseType); + } + + /** + * The stage of the managedinstance update allowing to specify ManagedInstanceCreateMode. + */ + interface WithManagedInstanceCreateMode { + /** + * Specifies managedInstanceCreateMode. + * @param managedInstanceCreateMode Specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore' + * @return the next update stage + */ + Update withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode); + } + + /** + * The stage of the managedinstance update allowing to specify ProxyOverride. + */ + interface WithProxyOverride { + /** + * Specifies proxyOverride. + * @param proxyOverride Connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default' + * @return the next update stage + */ + Update withProxyOverride(ManagedInstanceProxyOverride proxyOverride); + } + + /** + * The stage of the managedinstance update allowing to specify PublicDataEndpointEnabled. + */ + interface WithPublicDataEndpointEnabled { + /** + * Specifies publicDataEndpointEnabled. + * @param publicDataEndpointEnabled Whether or not the public data endpoint is enabled + * @return the next update stage + */ + Update withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled); + } + + /** + * The stage of the managedinstance update allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + * @param restorePointInTime Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database * @return the next update stage */ - Update withLicenseType(String licenseType); + Update withRestorePointInTime(DateTime restorePointInTime); } /** @@ -321,13 +510,25 @@ interface WithSku { Update withSku(Sku sku); } + /** + * The stage of the managedinstance update allowing to specify SourceManagedInstanceId. + */ + interface WithSourceManagedInstanceId { + /** + * Specifies sourceManagedInstanceId. + * @param sourceManagedInstanceId The resource identifier of the source managed instance associated with create operation of this instance + * @return the next update stage + */ + Update withSourceManagedInstanceId(String sourceManagedInstanceId); + } + /** * The stage of the managedinstance update allowing to specify StorageSizeInGB. */ interface WithStorageSizeInGB { /** * Specifies storageSizeInGB. - * @param storageSizeInGB The maximum storage size in GB + * @param storageSizeInGB Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only * @return the next update stage */ Update withStorageSizeInGB(Integer storageSizeInGB); @@ -345,13 +546,30 @@ interface WithSubnetId { Update withSubnetId(String subnetId); } + /** + * The stage of the managedinstance update allowing to specify TimezoneId. + */ + interface WithTimezoneId { + /** + * Specifies timezoneId. + * @param timezoneId Id of the timezone. Allowed values are timezones supported by Windows. + Windows keeps details on supported timezones, including the id, in registry under + KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time" + * @return the next update stage + */ + Update withTimezoneId(String timezoneId); + } + /** * The stage of the managedinstance update allowing to specify VCores. */ interface WithVCores { /** * Specifies vCores. - * @param vCores The number of VCores + * @param vCores The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80 * @return the next update stage */ Update withVCores(Integer vCores); diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceLicenseType.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceLicenseType.java new file mode 100644 index 0000000000000..2fdac3314c3a9 --- /dev/null +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceLicenseType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagedInstanceLicenseType. + */ +public final class ManagedInstanceLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for ManagedInstanceLicenseType. */ + public static final ManagedInstanceLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for ManagedInstanceLicenseType. */ + public static final ManagedInstanceLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a ManagedInstanceLicenseType from its string representation. + * @param name a name to look for + * @return the corresponding ManagedInstanceLicenseType + */ + @JsonCreator + public static ManagedInstanceLicenseType fromString(String name) { + return fromString(name, ManagedInstanceLicenseType.class); + } + + /** + * @return known ManagedInstanceLicenseType values + */ + public static Collection values() { + return values(ManagedInstanceLicenseType.class); + } +} diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceProxyOverride.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceProxyOverride.java new file mode 100644 index 0000000000000..3ad67fc38a27e --- /dev/null +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceProxyOverride.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagedInstanceProxyOverride. + */ +public final class ManagedInstanceProxyOverride extends ExpandableStringEnum { + /** Static value Proxy for ManagedInstanceProxyOverride. */ + public static final ManagedInstanceProxyOverride PROXY = fromString("Proxy"); + + /** Static value Redirect for ManagedInstanceProxyOverride. */ + public static final ManagedInstanceProxyOverride REDIRECT = fromString("Redirect"); + + /** Static value Default for ManagedInstanceProxyOverride. */ + public static final ManagedInstanceProxyOverride DEFAULT = fromString("Default"); + + /** + * Creates or finds a ManagedInstanceProxyOverride from its string representation. + * @param name a name to look for + * @return the corresponding ManagedInstanceProxyOverride + */ + @JsonCreator + public static ManagedInstanceProxyOverride fromString(String name) { + return fromString(name, ManagedInstanceProxyOverride.class); + } + + /** + * @return known ManagedInstanceProxyOverride values + */ + public static Collection values() { + return values(ManagedInstanceProxyOverride.class); + } +} diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java index 9e4b6b717db42..5ce66ed3f1a51 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java @@ -8,6 +8,7 @@ package com.microsoft.azure.management.sql.v2015_05_01_preview; +import org.joda.time.DateTime; import java.util.Map; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; @@ -23,6 +24,18 @@ public class ManagedInstanceUpdate { @JsonProperty(value = "sku") private Sku sku; + /** + * Specifies the mode of database creation. + * + * Default: Regular instance creation. + * + * Restore: Creates an instance by restoring a set of backups to specific + * point in time. RestorePointInTime and SourceManagedInstanceId must be + * specified. Possible values include: 'Default', 'PointInTimeRestore'. + */ + @JsonProperty(value = "properties.managedInstanceCreateMode") + private ManagedServerCreateMode managedInstanceCreateMode; + /** * The fully qualified domain name of the managed instance. */ @@ -57,19 +70,23 @@ public class ManagedInstanceUpdate { private String state; /** - * The license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * The license type. Possible values are 'LicenseIncluded' (regular price + * inclusive of a new SQL license) and 'BasePrice' (discounted AHB price + * for bringing your own SQL licenses). Possible values include: + * 'LicenseIncluded', 'BasePrice'. */ @JsonProperty(value = "properties.licenseType") - private String licenseType; + private ManagedInstanceLicenseType licenseType; /** - * The number of VCores. + * The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. */ @JsonProperty(value = "properties.vCores") private Integer vCores; /** - * The maximum storage size in GB. + * Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments + * of 32 GB allowed only. */ @JsonProperty(value = "properties.storageSizeInGB") private Integer storageSizeInGB; @@ -93,6 +110,55 @@ public class ManagedInstanceUpdate { @JsonProperty(value = "properties.dnsZonePartner") private String dnsZonePartner; + /** + * Whether or not the public data endpoint is enabled. + */ + @JsonProperty(value = "properties.publicDataEndpointEnabled") + private Boolean publicDataEndpointEnabled; + + /** + * The resource identifier of the source managed instance associated with + * create operation of this instance. + */ + @JsonProperty(value = "properties.sourceManagedInstanceId") + private String sourceManagedInstanceId; + + /** + * Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Connection type used for connecting to the instance. Possible values + * include: 'Proxy', 'Redirect', 'Default'. + */ + @JsonProperty(value = "properties.proxyOverride") + private ManagedInstanceProxyOverride proxyOverride; + + /** + * Id of the timezone. Allowed values are timezones supported by Windows. + * Windows keeps details on supported timezones, including the id, in + * registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time + * Zones. + * You can get those registry values via SQL Server by querying SELECT name + * AS timezone_id FROM sys.time_zone_info. + * List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + * An example of valid timezone id is "Pacific Standard Time" or "W. Europe + * Standard Time". + */ + @JsonProperty(value = "properties.timezoneId") + private String timezoneId; + + /** + * The Id of the instance pool this managed server belongs to. + */ + @JsonProperty(value = "properties.instancePoolId") + private String instancePoolId; + /** * Resource tags. */ @@ -119,6 +185,30 @@ public ManagedInstanceUpdate withSku(Sku sku) { return this; } + /** + * Get specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore'. + * + * @return the managedInstanceCreateMode value + */ + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.managedInstanceCreateMode; + } + + /** + * Set specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore'. + * + * @param managedInstanceCreateMode the managedInstanceCreateMode value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + this.managedInstanceCreateMode = managedInstanceCreateMode; + return this; + } + /** * Get the fully qualified domain name of the managed instance. * @@ -198,27 +288,27 @@ public String state() { } /** - * Get the license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * Get the license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice'. * * @return the licenseType value */ - public String licenseType() { + public ManagedInstanceLicenseType licenseType() { return this.licenseType; } /** - * Set the license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * Set the license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice'. * * @param licenseType the licenseType value to set * @return the ManagedInstanceUpdate object itself. */ - public ManagedInstanceUpdate withLicenseType(String licenseType) { + public ManagedInstanceUpdate withLicenseType(ManagedInstanceLicenseType licenseType) { this.licenseType = licenseType; return this; } /** - * Get the number of VCores. + * Get the number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. * * @return the vCores value */ @@ -227,7 +317,7 @@ public Integer vCores() { } /** - * Set the number of VCores. + * Set the number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. * * @param vCores the vCores value to set * @return the ManagedInstanceUpdate object itself. @@ -238,7 +328,7 @@ public ManagedInstanceUpdate withVCores(Integer vCores) { } /** - * Get the maximum storage size in GB. + * Get storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. * * @return the storageSizeInGB value */ @@ -247,7 +337,7 @@ public Integer storageSizeInGB() { } /** - * Set the maximum storage size in GB. + * Set storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. * * @param storageSizeInGB the storageSizeInGB value to set * @return the ManagedInstanceUpdate object itself. @@ -306,6 +396,136 @@ public ManagedInstanceUpdate withDnsZonePartner(String dnsZonePartner) { return this; } + /** + * Get whether or not the public data endpoint is enabled. + * + * @return the publicDataEndpointEnabled value + */ + public Boolean publicDataEndpointEnabled() { + return this.publicDataEndpointEnabled; + } + + /** + * Set whether or not the public data endpoint is enabled. + * + * @param publicDataEndpointEnabled the publicDataEndpointEnabled value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled) { + this.publicDataEndpointEnabled = publicDataEndpointEnabled; + return this; + } + + /** + * Get the resource identifier of the source managed instance associated with create operation of this instance. + * + * @return the sourceManagedInstanceId value + */ + public String sourceManagedInstanceId() { + return this.sourceManagedInstanceId; + } + + /** + * Set the resource identifier of the source managed instance associated with create operation of this instance. + * + * @param sourceManagedInstanceId the sourceManagedInstanceId value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withSourceManagedInstanceId(String sourceManagedInstanceId) { + this.sourceManagedInstanceId = sourceManagedInstanceId; + return this; + } + + /** + * Get specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default'. + * + * @return the proxyOverride value + */ + public ManagedInstanceProxyOverride proxyOverride() { + return this.proxyOverride; + } + + /** + * Set connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default'. + * + * @param proxyOverride the proxyOverride value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + this.proxyOverride = proxyOverride; + return this; + } + + /** + * Get id of the timezone. Allowed values are timezones supported by Windows. + Windows keeps details on supported timezones, including the id, in registry under + KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". + * + * @return the timezoneId value + */ + public String timezoneId() { + return this.timezoneId; + } + + /** + * Set id of the timezone. Allowed values are timezones supported by Windows. + Windows keeps details on supported timezones, including the id, in registry under + KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". + * + * @param timezoneId the timezoneId value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withTimezoneId(String timezoneId) { + this.timezoneId = timezoneId; + return this; + } + + /** + * Get the Id of the instance pool this managed server belongs to. + * + * @return the instancePoolId value + */ + public String instancePoolId() { + return this.instancePoolId; + } + + /** + * Set the Id of the instance pool this managed server belongs to. + * + * @param instancePoolId the instancePoolId value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withInstancePoolId(String instancePoolId) { + this.instancePoolId = instancePoolId; + return this; + } + /** * Get resource tags. * diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedServerCreateMode.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedServerCreateMode.java new file mode 100644 index 0000000000000..69456304a58db --- /dev/null +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedServerCreateMode.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagedServerCreateMode. + */ +public final class ManagedServerCreateMode extends ExpandableStringEnum { + /** Static value Default for ManagedServerCreateMode. */ + public static final ManagedServerCreateMode DEFAULT = fromString("Default"); + + /** Static value PointInTimeRestore for ManagedServerCreateMode. */ + public static final ManagedServerCreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** + * Creates or finds a ManagedServerCreateMode from its string representation. + * @param name a name to look for + * @return the corresponding ManagedServerCreateMode + */ + @JsonCreator + public static ManagedServerCreateMode fromString(String name) { + return fromString(name, ManagedServerCreateMode.class); + } + + /** + * @return known ManagedServerCreateMode values + */ + public static Collection values() { + return values(ManagedServerCreateMode.class); + } +} diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionStateInfo.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionStateInfo.java index 15422cce9fb14..4cef42e505436 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionStateInfo.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/RecommendedActionStateInfo.java @@ -28,7 +28,7 @@ public class RecommendedActionStateInfo { * improvement so recommended action is queued for revert or user has * manually reverted. Reverting -> changes made while applying * recommended action are being reverted on the user database. Reverted - * -> succesfully reverted the changes made by recommended action on + * -> successfully reverted the changes made by recommended action on * user database. Ignored -> user explicitly ignored/discarded the * recommended action. Possible values include: 'Active', 'Pending', * 'Executing', 'Verifying', 'PendingRevert', 'RevertCancelled', @@ -40,7 +40,7 @@ public class RecommendedActionStateInfo { /** * Gets who initiated the execution of this recommended action. Possible - * Value are: User -> When user explicity notified system to apply + * Value are: User -> When user explicitly notified system to apply * the recommended action. System -> When auto-execute status of this * advisor was set to 'Enabled', in which case the system applied it. * Possible values include: 'User', 'System'. @@ -55,7 +55,7 @@ public class RecommendedActionStateInfo { private DateTime lastModified; /** - * Get current state the recommended action is in. Some commonly used states are: Active -> recommended action is active and no action has been taken yet. Pending -> recommended action is approved for and is awaiting execution. Executing -> recommended action is being applied on the user database. Verifying -> recommended action was applied and is being verified of its usefulness by the system. Success -> recommended action was applied and improvement found during verification. Pending Revert -> verification found little or no improvement so recommended action is queued for revert or user has manually reverted. Reverting -> changes made while applying recommended action are being reverted on the user database. Reverted -> succesfully reverted the changes made by recommended action on user database. Ignored -> user explicitly ignored/discarded the recommended action. Possible values include: 'Active', 'Pending', 'Executing', 'Verifying', 'PendingRevert', 'RevertCancelled', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Monitoring', 'Resolved', 'Success', 'Error'. + * Get current state the recommended action is in. Some commonly used states are: Active -> recommended action is active and no action has been taken yet. Pending -> recommended action is approved for and is awaiting execution. Executing -> recommended action is being applied on the user database. Verifying -> recommended action was applied and is being verified of its usefulness by the system. Success -> recommended action was applied and improvement found during verification. Pending Revert -> verification found little or no improvement so recommended action is queued for revert or user has manually reverted. Reverting -> changes made while applying recommended action are being reverted on the user database. Reverted -> successfully reverted the changes made by recommended action on user database. Ignored -> user explicitly ignored/discarded the recommended action. Possible values include: 'Active', 'Pending', 'Executing', 'Verifying', 'PendingRevert', 'RevertCancelled', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Monitoring', 'Resolved', 'Success', 'Error'. * * @return the currentValue value */ @@ -64,7 +64,7 @@ public RecommendedActionCurrentState currentValue() { } /** - * Set current state the recommended action is in. Some commonly used states are: Active -> recommended action is active and no action has been taken yet. Pending -> recommended action is approved for and is awaiting execution. Executing -> recommended action is being applied on the user database. Verifying -> recommended action was applied and is being verified of its usefulness by the system. Success -> recommended action was applied and improvement found during verification. Pending Revert -> verification found little or no improvement so recommended action is queued for revert or user has manually reverted. Reverting -> changes made while applying recommended action are being reverted on the user database. Reverted -> succesfully reverted the changes made by recommended action on user database. Ignored -> user explicitly ignored/discarded the recommended action. Possible values include: 'Active', 'Pending', 'Executing', 'Verifying', 'PendingRevert', 'RevertCancelled', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Monitoring', 'Resolved', 'Success', 'Error'. + * Set current state the recommended action is in. Some commonly used states are: Active -> recommended action is active and no action has been taken yet. Pending -> recommended action is approved for and is awaiting execution. Executing -> recommended action is being applied on the user database. Verifying -> recommended action was applied and is being verified of its usefulness by the system. Success -> recommended action was applied and improvement found during verification. Pending Revert -> verification found little or no improvement so recommended action is queued for revert or user has manually reverted. Reverting -> changes made while applying recommended action are being reverted on the user database. Reverted -> successfully reverted the changes made by recommended action on user database. Ignored -> user explicitly ignored/discarded the recommended action. Possible values include: 'Active', 'Pending', 'Executing', 'Verifying', 'PendingRevert', 'RevertCancelled', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Monitoring', 'Resolved', 'Success', 'Error'. * * @param currentValue the currentValue value to set * @return the RecommendedActionStateInfo object itself. @@ -75,7 +75,7 @@ public RecommendedActionStateInfo withCurrentValue(RecommendedActionCurrentState } /** - * Get gets who initiated the execution of this recommended action. Possible Value are: User -> When user explicity notified system to apply the recommended action. System -> When auto-execute status of this advisor was set to 'Enabled', in which case the system applied it. Possible values include: 'User', 'System'. + * Get gets who initiated the execution of this recommended action. Possible Value are: User -> When user explicitly notified system to apply the recommended action. System -> When auto-execute status of this advisor was set to 'Enabled', in which case the system applied it. Possible values include: 'User', 'System'. * * @return the actionInitiatedBy value */ diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Sku.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Sku.java index 70001af090796..714f4f4542d82 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Sku.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/Sku.java @@ -11,25 +11,23 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The resource model definition representing SKU. + * An ARM Resource SKU. */ public class Sku { /** - * The name of the SKU. Ex - P3. It is typically a letter+number code. + * The name of the SKU, typically, a letter + Number code, e.g. P3. */ @JsonProperty(value = "name", required = true) private String name; /** - * This field is required to be implemented by the Resource Provider if the - * service has more than one tier, but is not required on a PUT. + * The tier or edition of the particular SKU, e.g. Basic, Premium. */ @JsonProperty(value = "tier") private String tier; /** - * The SKU size. When the name field is the combination of tier and some - * other value, this would be the standalone code. + * Size of the particular SKU. */ @JsonProperty(value = "size") private String size; @@ -42,15 +40,13 @@ public class Sku { private String family; /** - * If the SKU supports scale out/in then the capacity integer should be - * included. If scale out/in is not possible for the resource this may be - * omitted. + * Capacity of the particular SKU. */ @JsonProperty(value = "capacity") private Integer capacity; /** - * Get the name of the SKU. Ex - P3. It is typically a letter+number code. + * Get the name of the SKU, typically, a letter + Number code, e.g. P3. * * @return the name value */ @@ -59,7 +55,7 @@ public String name() { } /** - * Set the name of the SKU. Ex - P3. It is typically a letter+number code. + * Set the name of the SKU, typically, a letter + Number code, e.g. P3. * * @param name the name value to set * @return the Sku object itself. @@ -70,7 +66,7 @@ public Sku withName(String name) { } /** - * Get this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * Get the tier or edition of the particular SKU, e.g. Basic, Premium. * * @return the tier value */ @@ -79,7 +75,7 @@ public String tier() { } /** - * Set this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * Set the tier or edition of the particular SKU, e.g. Basic, Premium. * * @param tier the tier value to set * @return the Sku object itself. @@ -90,7 +86,7 @@ public Sku withTier(String tier) { } /** - * Get the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * Get size of the particular SKU. * * @return the size value */ @@ -99,7 +95,7 @@ public String size() { } /** - * Set the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * Set size of the particular SKU. * * @param size the size value to set * @return the Sku object itself. @@ -130,7 +126,7 @@ public Sku withFamily(String family) { } /** - * Get if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * Get capacity of the particular SKU. * * @return the capacity value */ @@ -139,7 +135,7 @@ public Integer capacity() { } /** - * Set if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * Set capacity of the particular SKU. * * @param capacity the capacity value to set * @return the Sku object itself. diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualCluster.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualCluster.java new file mode 100644 index 0000000000000..986eb161911e6 --- /dev/null +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualCluster.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; +import java.util.List; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.VirtualClusterInner; + +/** + * Type representing VirtualCluster. + */ +public interface VirtualCluster extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the childResources value. + */ + List childResources(); + + /** + * @return the family value. + */ + String family(); + + /** + * @return the subnetId value. + */ + String subnetId(); + + /** + * The template for a VirtualCluster update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithFamily { + } + + /** + * Grouping of VirtualCluster update stages. + */ + interface UpdateStages { + /** + * The stage of the virtualcluster update allowing to specify Family. + */ + interface WithFamily { + /** + * Specifies family. + * @param family If the service has different generations of hardware, for the same SKU, then that can be captured here + * @return the next update stage + */ + Update withFamily(String family); + } + + } +} diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusterUpdate.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusterUpdate.java new file mode 100644 index 0000000000000..435181c8a70ea --- /dev/null +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusterUpdate.java @@ -0,0 +1,104 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An update request for an Azure SQL Database virtual cluster. + */ +@JsonFlatten +public class VirtualClusterUpdate { + /** + * Subnet resource ID for the virtual cluster. + */ + @JsonProperty(value = "properties.subnetId", access = JsonProperty.Access.WRITE_ONLY) + private String subnetId; + + /** + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "properties.family") + private String family; + + /** + * List of resources in this virtual cluster. + */ + @JsonProperty(value = "properties.childResources", access = JsonProperty.Access.WRITE_ONLY) + private List childResources; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get subnet resource ID for the virtual cluster. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Get if the service has different generations of hardware, for the same SKU, then that can be captured here. + * + * @return the family value + */ + public String family() { + return this.family; + } + + /** + * Set if the service has different generations of hardware, for the same SKU, then that can be captured here. + * + * @param family the family value to set + * @return the VirtualClusterUpdate object itself. + */ + public VirtualClusterUpdate withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get list of resources in this virtual cluster. + * + * @return the childResources value + */ + public List childResources() { + return this.childResources; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the VirtualClusterUpdate object itself. + */ + public VirtualClusterUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusters.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusters.java new file mode 100644 index 0000000000000..f440a13217241 --- /dev/null +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/VirtualClusters.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview; + +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.VirtualClustersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing VirtualClusters. + */ +public interface VirtualClusters extends SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/AdvisorInner.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/AdvisorInner.java index 2663f03294610..99309897e8da1 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/AdvisorInner.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/AdvisorInner.java @@ -18,7 +18,7 @@ import com.microsoft.azure.ProxyResource; /** - * Database, Server or Elatic Pool Advisor. + * Database, Server or Elastic Pool Advisor. */ @JsonFlatten public class AdvisorInner extends ProxyResource { @@ -53,8 +53,8 @@ public class AdvisorInner extends ProxyResource { /** * Gets the resource from which current value of auto-execute status is - * inherited. Auto-execute status can be set on (and inhertied from) - * different levels in the resource heirarchy. Possible values are + * inherited. Auto-execute status can be set on (and inherited from) + * different levels in the resource hierarchy. Possible values are * 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when * status is not explicitly set on any level). Possible values include: * 'Default', 'Subscription', 'Server', 'ElasticPool', 'Database'. @@ -132,7 +132,7 @@ public AdvisorInner withAutoExecuteStatus(AutoExecuteStatus autoExecuteStatus) { } /** - * Get gets the resource from which current value of auto-execute status is inherited. Auto-execute status can be set on (and inhertied from) different levels in the resource heirarchy. Possible values are 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when status is not explicitly set on any level). Possible values include: 'Default', 'Subscription', 'Server', 'ElasticPool', 'Database'. + * Get gets the resource from which current value of auto-execute status is inherited. Auto-execute status can be set on (and inherited from) different levels in the resource hierarchy. Possible values are 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when status is not explicitly set on any level). Possible values include: 'Default', 'Subscription', 'Server', 'ElasticPool', 'Database'. * * @return the autoExecuteStatusInheritedFrom value */ diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAdvisorsImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAdvisorsImpl.java index 03cb4d7448478..b1fa62a8e1839 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAdvisorsImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseAdvisorsImpl.java @@ -54,10 +54,14 @@ public DatabasisServerAdvisor call(AdvisorInner inner) { public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) { DatabaseAdvisorsInner client = this.inner(); return client.getAsync(resourceGroupName, serverName, databaseName, advisorName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public DatabasisServerAdvisor call(AdvisorInner inner) { - return wrapModel(inner); + public Observable call(AdvisorInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((DatabasisServerAdvisor)wrapModel(inner)); + } } }); } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesImpl.java index c55dc580dd4e1..48691e22f067a 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesImpl.java @@ -13,6 +13,7 @@ import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseBlobAuditingPolicies; import rx.Observable; import rx.functions.Func1; +import com.microsoft.azure.Page; import com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseBlobAuditingPolicy; class DatabaseBlobAuditingPoliciesImpl extends WrapperImpl implements DatabaseBlobAuditingPolicies { @@ -41,14 +42,36 @@ private DatabaseBlobAuditingPolicyImpl wrapModel(String name) { } @Override - public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { DatabaseBlobAuditingPoliciesInner client = this.inner(); - return client.getAsync(resourceGroupName, serverName, databaseName) + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) .map(new Func1() { @Override public DatabaseBlobAuditingPolicy call(DatabaseBlobAuditingPolicyInner inner) { return wrapModel(inner); } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseBlobAuditingPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1>() { + @Override + public Observable call(DatabaseBlobAuditingPolicyInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((DatabaseBlobAuditingPolicy)wrapModel(inner)); + } + } }); } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java index 9eefab8c2b2a6..915488586f7e3 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPoliciesInner.java @@ -10,12 +10,17 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator; import java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; @@ -24,6 +29,7 @@ import retrofit2.http.Path; import retrofit2.http.PUT; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -62,6 +68,14 @@ interface DatabaseBlobAuditingPoliciesService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}") Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("blobAuditingPolicyName") String blobAuditingPolicyName, @Path("subscriptionId") String subscriptionId, @Body DatabaseBlobAuditingPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseBlobAuditingPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.DatabaseBlobAuditingPolicies listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -261,4 +275,246 @@ private ServiceResponse createOrUpdateDelegate( .build(response); } + /** + * Lists auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DatabaseBlobAuditingPolicyInner> object if successful. + */ + public PagedList listByDatabase(final String resourceGroupName, final String serverName, final String databaseName) { + ServiceResponse> response = listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseBlobAuditingPolicyInner> object + */ + public Observable> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists auditing settings of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseBlobAuditingPolicyInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + return listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists auditing settings of a database. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseBlobAuditingPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists auditing settings of a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DatabaseBlobAuditingPolicyInner> object if successful. + */ + public PagedList listByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists auditing settings of a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists auditing settings of a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseBlobAuditingPolicyInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists auditing settings of a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseBlobAuditingPolicyInner> object + */ + public Observable>> listByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists auditing settings of a database. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseBlobAuditingPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyImpl.java index 2187741a9008d..b1b13c37e735f 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyImpl.java @@ -102,6 +102,11 @@ public String name() { return this.inner().name(); } + @Override + public Integer queueDelayMs() { + return this.inner().queueDelayMs(); + } + @Override public Integer retentionDays() { return this.inner().retentionDays(); @@ -164,6 +169,12 @@ public DatabaseBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isS return this; } + @Override + public DatabaseBlobAuditingPolicyImpl withQueueDelayMs(Integer queueDelayMs) { + this.inner().withQueueDelayMs(queueDelayMs); + return this; + } + @Override public DatabaseBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { this.inner().withRetentionDays(retentionDays); diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyInner.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyInner.java index 509ea501d2209..14b30466567bc 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyInner.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseBlobAuditingPolicyInner.java @@ -37,7 +37,7 @@ public class DatabaseBlobAuditingPolicyInner extends ProxyResource { /** * Specifies the blob storage endpoint (e.g. * https://MyAccount.blob.core.windows.net). If state is Enabled, - * storageEndpoint is required. + * storageEndpoint or isAzureMonitorTargetEnabled is required. */ @JsonProperty(value = "properties.storageEndpoint") private String storageEndpoint; @@ -148,8 +148,8 @@ public class DatabaseBlobAuditingPolicyInner extends ProxyResource { /** * Specifies whether audit events are sent to Azure Monitor. - * In order to send the events to Azure Monitor, specify 'State' as - * 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + * In order to send the events to Azure Monitor, specify 'state' as + * 'Enabled' and 'isAzureMonitorTargetEnabled' as true. * * When using REST API to configure auditing, Diagnostic Settings with * 'SQLSecurityAuditEvents' diagnostic logs category on the database should @@ -169,6 +169,15 @@ public class DatabaseBlobAuditingPolicyInner extends ProxyResource { @JsonProperty(value = "properties.isAzureMonitorTargetEnabled") private Boolean isAzureMonitorTargetEnabled; + /** + * Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. + * The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647. + */ + @JsonProperty(value = "properties.queueDelayMs") + private Integer queueDelayMs; + /** * Get resource kind. * @@ -199,7 +208,7 @@ public DatabaseBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) } /** - * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. * * @return the storageEndpoint value */ @@ -208,7 +217,7 @@ public String storageEndpoint() { } /** - * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. * * @param storageEndpoint the storageEndpoint value to set * @return the DatabaseBlobAuditingPolicyInner object itself. @@ -408,7 +417,7 @@ public DatabaseBlobAuditingPolicyInner withIsStorageSecondaryKeyInUse(Boolean is /** * Get specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. Note that for server level audit you should use the 'master' database as {databaseName}. Diagnostic Settings URI format: @@ -424,7 +433,7 @@ public Boolean isAzureMonitorTargetEnabled() { /** * Set specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. Note that for server level audit you should use the 'master' database as {databaseName}. Diagnostic Settings URI format: @@ -440,4 +449,26 @@ public DatabaseBlobAuditingPolicyInner withIsAzureMonitorTargetEnabled(Boolean i return this; } + /** + * Get specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. + The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value + */ + public Integer queueDelayMs() { + return this.queueDelayMs; + } + + /** + * Set specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. + The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @param queueDelayMs the queueDelayMs value to set + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withQueueDelayMs(Integer queueDelayMs) { + this.queueDelayMs = queueDelayMs; + return this; + } + } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsImpl.java index 97fa152417e0d..124de80c576f5 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/DatabaseRecommendedActionsImpl.java @@ -54,10 +54,14 @@ public RecommendedAction call(RecommendedActionInner inner) { public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String advisorName, String recommendedActionName) { DatabaseRecommendedActionsInner client = this.inner(); return client.getAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public RecommendedAction call(RecommendedActionInner inner) { - return wrapModel(inner); + public Observable call(RecommendedActionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((RecommendedAction)wrapModel(inner)); + } } }); } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorInner.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorInner.java index 34583678617e8..af6be31912e1e 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorInner.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorInner.java @@ -22,7 +22,7 @@ public class EncryptionProtectorInner extends ProxyResource { * Kind of encryption protector. This is metadata used for the Azure portal * experience. */ - @JsonProperty(value = "kind") + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) private String kind; /** @@ -71,17 +71,6 @@ public String kind() { return this.kind; } - /** - * Set kind of encryption protector. This is metadata used for the Azure portal experience. - * - * @param kind the kind value to set - * @return the EncryptionProtectorInner object itself. - */ - public EncryptionProtectorInner withKind(String kind) { - this.kind = kind; - return this; - } - /** * Get resource location. * diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsImpl.java index f181d760e89a5..25745dfae8c9c 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsImpl.java @@ -11,6 +11,7 @@ import com.microsoft.azure.arm.model.implementation.WrapperImpl; import com.microsoft.azure.management.sql.v2015_05_01_preview.EncryptionProtectors; +import rx.Completable; import rx.functions.Func1; import rx.Observable; import com.microsoft.azure.Page; @@ -28,6 +29,12 @@ public SqlManager manager() { return this.manager; } + @Override + public Completable revalidateAsync(String resourceGroupName, String serverName) { + EncryptionProtectorsInner client = this.inner(); + return client.revalidateAsync(resourceGroupName, serverName).toCompletable(); + } + @Override public Observable listByServerAsync(final String resourceGroupName, final String serverName) { EncryptionProtectorsInner client = this.inner(); diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsInner.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsInner.java index c0e1a31691d13..cfcf80065c638 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsInner.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsInner.java @@ -27,6 +27,7 @@ import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.Path; +import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Query; import retrofit2.http.Url; @@ -60,6 +61,14 @@ public EncryptionProtectorsInner(Retrofit retrofit, SqlManagementClientImpl clie * used by Retrofit to perform actually REST calls. */ interface EncryptionProtectorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.EncryptionProtectors revalidate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}/revalidate") + Observable> revalidate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("encryptionProtectorName") String encryptionProtectorName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.EncryptionProtectors beginRevalidate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}/revalidate") + Observable> beginRevalidate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("encryptionProtectorName") String encryptionProtectorName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.EncryptionProtectors listByServer" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector") Observable> listByServer(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -82,6 +91,162 @@ interface EncryptionProtectorsService { } + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void revalidate(String resourceGroupName, String serverName) { + revalidateWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().last().body(); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture revalidateAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(revalidateWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable revalidateAsync(String resourceGroupName, String serverName) { + return revalidateWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> revalidateWithServiceResponseAsync(String resourceGroupName, String serverName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String encryptionProtectorName = "current"; + Observable> observable = service.revalidate(resourceGroupName, serverName, encryptionProtectorName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginRevalidate(String resourceGroupName, String serverName) { + beginRevalidateWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginRevalidateAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRevalidateWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRevalidateAsync(String resourceGroupName, String serverName) { + return beginRevalidateWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Revalidates an existing encryption protector. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRevalidateWithServiceResponseAsync(String resourceGroupName, String serverName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String encryptionProtectorName = "current"; + return service.beginRevalidate(resourceGroupName, serverName, encryptionProtectorName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginRevalidateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRevalidateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Gets a list of server encryption protectors. * diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsImpl.java index 72a96b03d6895..1f99ae7ff9a92 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsImpl.java @@ -88,10 +88,14 @@ public FailoverGroup call(FailoverGroupInner inner) { public Observable getAsync(String resourceGroupName, String serverName, String failoverGroupName) { FailoverGroupsInner client = this.inner(); return client.getAsync(resourceGroupName, serverName, failoverGroupName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public FailoverGroup call(FailoverGroupInner inner) { - return wrapModel(inner); + public Observable call(FailoverGroupInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((FailoverGroup)wrapModel(inner)); + } } }); } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesImpl.java index 5abb90e0dbcb5..dd8203a0725e6 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesImpl.java @@ -76,10 +76,14 @@ public FirewallRule call(FirewallRuleInner inner) { public Observable getAsync(String resourceGroupName, String serverName, String firewallRuleName) { FirewallRulesInner client = this.inner(); return client.getAsync(resourceGroupName, serverName, firewallRuleName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public FirewallRule call(FirewallRuleInner inner) { - return wrapModel(inner); + public Observable call(FirewallRuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((FirewallRule)wrapModel(inner)); + } } }); } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java index 1500a0ca9852c..a8518ba8dfc7e 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java @@ -12,8 +12,12 @@ import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstance; import rx.Observable; import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstanceUpdate; +import org.joda.time.DateTime; import com.microsoft.azure.management.sql.v2015_05_01_preview.ResourceIdentity; import com.microsoft.azure.management.sql.v2015_05_01_preview.Sku; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedServerCreateMode; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstanceLicenseType; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstanceProxyOverride; import rx.functions.Func1; class ManagedInstanceImpl extends GroupableResourceCoreImpl implements ManagedInstance, ManagedInstance.Definition, ManagedInstance.Update { @@ -102,15 +106,45 @@ public ResourceIdentity identity() { } @Override - public String licenseType() { + public String instancePoolId() { + return this.inner().instancePoolId(); + } + + @Override + public ManagedInstanceLicenseType licenseType() { return this.inner().licenseType(); } + @Override + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.inner().managedInstanceCreateMode(); + } + + @Override + public ManagedInstanceProxyOverride proxyOverride() { + return this.inner().proxyOverride(); + } + + @Override + public Boolean publicDataEndpointEnabled() { + return this.inner().publicDataEndpointEnabled(); + } + + @Override + public DateTime restorePointInTime() { + return this.inner().restorePointInTime(); + } + @Override public Sku sku() { return this.inner().sku(); } + @Override + public String sourceManagedInstanceId() { + return this.inner().sourceManagedInstanceId(); + } + @Override public String state() { return this.inner().state(); @@ -126,6 +160,11 @@ public String subnetId() { return this.inner().subnetId(); } + @Override + public String timezoneId() { + return this.inner().timezoneId(); + } + @Override public Integer vCores() { return this.inner().vCores(); @@ -178,7 +217,17 @@ public ManagedInstanceImpl withDnsZonePartner(String dnsZonePartner) { } @Override - public ManagedInstanceImpl withLicenseType(String licenseType) { + public ManagedInstanceImpl withInstancePoolId(String instancePoolId) { + if (isInCreateMode()) { + this.inner().withInstancePoolId(instancePoolId); + } else { + this.updateParameter.withInstancePoolId(instancePoolId); + } + return this; + } + + @Override + public ManagedInstanceImpl withLicenseType(ManagedInstanceLicenseType licenseType) { if (isInCreateMode()) { this.inner().withLicenseType(licenseType); } else { @@ -187,6 +236,46 @@ public ManagedInstanceImpl withLicenseType(String licenseType) { return this; } + @Override + public ManagedInstanceImpl withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + if (isInCreateMode()) { + this.inner().withManagedInstanceCreateMode(managedInstanceCreateMode); + } else { + this.updateParameter.withManagedInstanceCreateMode(managedInstanceCreateMode); + } + return this; + } + + @Override + public ManagedInstanceImpl withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + if (isInCreateMode()) { + this.inner().withProxyOverride(proxyOverride); + } else { + this.updateParameter.withProxyOverride(proxyOverride); + } + return this; + } + + @Override + public ManagedInstanceImpl withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled) { + if (isInCreateMode()) { + this.inner().withPublicDataEndpointEnabled(publicDataEndpointEnabled); + } else { + this.updateParameter.withPublicDataEndpointEnabled(publicDataEndpointEnabled); + } + return this; + } + + @Override + public ManagedInstanceImpl withRestorePointInTime(DateTime restorePointInTime) { + if (isInCreateMode()) { + this.inner().withRestorePointInTime(restorePointInTime); + } else { + this.updateParameter.withRestorePointInTime(restorePointInTime); + } + return this; + } + @Override public ManagedInstanceImpl withSku(Sku sku) { if (isInCreateMode()) { @@ -197,6 +286,16 @@ public ManagedInstanceImpl withSku(Sku sku) { return this; } + @Override + public ManagedInstanceImpl withSourceManagedInstanceId(String sourceManagedInstanceId) { + if (isInCreateMode()) { + this.inner().withSourceManagedInstanceId(sourceManagedInstanceId); + } else { + this.updateParameter.withSourceManagedInstanceId(sourceManagedInstanceId); + } + return this; + } + @Override public ManagedInstanceImpl withStorageSizeInGB(Integer storageSizeInGB) { if (isInCreateMode()) { @@ -217,6 +316,16 @@ public ManagedInstanceImpl withSubnetId(String subnetId) { return this; } + @Override + public ManagedInstanceImpl withTimezoneId(String timezoneId) { + if (isInCreateMode()) { + this.inner().withTimezoneId(timezoneId); + } else { + this.updateParameter.withTimezoneId(timezoneId); + } + return this; + } + @Override public ManagedInstanceImpl withVCores(Integer vCores) { if (isInCreateMode()) { diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java index 2fc537c23f6f7..c1ce6158e5750 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java @@ -10,6 +10,10 @@ import com.microsoft.azure.management.sql.v2015_05_01_preview.ResourceIdentity; import com.microsoft.azure.management.sql.v2015_05_01_preview.Sku; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedServerCreateMode; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstanceLicenseType; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstanceProxyOverride; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.Resource; @@ -26,11 +30,24 @@ public class ManagedInstanceInner extends Resource { private ResourceIdentity identity; /** - * Managed instance sku. + * Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, + * BC_Gen4, BC_Gen5. */ @JsonProperty(value = "sku") private Sku sku; + /** + * Specifies the mode of database creation. + * + * Default: Regular instance creation. + * + * Restore: Creates an instance by restoring a set of backups to specific + * point in time. RestorePointInTime and SourceManagedInstanceId must be + * specified. Possible values include: 'Default', 'PointInTimeRestore'. + */ + @JsonProperty(value = "properties.managedInstanceCreateMode") + private ManagedServerCreateMode managedInstanceCreateMode; + /** * The fully qualified domain name of the managed instance. */ @@ -65,19 +82,23 @@ public class ManagedInstanceInner extends Resource { private String state; /** - * The license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * The license type. Possible values are 'LicenseIncluded' (regular price + * inclusive of a new SQL license) and 'BasePrice' (discounted AHB price + * for bringing your own SQL licenses). Possible values include: + * 'LicenseIncluded', 'BasePrice'. */ @JsonProperty(value = "properties.licenseType") - private String licenseType; + private ManagedInstanceLicenseType licenseType; /** - * The number of VCores. + * The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. */ @JsonProperty(value = "properties.vCores") private Integer vCores; /** - * The maximum storage size in GB. + * Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments + * of 32 GB allowed only. */ @JsonProperty(value = "properties.storageSizeInGB") private Integer storageSizeInGB; @@ -101,6 +122,55 @@ public class ManagedInstanceInner extends Resource { @JsonProperty(value = "properties.dnsZonePartner") private String dnsZonePartner; + /** + * Whether or not the public data endpoint is enabled. + */ + @JsonProperty(value = "properties.publicDataEndpointEnabled") + private Boolean publicDataEndpointEnabled; + + /** + * The resource identifier of the source managed instance associated with + * create operation of this instance. + */ + @JsonProperty(value = "properties.sourceManagedInstanceId") + private String sourceManagedInstanceId; + + /** + * Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Connection type used for connecting to the instance. Possible values + * include: 'Proxy', 'Redirect', 'Default'. + */ + @JsonProperty(value = "properties.proxyOverride") + private ManagedInstanceProxyOverride proxyOverride; + + /** + * Id of the timezone. Allowed values are timezones supported by Windows. + * Windows keeps details on supported timezones, including the id, in + * registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time + * Zones. + * You can get those registry values via SQL Server by querying SELECT name + * AS timezone_id FROM sys.time_zone_info. + * List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + * An example of valid timezone id is "Pacific Standard Time" or "W. Europe + * Standard Time". + */ + @JsonProperty(value = "properties.timezoneId") + private String timezoneId; + + /** + * The Id of the instance pool this managed server belongs to. + */ + @JsonProperty(value = "properties.instancePoolId") + private String instancePoolId; + /** * Get the Azure Active Directory identity of the managed instance. * @@ -122,7 +192,7 @@ public ManagedInstanceInner withIdentity(ResourceIdentity identity) { } /** - * Get managed instance sku. + * Get managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5. * * @return the sku value */ @@ -131,7 +201,7 @@ public Sku sku() { } /** - * Set managed instance sku. + * Set managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5. * * @param sku the sku value to set * @return the ManagedInstanceInner object itself. @@ -141,6 +211,30 @@ public ManagedInstanceInner withSku(Sku sku) { return this; } + /** + * Get specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore'. + * + * @return the managedInstanceCreateMode value + */ + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.managedInstanceCreateMode; + } + + /** + * Set specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore'. + * + * @param managedInstanceCreateMode the managedInstanceCreateMode value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + this.managedInstanceCreateMode = managedInstanceCreateMode; + return this; + } + /** * Get the fully qualified domain name of the managed instance. * @@ -220,27 +314,27 @@ public String state() { } /** - * Get the license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * Get the license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice'. * * @return the licenseType value */ - public String licenseType() { + public ManagedInstanceLicenseType licenseType() { return this.licenseType; } /** - * Set the license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * Set the license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice'. * * @param licenseType the licenseType value to set * @return the ManagedInstanceInner object itself. */ - public ManagedInstanceInner withLicenseType(String licenseType) { + public ManagedInstanceInner withLicenseType(ManagedInstanceLicenseType licenseType) { this.licenseType = licenseType; return this; } /** - * Get the number of VCores. + * Get the number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. * * @return the vCores value */ @@ -249,7 +343,7 @@ public Integer vCores() { } /** - * Set the number of VCores. + * Set the number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. * * @param vCores the vCores value to set * @return the ManagedInstanceInner object itself. @@ -260,7 +354,7 @@ public ManagedInstanceInner withVCores(Integer vCores) { } /** - * Get the maximum storage size in GB. + * Get storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. * * @return the storageSizeInGB value */ @@ -269,7 +363,7 @@ public Integer storageSizeInGB() { } /** - * Set the maximum storage size in GB. + * Set storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. * * @param storageSizeInGB the storageSizeInGB value to set * @return the ManagedInstanceInner object itself. @@ -328,4 +422,134 @@ public ManagedInstanceInner withDnsZonePartner(String dnsZonePartner) { return this; } + /** + * Get whether or not the public data endpoint is enabled. + * + * @return the publicDataEndpointEnabled value + */ + public Boolean publicDataEndpointEnabled() { + return this.publicDataEndpointEnabled; + } + + /** + * Set whether or not the public data endpoint is enabled. + * + * @param publicDataEndpointEnabled the publicDataEndpointEnabled value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled) { + this.publicDataEndpointEnabled = publicDataEndpointEnabled; + return this; + } + + /** + * Get the resource identifier of the source managed instance associated with create operation of this instance. + * + * @return the sourceManagedInstanceId value + */ + public String sourceManagedInstanceId() { + return this.sourceManagedInstanceId; + } + + /** + * Set the resource identifier of the source managed instance associated with create operation of this instance. + * + * @param sourceManagedInstanceId the sourceManagedInstanceId value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSourceManagedInstanceId(String sourceManagedInstanceId) { + this.sourceManagedInstanceId = sourceManagedInstanceId; + return this; + } + + /** + * Get specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default'. + * + * @return the proxyOverride value + */ + public ManagedInstanceProxyOverride proxyOverride() { + return this.proxyOverride; + } + + /** + * Set connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default'. + * + * @param proxyOverride the proxyOverride value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + this.proxyOverride = proxyOverride; + return this; + } + + /** + * Get id of the timezone. Allowed values are timezones supported by Windows. + Windows keeps details on supported timezones, including the id, in registry under + KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". + * + * @return the timezoneId value + */ + public String timezoneId() { + return this.timezoneId; + } + + /** + * Set id of the timezone. Allowed values are timezones supported by Windows. + Windows keeps details on supported timezones, including the id, in registry under + KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". + * + * @param timezoneId the timezoneId value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withTimezoneId(String timezoneId) { + this.timezoneId = timezoneId; + return this; + } + + /** + * Get the Id of the instance pool this managed server belongs to. + * + * @return the instancePoolId value + */ + public String instancePoolId() { + return this.instancePoolId; + } + + /** + * Set the Id of the instance pool this managed server belongs to. + * + * @param instancePoolId the instancePoolId value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withInstancePoolId(String instancePoolId) { + this.instancePoolId = instancePoolId; + return this; + } + } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java index 2ecb94ce48b0f..4118fa516c9cb 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java @@ -66,10 +66,6 @@ public ManagedInstancesInner(Retrofit retrofit, SqlManagementClientImpl client) * used by Retrofit to perform actually REST calls. */ interface ManagedInstancesService { - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances list" }) - @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances") - Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances listByResourceGroup" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances") Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -102,121 +98,18 @@ interface ManagedInstancesService { @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}") Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances listNext" }) - @GET - Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances listByResourceGroupNext" }) @GET Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - } - - /** - * Gets a list of all managed instances in the subscription. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PagedList<ManagedInstanceInner> object if successful. - */ - public PagedList list() { - ServiceResponse> response = listSinglePageAsync().toBlocking().single(); - return new PagedList(response.body()) { - @Override - public Page nextPage(String nextPageLink) { - return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); - } - }; - } - - /** - * Gets a list of all managed instances in the subscription. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { - return AzureServiceFuture.fromPageResponse( - listSinglePageAsync(), - new Func1>>>() { - @Override - public Observable>> call(String nextPageLink) { - return listNextSinglePageAsync(nextPageLink); - } - }, - serviceCallback); - } - - /** - * Gets a list of all managed instances in the subscription. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<ManagedInstanceInner> object - */ - public Observable> listAsync() { - return listWithServiceResponseAsync() - .map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - return response.body(); - } - }); - } - - /** - * Gets a list of all managed instances in the subscription. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<ManagedInstanceInner> object - */ - public Observable>> listWithServiceResponseAsync() { - return listSinglePageAsync() - .concatMap(new Func1>, Observable>>>() { - @Override - public Observable>> call(ServiceResponse> page) { - String nextPageLink = page.body().nextPageLink(); - if (nextPageLink == null) { - return Observable.just(page); - } - return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); - } - }); - } - - /** - * Gets a list of all managed instances in the subscription. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. - */ - public Observable>> listSinglePageAsync() { - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) - .build(response); } /** @@ -923,14 +816,13 @@ private ServiceResponse beginUpdateDelegate(Response listNext(final String nextPageLink) { - ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { @@ -942,15 +834,13 @@ public Page nextPage(String nextPageLink) { /** * Gets a list of all managed instances in the subscription. * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param serviceFuture the ServiceFuture object tracking the Retrofit calls * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listNextSinglePageAsync(nextPageLink), + listSinglePageAsync(), new Func1>>>() { @Override public Observable>> call(String nextPageLink) { @@ -963,12 +853,11 @@ public Observable>> call(String nextP /** * Gets a list of all managed instances in the subscription. * - * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ManagedInstanceInner> object */ - public Observable> listNextAsync(final String nextPageLink) { - return listNextWithServiceResponseAsync(nextPageLink) + public Observable> listAsync() { + return listWithServiceResponseAsync() .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -980,12 +869,11 @@ public Page call(ServiceResponse>> listNextWithServiceResponseAsync(final String nextPageLink) { - return listNextSinglePageAsync(nextPageLink) + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { @@ -1001,21 +889,22 @@ public Observable>> call(ServiceRespo /** * Gets a list of all managed instances in the subscription. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listNextSinglePageAsync(final String nextPageLink) { - if (nextPageLink == null) { - throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - String nextUrl = String.format("%s", nextPageLink); - return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1024,7 +913,7 @@ public Observable>> call(Response> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) @@ -1142,4 +1031,115 @@ private ServiceResponse> listByResourceGroupNextD .build(response); } + /** + * Gets a list of all managed instances in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of all managed instances in the subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsImpl.java index 1dcd0dbf395ae..93b31417e04af 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerAdvisorsImpl.java @@ -54,10 +54,14 @@ public ServerAdvisor call(AdvisorInner inner) { public Observable getAsync(String resourceGroupName, String serverName, String advisorName) { ServerAdvisorsInner client = this.inner(); return client.getAsync(resourceGroupName, serverName, advisorName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public ServerAdvisor call(AdvisorInner inner) { - return wrapModel(inner); + public Observable call(AdvisorInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ServerAdvisor)wrapModel(inner)); + } } }); } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysImpl.java index 1a786d771606a..e3c9dfc9c2776 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysImpl.java @@ -64,10 +64,14 @@ public ServerKey call(ServerKeyInner inner) { public Observable getAsync(String resourceGroupName, String serverName, String keyName) { ServerKeysInner client = this.inner(); return client.getAsync(resourceGroupName, serverName, keyName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public ServerKey call(ServerKeyInner inner) { - return wrapModel(inner); + public Observable call(ServerKeyInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ServerKey)wrapModel(inner)); + } } }); } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManagementClientImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManagementClientImpl.java index b590471e7ff52..507e7b7b6e1a1 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManagementClientImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManagementClientImpl.java @@ -340,6 +340,19 @@ public SubscriptionUsagesInner subscriptionUsages() { return this.subscriptionUsages; } + /** + * The VirtualClustersInner object to access its operations. + */ + private VirtualClustersInner virtualClusters; + + /** + * Gets the VirtualClustersInner object to access its operations. + * @return the VirtualClustersInner object. + */ + public VirtualClustersInner virtualClusters() { + return this.virtualClusters; + } + /** * The VirtualNetworkRulesInner object to access its operations. */ @@ -404,6 +417,7 @@ protected void initialize() { this.syncGroups = new SyncGroupsInner(restClient().retrofit(), this); this.syncMembers = new SyncMembersInner(restClient().retrofit(), this); this.subscriptionUsages = new SubscriptionUsagesInner(restClient().retrofit(), this); + this.virtualClusters = new VirtualClustersInner(restClient().retrofit(), this); this.virtualNetworkRules = new VirtualNetworkRulesInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManager.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManager.java index 7fa51ffb32511..04f21c8a2b56b 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManager.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SqlManager.java @@ -32,6 +32,7 @@ import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncGroups; import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMembers; import com.microsoft.azure.management.sql.v2015_05_01_preview.SubscriptionUsages; +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusters; import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualNetworkRules; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -56,6 +57,7 @@ public final class SqlManager extends ManagerCore getSubscriptionUsageInnerUsingSubscri public Observable getAsync(String locationName, String usageName) { SubscriptionUsagesInner client = this.inner(); return client.getAsync(locationName, usageName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public SubscriptionUsage call(SubscriptionUsageInner inner) { - return wrapSubscriptionUsageModel(inner); + public Observable call(SubscriptionUsageInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SubscriptionUsage)wrapSubscriptionUsageModel(inner)); + } } }); } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsImpl.java index c3d7963df52ae..231566b2cd3ba 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsImpl.java @@ -78,10 +78,14 @@ public SyncAgent call(SyncAgentInner inner) { public Observable getAsync(String resourceGroupName, String serverName, String syncAgentName) { SyncAgentsInner client = this.inner(); return client.getAsync(resourceGroupName, serverName, syncAgentName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public SyncAgent call(SyncAgentInner inner) { - return wrapModel(inner); + public Observable call(SyncAgentInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SyncAgent)wrapModel(inner)); + } } }); } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsImpl.java index e9f0237332594..7c172d0f25910 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsImpl.java @@ -85,10 +85,14 @@ public SyncGroup call(SyncGroupInner inner) { public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { SyncGroupsInner client = this.inner(); return client.getAsync(resourceGroupName, serverName, databaseName, syncGroupName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public SyncGroup call(SyncGroupInner inner) { - return wrapModel(inner); + public Observable call(SyncGroupInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SyncGroup)wrapModel(inner)); + } } }); } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersImpl.java index 03f240e06b4d0..26c8685668ccd 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersImpl.java @@ -71,10 +71,14 @@ public SyncMember call(SyncMemberInner inner) { public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { SyncMembersInner client = this.inner(); return client.getAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public SyncMember call(SyncMemberInner inner) { - return wrapModel(inner); + public Observable call(SyncMemberInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SyncMember)wrapModel(inner)); + } } }); } diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClusterImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClusterImpl.java new file mode 100644 index 0000000000000..426e895cf6f7a --- /dev/null +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClusterImpl.java @@ -0,0 +1,81 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualCluster; +import rx.Observable; +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusterUpdate; +import java.util.List; +import rx.functions.Func1; + +class VirtualClusterImpl extends GroupableResourceCoreImpl implements VirtualCluster, VirtualCluster.Update { + private VirtualClusterUpdate updateParameter; + VirtualClusterImpl(String name, VirtualClusterInner inner, SqlManager manager) { + super(name, inner, manager); + this.updateParameter = new VirtualClusterUpdate(); + } + + @Override + public Observable createResourceAsync() { + VirtualClustersInner client = this.manager().inner().virtualClusters(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + VirtualClustersInner client = this.manager().inner().virtualClusters(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public VirtualClusterInner call(VirtualClusterInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + VirtualClustersInner client = this.manager().inner().virtualClusters(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new VirtualClusterUpdate(); + } + + @Override + public List childResources() { + return this.inner().childResources(); + } + + @Override + public String family() { + return this.inner().family(); + } + + @Override + public String subnetId() { + return this.inner().subnetId(); + } + + @Override + public VirtualClusterImpl withFamily(String family) { + this.updateParameter.withFamily(family); + return this; + } + +} diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClusterInner.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClusterInner.java new file mode 100644 index 0000000000000..169c61cbd7a60 --- /dev/null +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClusterInner.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An Azure SQL virtual cluster. + */ +@JsonFlatten +public class VirtualClusterInner extends Resource { + /** + * Subnet resource ID for the virtual cluster. + */ + @JsonProperty(value = "properties.subnetId", access = JsonProperty.Access.WRITE_ONLY) + private String subnetId; + + /** + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "properties.family") + private String family; + + /** + * List of resources in this virtual cluster. + */ + @JsonProperty(value = "properties.childResources", access = JsonProperty.Access.WRITE_ONLY) + private List childResources; + + /** + * Get subnet resource ID for the virtual cluster. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Get if the service has different generations of hardware, for the same SKU, then that can be captured here. + * + * @return the family value + */ + public String family() { + return this.family; + } + + /** + * Set if the service has different generations of hardware, for the same SKU, then that can be captured here. + * + * @param family the family value to set + * @return the VirtualClusterInner object itself. + */ + public VirtualClusterInner withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get list of resources in this virtual cluster. + * + * @return the childResources value + */ + public List childResources() { + return this.childResources; + } + +} diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersImpl.java new file mode 100644 index 0000000000000..3ae24cca47468 --- /dev/null +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersImpl.java @@ -0,0 +1,133 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusters; +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualCluster; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class VirtualClustersImpl extends GroupableResourcesCoreImpl implements VirtualClusters { + protected VirtualClustersImpl(SqlManager manager) { + super(manager.inner().virtualClusters(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + VirtualClustersInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + VirtualClustersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + VirtualClustersInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + VirtualClustersInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public VirtualCluster call(VirtualClusterInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + VirtualClustersInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + VirtualClustersInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public VirtualCluster call(VirtualClusterInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + protected VirtualClusterImpl wrapModel(VirtualClusterInner inner) { + return new VirtualClusterImpl(inner.name(), inner, manager()); + } + + @Override + protected VirtualClusterImpl wrapModel(String name) { + return null; // Model is not creatable + } + +} diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersInner.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersInner.java new file mode 100644 index 0000000000000..609b331f3085b --- /dev/null +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualClustersInner.java @@ -0,0 +1,963 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusterUpdate; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in VirtualClusters. + */ +public class VirtualClustersInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private VirtualClustersService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of VirtualClustersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public VirtualClustersInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(VirtualClustersService.class); + this.client = client; + } + + /** + * The interface defining all the services for VirtualClusters to be + * used by Retrofit to perform actually REST calls. + */ + interface VirtualClustersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusters list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusters listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusters getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("virtualClusterName") String virtualClusterName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusters delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("virtualClusterName") String virtualClusterName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusters beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("virtualClusterName") String virtualClusterName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusters update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("virtualClusterName") String virtualClusterName, @Path("subscriptionId") String subscriptionId, @Body VirtualClusterUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusters beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters/{virtualClusterName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("virtualClusterName") String virtualClusterName, @Path("subscriptionId") String subscriptionId, @Body VirtualClusterUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusters listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.VirtualClusters listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VirtualClusterInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualClusterInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualClusterInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VirtualClusterInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualClusterInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualClusterInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of virtual clusters in a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VirtualClusterInner object if successful. + */ + public VirtualClusterInner getByResourceGroup(String resourceGroupName, String virtualClusterName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualClusterName).toBlocking().single().body(); + } + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String virtualClusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualClusterName), serviceCallback); + } + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualClusterInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String virtualClusterName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualClusterName).map(new Func1, VirtualClusterInner>() { + @Override + public VirtualClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualClusterInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String virtualClusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualClusterName == null) { + throw new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, virtualClusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String virtualClusterName) { + deleteWithServiceResponseAsync(resourceGroupName, virtualClusterName).toBlocking().last().body(); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String virtualClusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, virtualClusterName), serviceCallback); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String virtualClusterName) { + return deleteWithServiceResponseAsync(resourceGroupName, virtualClusterName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String virtualClusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualClusterName == null) { + throw new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, virtualClusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String virtualClusterName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, virtualClusterName).toBlocking().single().body(); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String virtualClusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, virtualClusterName), serviceCallback); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String virtualClusterName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, virtualClusterName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String virtualClusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualClusterName == null) { + throw new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, virtualClusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VirtualClusterInner object if successful. + */ + public VirtualClusterInner update(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, virtualClusterName, parameters).toBlocking().last().body(); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, virtualClusterName, parameters), serviceCallback); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, virtualClusterName, parameters).map(new Func1, VirtualClusterInner>() { + @Override + public VirtualClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualClusterName == null) { + throw new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.update(resourceGroupName, virtualClusterName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VirtualClusterInner object if successful. + */ + public VirtualClusterInner beginUpdate(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, virtualClusterName, parameters).toBlocking().single().body(); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, virtualClusterName, parameters), serviceCallback); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualClusterInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, virtualClusterName, parameters).map(new Func1, VirtualClusterInner>() { + @Override + public VirtualClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a virtual cluster. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param virtualClusterName The name of the virtual cluster. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualClusterInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualClusterName == null) { + throw new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(resourceGroupName, virtualClusterName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VirtualClusterInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualClusterInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualClusterInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VirtualClusterInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualClusterInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of virtual clusters in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualClusterInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of virtual clusters in a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRulesImpl.java b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRulesImpl.java index c21ddff53626d..84116eeeea5cf 100644 --- a/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRulesImpl.java +++ b/sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/VirtualNetworkRulesImpl.java @@ -64,10 +64,14 @@ public VirtualNetworkRule call(VirtualNetworkRuleInner inner) { public Observable getAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { VirtualNetworkRulesInner client = this.inner(); return client.getAsync(resourceGroupName, serverName, virtualNetworkRuleName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public VirtualNetworkRule call(VirtualNetworkRuleInner inner) { - return wrapModel(inner); + public Observable call(VirtualNetworkRuleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((VirtualNetworkRule)wrapModel(inner)); + } } }); }