diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseEdition.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseEdition.java index 63a8ddfef7e6c..79973ae0116bf 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseEdition.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseEdition.java @@ -49,6 +49,15 @@ public final class DatabaseEdition extends ExpandableStringEnum /** Static value System2 for DatabaseEdition. */ public static final DatabaseEdition SYSTEM2 = fromString("System2"); + /** Static value GeneralPurpose for DatabaseEdition. */ + public static final DatabaseEdition GENERAL_PURPOSE = fromString("GeneralPurpose"); + + /** Static value BusinessCritical for DatabaseEdition. */ + public static final DatabaseEdition BUSINESS_CRITICAL = fromString("BusinessCritical"); + + /** Static value Hyperscale for DatabaseEdition. */ + public static final DatabaseEdition HYPERSCALE = fromString("Hyperscale"); + /** * Creates or finds a DatabaseEdition from its string representation. * @param name a name to look for diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUpdate.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUpdate.java index 2600459243381..c1fb545cd92e9 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUpdate.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUpdate.java @@ -152,14 +152,23 @@ public class DatabaseUpdate extends ProxyResource { /** * The edition of the database. The DatabaseEditions enumeration contains * all the valid editions. If createMode is NonReadableSecondary or - * OnlineSecondary, this value is ignored. To see possible values, query - * the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." or use the - * Azure CLI command `az sql db list-editions -l westus --query [].name`. - * Possible values include: 'Web', 'Business', 'Basic', 'Standard', + * OnlineSecondary, this value is ignored. + * + * The list of SKUs may vary by region and support offer. To determine the + * SKUs (including the SKU name, tier/edition, family, and capacity) that + * are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or one of the following commands: + * + * ```azurecli + * az sql db list-editions -l <location> -o table + * ```` + * + * ```powershell + * Get-AzSqlServerServiceObjective -Location <location> + * ```` + * . Possible values include: 'Web', 'Business', 'Basic', 'Standard', * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', - * 'System2'. + * 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale'. */ @JsonProperty(value = "properties.edition") private DatabaseEdition edition; @@ -181,12 +190,11 @@ public class DatabaseUpdate extends ProxyResource { * currentServiceObjectiveId property. If requestedServiceObjectiveId and * requestedServiceObjectiveName are both updated, the value of * requestedServiceObjectiveId overrides the value of - * requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." or use the - * Azure CLI command `az sql db list-editions --location <location> - * --query [].supportedServiceLevelObjectives[].name` . + * requestedServiceObjectiveName. + * + * The list of SKUs may vary by region and support offer. To determine the + * service objective ids that are available to your subscription in an + * Azure region, use the `Capabilities_ListByLocation` REST API. */ @JsonProperty(value = "properties.requestedServiceObjectiveId") private UUID requestedServiceObjectiveId; @@ -195,21 +203,29 @@ public class DatabaseUpdate extends ProxyResource { * The name of the configured service level objective of the database. This * is the service level objective that is in the process of being applied * to the database. Once successfully updated, it will match the value of - * serviceLevelObjective property. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." or use the - * Azure CLI command `az sql db list-editions --location <location> - * --query [].supportedServiceLevelObjectives[].name`. Possible values - * include: 'System', 'System0', 'System1', 'System2', 'System3', - * 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', - * 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', - * 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', - * 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', - * 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', - * 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', - * 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', - * 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * serviceLevelObjective property. + * + * The list of SKUs may vary by region and support offer. To determine the + * SKUs (including the SKU name, tier/edition, family, and capacity) that + * are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or one of the following commands: + * + * ```azurecli + * az sql db list-editions -l <location> -o table + * ```` + * + * ```powershell + * Get-AzSqlServerServiceObjective -Location <location> + * ```` + * . Possible values include: 'System', 'System0', 'System1', 'System2', + * 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', + * 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', + * 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', + * 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', + * 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', + * 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', + * 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', + * 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. */ @JsonProperty(value = "properties.requestedServiceObjectiveName") private ServiceObjectiveName requestedServiceObjectiveName; @@ -501,7 +517,15 @@ public DatabaseUpdate withRecoveryServicesRecoveryPointResourceId(String recover } /** - * Get the edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions -l westus --query [].name`. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * Get the edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. + The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: + ```azurecli + az sql db list-editions -l <location> -o table + ```` + ```powershell + Get-AzSqlServerServiceObjective -Location <location> + ```` + . Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale'. * * @return the edition value */ @@ -510,7 +534,15 @@ public DatabaseEdition edition() { } /** - * Set the edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions -l westus --query [].name`. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * Set the edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. + The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: + ```azurecli + az sql db list-editions -l <location> -o table + ```` + ```powershell + Get-AzSqlServerServiceObjective -Location <location> + ```` + . Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale'. * * @param edition the edition value to set * @return the DatabaseUpdate object itself. @@ -541,7 +573,8 @@ public DatabaseUpdate withMaxSizeBytes(String maxSizeBytes) { } /** - * Get the configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name` . + * Get the configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. + The list of SKUs may vary by region and support offer. To determine the service objective ids that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API. * * @return the requestedServiceObjectiveId value */ @@ -550,7 +583,8 @@ public UUID requestedServiceObjectiveId() { } /** - * Set the configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name` . + * Set the configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. + The list of SKUs may vary by region and support offer. To determine the service objective ids that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API. * * @param requestedServiceObjectiveId the requestedServiceObjectiveId value to set * @return the DatabaseUpdate object itself. @@ -561,7 +595,15 @@ public DatabaseUpdate withRequestedServiceObjectiveId(UUID requestedServiceObjec } /** - * Get the name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name`. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * Get the name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. + The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: + ```azurecli + az sql db list-editions -l <location> -o table + ```` + ```powershell + Get-AzSqlServerServiceObjective -Location <location> + ```` + . Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. * * @return the requestedServiceObjectiveName value */ @@ -570,7 +612,15 @@ public ServiceObjectiveName requestedServiceObjectiveName() { } /** - * Set the name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name`. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * Set the name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. + The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: + ```azurecli + az sql db list-editions -l <location> -o table + ```` + ```powershell + Get-AzSqlServerServiceObjective -Location <location> + ```` + . Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. * * @param requestedServiceObjectiveName the requestedServiceObjectiveName value to set * @return the DatabaseUpdate object itself. diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEdition.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEdition.java index 842f33fc97867..f5d47601dfbe4 100644 --- a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEdition.java +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEdition.java @@ -25,6 +25,12 @@ public final class ElasticPoolEdition extends ExpandableStringEnum metrics; /** - * Get the edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. Possible values include: 'Basic', 'Standard', 'Premium'. + * Get the edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. Possible values include: 'Basic', 'Standard', 'Premium', 'GeneralPurpose', 'BusinessCritical'. * * @return the databaseEdition value */ diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseStatus.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseStatus.java index 9f978f320c7d2..3fb2f98287b23 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseStatus.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseStatus.java @@ -70,6 +70,12 @@ public final class DatabaseStatus extends ExpandableStringEnum { /** Static value Scaling for DatabaseStatus. */ public static final DatabaseStatus SCALING = fromString("Scaling"); + /** Static value OfflineChangingDwPerformanceTiers for DatabaseStatus. */ + public static final DatabaseStatus OFFLINE_CHANGING_DW_PERFORMANCE_TIERS = fromString("OfflineChangingDwPerformanceTiers"); + + /** Static value OnlineChangingDwPerformanceTiers for DatabaseStatus. */ + public static final DatabaseStatus ONLINE_CHANGING_DW_PERFORMANCE_TIERS = fromString("OnlineChangingDwPerformanceTiers"); + /** * Creates or finds a DatabaseStatus from its string representation. * @param name a name to look for diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseUpdate.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseUpdate.java index 42b1e825cc953..ac090462a514b 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseUpdate.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseUpdate.java @@ -106,7 +106,8 @@ public class DatabaseUpdate { * 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', * 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', * 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', - * 'Resuming', 'Scaling'. + * 'Resuming', 'Scaling', 'OfflineChangingDwPerformanceTiers', + * 'OnlineChangingDwPerformanceTiers'. */ @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) private DatabaseStatus status; @@ -414,7 +415,7 @@ public DatabaseUpdate withSourceDatabaseId(String sourceDatabaseId) { } /** - * Get the status of the database. Possible values include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling'. + * Get the status of the database. Possible values include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling', 'OfflineChangingDwPerformanceTiers', 'OnlineChangingDwPerformanceTiers'. * * @return the status value */ diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseInner.java index 7d9760d8e79c8..d9598a5835824 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseInner.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseInner.java @@ -27,7 +27,20 @@ @JsonFlatten public class DatabaseInner extends Resource { /** - * The name and tier of the SKU. + * The database SKU. + * + * The list of SKUs may vary by region and support offer. To determine the + * SKUs (including the SKU name, tier/edition, family, and capacity) that + * are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or one of the following commands: + * + * ```azurecli + * az sql db list-editions -l <location> -o table + * ```` + * + * ```powershell + * Get-AzSqlServerServiceObjective -Location <location> + * ````. */ @JsonProperty(value = "sku") private Sku sku; @@ -125,7 +138,8 @@ public class DatabaseInner extends Resource { * 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', * 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', * 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', - * 'Resuming', 'Scaling'. + * 'Resuming', 'Scaling', 'OfflineChangingDwPerformanceTiers', + * 'OnlineChangingDwPerformanceTiers'. */ @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) private DatabaseStatus status; @@ -271,7 +285,14 @@ public class DatabaseInner extends Resource { private Double minCapacity; /** - * Get the name and tier of the SKU. + * Get the database SKU. + The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: + ```azurecli + az sql db list-editions -l <location> -o table + ```` + ```powershell + Get-AzSqlServerServiceObjective -Location <location> + ````. * * @return the sku value */ @@ -280,7 +301,14 @@ public Sku sku() { } /** - * Set the name and tier of the SKU. + * Set the database SKU. + The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: + ```azurecli + az sql db list-editions -l <location> -o table + ```` + ```powershell + Get-AzSqlServerServiceObjective -Location <location> + ````. * * @param sku the sku value to set * @return the DatabaseInner object itself. @@ -445,7 +473,7 @@ public DatabaseInner withSourceDatabaseId(String sourceDatabaseId) { } /** - * Get the status of the database. Possible values include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling'. + * Get the status of the database. Possible values include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling', 'OfflineChangingDwPerformanceTiers', 'OnlineChangingDwPerformanceTiers'. * * @return the status value */ diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolInner.java index e7e1135945e93..d5a449ff60bd5 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolInner.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolInner.java @@ -23,7 +23,16 @@ @JsonFlatten public class ElasticPoolInner extends Resource { /** - * The sku property. + * The elastic pool SKU. + * + * The list of SKUs may vary by region and support offer. To determine the + * SKUs (including the SKU name, tier/edition, family, and capacity) that + * are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or the following command: + * + * ```azurecli + * az sql elastic-pool list-editions -l <location> -o table + * ````. */ @JsonProperty(value = "sku") private Sku sku; @@ -76,7 +85,11 @@ public class ElasticPoolInner extends Resource { private ElasticPoolLicenseType licenseType; /** - * Get the sku value. + * Get the elastic pool SKU. + The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or the following command: + ```azurecli + az sql elastic-pool list-editions -l <location> -o table + ````. * * @return the sku value */ @@ -85,7 +98,11 @@ public Sku sku() { } /** - * Set the sku value. + * Set the elastic pool SKU. + The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or the following command: + ```azurecli + az sql elastic-pool list-editions -l <location> -o table + ````. * * @param sku the sku value to set * @return the ElasticPoolInner object itself. diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePool.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePool.java new file mode 100644 index 0000000000000..10e4fce81c151 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePool.java @@ -0,0 +1,138 @@ +/** + * 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.v2018_06_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.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.InstancePoolInner; + +/** + * Type representing InstancePool. + */ +public interface InstancePool extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the licenseType value. + */ + InstancePoolLicenseType licenseType(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the subnetId value. + */ + String subnetId(); + + /** + * @return the vCores value. + */ + int vCores(); + + /** + * The entirety of the InstancePool definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithLicenseType, DefinitionStages.WithSubnetId, DefinitionStages.WithVCores, DefinitionStages.WithCreate { + } + + /** + * Grouping of InstancePool definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a InstancePool definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the InstancePool definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the instancepool definition allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + WithSubnetId withLicenseType(InstancePoolLicenseType licenseType); + } + + /** + * The stage of the instancepool definition allowing to specify SubnetId. + */ + interface WithSubnetId { + /** + * Specifies subnetId. + */ + WithVCores withSubnetId(String subnetId); + } + + /** + * The stage of the instancepool definition allowing to specify VCores. + */ + interface WithVCores { + /** + * Specifies vCores. + */ + WithCreate withVCores(int vCores); + } + + /** + * The stage of the instancepool update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * 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.WithSku { + } + } + /** + * The template for a InstancePool update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithSku { + } + + /** + * Grouping of InstancePool update stages. + */ + interface UpdateStages { + /** + * The stage of the instancepool {0} allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + Update withSku(Sku sku); + } + + } +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePoolLicenseType.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePoolLicenseType.java new file mode 100644 index 0000000000000..e60936bc2c522 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePoolLicenseType.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.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for InstancePoolLicenseType. + */ +public final class InstancePoolLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for InstancePoolLicenseType. */ + public static final InstancePoolLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for InstancePoolLicenseType. */ + public static final InstancePoolLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a InstancePoolLicenseType from its string representation. + * @param name a name to look for + * @return the corresponding InstancePoolLicenseType + */ + @JsonCreator + public static InstancePoolLicenseType fromString(String name) { + return fromString(name, InstancePoolLicenseType.class); + } + + /** + * @return known InstancePoolLicenseType values + */ + public static Collection values() { + return values(InstancePoolLicenseType.class); + } +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePoolUpdate.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePoolUpdate.java new file mode 100644 index 0000000000000..6b5ca0c0f12d2 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePoolUpdate.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.v2018_06_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An update to an Instance pool. + */ +public class InstancePoolUpdate { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * 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 InstancePoolUpdate object itself. + */ + public InstancePoolUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePools.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePools.java new file mode 100644 index 0000000000000..1b5d82f79ac12 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/InstancePools.java @@ -0,0 +1,25 @@ +/** + * 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.v2018_06_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +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.v2018_06_01_preview.implementation.InstancePoolsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing InstancePools. + */ +public interface InstancePools extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Name.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Name.java new file mode 100644 index 0000000000000..84e216d07f39a --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Name.java @@ -0,0 +1,69 @@ +/** + * 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.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * ARM Usage Name. + */ +public class Name { + /** + * Usage name value. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Usage name localized value. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** + * Get usage name value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set usage name value. + * + * @param value the value value to set + * @return the Name object itself. + */ + public Name withValue(String value) { + this.value = value; + return this; + } + + /** + * Get usage name localized value. + * + * @return the localizedValue value + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set usage name localized value. + * + * @param localizedValue the localizedValue value to set + * @return the Name object itself. + */ + public Name withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Sku.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Sku.java new file mode 100644 index 0000000000000..8513753cb5cd7 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Sku.java @@ -0,0 +1,152 @@ +/** + * 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.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource model definition representing SKU. + */ +public class Sku { + /** + * The name of the SKU. Ex - P3. It is typically a letter+number code. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * This field is required to be implemented by the Resource Provider if the + * service has more than one tier, but is not required on a PUT. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * The SKU size. When the name field is the combination of tier and some + * other value, this would be the standalone code. + */ + @JsonProperty(value = "size") + private String size; + + /** + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /** + * If the SKU supports scale out/in then the capacity integer should be + * included. If scale out/in is not possible for the resource this may be + * omitted. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @return the tier value + */ + public String tier() { + return this.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. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @return the size value + */ + public String size() { + return this.size; + } + + /** + * Set the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @param size the size value to set + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get 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 Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * 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. + * + * @return the capacity value + */ + public Integer capacity() { + return this.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. + * + * @param capacity the capacity value to set + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Usage.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Usage.java new file mode 100644 index 0000000000000..7516b2e6969de --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Usage.java @@ -0,0 +1,55 @@ +/** + * 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.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.UsageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.SqlManager; + +/** + * Type representing Usage. + */ +public interface Usage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Integer currentValue(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the limit value. + */ + Integer limit(); + + /** + * @return the name value. + */ + Name name(); + + /** + * @return the requestedLimit value. + */ + Integer requestedLimit(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the unit value. + */ + String unit(); + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Usages.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Usages.java new file mode 100644 index 0000000000000..151a067572bf0 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/Usages.java @@ -0,0 +1,29 @@ +/** + * 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.v2018_06_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.implementation.UsagesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Usages. + */ +public interface Usages extends HasInner { + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName); + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolImpl.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolImpl.java new file mode 100644 index 0000000000000..a6ded2aa863a6 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolImpl.java @@ -0,0 +1,92 @@ +/** + * 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.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePool; +import rx.Observable; +import com.microsoft.azure.management.sql.v2018_06_01_preview.Sku; +import com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePoolLicenseType; + +class InstancePoolImpl extends GroupableResourceCoreImpl implements InstancePool, InstancePool.Definition, InstancePool.Update { + InstancePoolImpl(String name, InstancePoolInner inner, SqlManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + InstancePoolsInner client = this.manager().inner().instancePools(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + InstancePoolsInner client = this.manager().inner().instancePools(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + InstancePoolsInner client = this.manager().inner().instancePools(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public InstancePoolLicenseType licenseType() { + return this.inner().licenseType(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public String subnetId() { + return this.inner().subnetId(); + } + + @Override + public int vCores() { + return this.inner().vCores(); + } + + @Override + public InstancePoolImpl withLicenseType(InstancePoolLicenseType licenseType) { + this.inner().withLicenseType(licenseType); + return this; + } + + @Override + public InstancePoolImpl withSubnetId(String subnetId) { + this.inner().withSubnetId(subnetId); + return this; + } + + @Override + public InstancePoolImpl withVCores(int vCores) { + this.inner().withVCores(vCores); + return this; + } + + @Override + public InstancePoolImpl withSku(Sku sku) { + this.inner().withSku(sku); + return this; + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolInner.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolInner.java new file mode 100644 index 0000000000000..f231e9b422430 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolInner.java @@ -0,0 +1,128 @@ +/** + * 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.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.Sku; +import com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePoolLicenseType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An Azure SQL instance pool. + */ +@JsonFlatten +public class InstancePoolInner extends Resource { + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Resource ID of the subnet to place this instance pool in. + */ + @JsonProperty(value = "properties.subnetId", required = true) + private String subnetId; + + /** + * Count of vCores belonging to this instance pool. + */ + @JsonProperty(value = "properties.vCores", required = true) + private int vCores; + + /** + * The license type. Possible values are 'LicenseIncluded' (price for SQL + * license is included) and 'BasePrice' (without SQL license price). + * Possible values include: 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType", required = true) + private InstancePoolLicenseType licenseType; + + /** + * Get the name and tier of the SKU. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the name and tier of the SKU. + * + * @param sku the sku value to set + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get resource ID of the subnet to place this instance pool in. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set resource ID of the subnet to place this instance pool in. + * + * @param subnetId the subnetId value to set + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get count of vCores belonging to this instance pool. + * + * @return the vCores value + */ + public int vCores() { + return this.vCores; + } + + /** + * Set count of vCores belonging to this instance pool. + * + * @param vCores the vCores value to set + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withVCores(int vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public InstancePoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withLicenseType(InstancePoolLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolsImpl.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolsImpl.java new file mode 100644 index 0000000000000..6f4c47403ce12 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolsImpl.java @@ -0,0 +1,138 @@ +/** + * 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.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools; +import com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePool; +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 InstancePoolsImpl extends GroupableResourcesCoreImpl implements InstancePools { + protected InstancePoolsImpl(SqlManager manager) { + super(manager.inner().instancePools(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + InstancePoolsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + InstancePoolsInner 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) { + InstancePoolsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + InstancePoolsInner 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 InstancePool call(InstancePoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + InstancePoolsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + InstancePoolsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InstancePool call(InstancePoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public InstancePoolImpl define(String name) { + return wrapModel(name); + } + + @Override + protected InstancePoolImpl wrapModel(InstancePoolInner inner) { + return new InstancePoolImpl(inner.name(), inner, manager()); + } + + @Override + protected InstancePoolImpl wrapModel(String name) { + return new InstancePoolImpl(name, new InstancePoolInner(), this.manager()); + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolsInner.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolsInner.java new file mode 100644 index 0000000000000..f2c2f6a468c26 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/InstancePoolsInner.java @@ -0,0 +1,1297 @@ +/** + * 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.v2018_06_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.v2018_06_01_preview.InstancePoolUpdate; +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 java.util.Map; +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.PUT; +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 InstancePools. + */ +public class InstancePoolsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private InstancePoolsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of InstancePoolsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public InstancePoolsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(InstancePoolsService.class); + this.client = client; + } + + /** + * The interface defining all the services for InstancePools to be + * used by Retrofit to perform actually REST calls. + */ + interface InstancePoolsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @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.v2018_06_01_preview.InstancePools createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @Path("subscriptionId") String subscriptionId, @Body InstancePoolInner 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.v2018_06_01_preview.InstancePools beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @Path("subscriptionId") String subscriptionId, @Body InstancePoolInner 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.v2018_06_01_preview.InstancePools delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @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.v2018_06_01_preview.InstancePools beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @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.v2018_06_01_preview.InstancePools update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body InstancePoolUpdate parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body InstancePoolUpdate parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools") + 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.v2018_06_01_preview.InstancePools list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools") + 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.v2018_06_01_preview.InstancePools listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@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.v2018_06_01_preview.InstancePools listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 InstancePoolInner object if successful. + */ + public InstancePoolInner getByResourceGroup(String resourceGroupName, String instancePoolName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, instancePoolName).toBlocking().single().body(); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param 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 instancePoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, instancePoolName), serviceCallback); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String instancePoolName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, instancePoolName).map(new Func1, InstancePoolInner>() { + @Override + public InstancePoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String instancePoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName 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, instancePoolName, 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); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 InstancePoolInner object if successful. + */ + public InstancePoolInner createOrUpdate(String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @param 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 createOrUpdateAsync(String resourceGroupName, String instancePoolName, InstancePoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, parameters), serviceCallback); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, parameters).map(new Func1, InstancePoolInner>() { + @Override + public InstancePoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName 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.createOrUpdate(resourceGroupName, instancePoolName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 InstancePoolInner object if successful. + */ + public InstancePoolInner beginCreateOrUpdate(String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @param 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 beginCreateOrUpdateAsync(String resourceGroupName, String instancePoolName, InstancePoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, parameters), serviceCallback); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, parameters).map(new Func1, InstancePoolInner>() { + @Override + public InstancePoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName 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.beginCreateOrUpdate(resourceGroupName, instancePoolName, 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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 instancePoolName) { + deleteWithServiceResponseAsync(resourceGroupName, instancePoolName).toBlocking().last().body(); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @param 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 instancePoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, instancePoolName), serviceCallback); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String instancePoolName) { + return deleteWithServiceResponseAsync(resourceGroupName, instancePoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String instancePoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName 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, instancePoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 instancePoolName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, instancePoolName).toBlocking().single().body(); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @param 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 instancePoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, instancePoolName), serviceCallback); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String instancePoolName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, instancePoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String instancePoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName 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, instancePoolName, 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 an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @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 InstancePoolInner object if successful. + */ + public InstancePoolInner update(String resourceGroupName, String instancePoolName) { + return updateWithServiceResponseAsync(resourceGroupName, instancePoolName).toBlocking().last().body(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param 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 instancePoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, instancePoolName), serviceCallback); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String instancePoolName) { + return updateWithServiceResponseAsync(resourceGroupName, instancePoolName).map(new Func1, InstancePoolInner>() { + @Override + public InstancePoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String instancePoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName 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 Map tags = null; + InstancePoolUpdate parameters = new InstancePoolUpdate(); + parameters.withTags(null); + Observable> observable = service.update(resourceGroupName, instancePoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @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 InstancePoolInner object if successful. + */ + public InstancePoolInner update(String resourceGroupName, String instancePoolName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, instancePoolName, tags).toBlocking().last().body(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @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 instancePoolName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, instancePoolName, tags), serviceCallback); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String instancePoolName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, instancePoolName, tags).map(new Func1, InstancePoolInner>() { + @Override + public InstancePoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String instancePoolName, Map tags) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName 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."); + } + Validator.validate(tags); + InstancePoolUpdate parameters = new InstancePoolUpdate(); + parameters.withTags(tags); + Observable> observable = service.update(resourceGroupName, instancePoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @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 InstancePoolInner object if successful. + */ + public InstancePoolInner beginUpdate(String resourceGroupName, String instancePoolName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName).toBlocking().single().body(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param 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 instancePoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName), serviceCallback); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String instancePoolName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName).map(new Func1, InstancePoolInner>() { + @Override + public InstancePoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String instancePoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName 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 Map tags = null; + InstancePoolUpdate parameters = new InstancePoolUpdate(); + parameters.withTags(null); + return service.beginUpdate(resourceGroupName, instancePoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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); + } + } + }); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @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 InstancePoolInner object if successful. + */ + public InstancePoolInner beginUpdate(String resourceGroupName, String instancePoolName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, tags).toBlocking().single().body(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @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 instancePoolName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, tags), serviceCallback); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String instancePoolName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, instancePoolName, tags).map(new Func1, InstancePoolInner>() { + @Override + public InstancePoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstancePoolInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String instancePoolName, Map tags) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName 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."); + } + Validator.validate(tags); + InstancePoolUpdate parameters = new InstancePoolUpdate(); + parameters.withTags(tags); + return service.beginUpdate(resourceGroupName, instancePoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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<InstancePoolInner> 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 instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param 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 instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstancePoolInner> 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 instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstancePoolInner> 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 instance pools in the 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<InstancePoolInner> 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 list of all instance pools 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<InstancePoolInner> 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 instance pools 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 instance pools in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstancePoolInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstancePoolInner> 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 instance pools in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstancePoolInner> 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 instance pools in the 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<InstancePoolInner> 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 instance pools in the 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 instance pools in the 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<InstancePoolInner> 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 instance pools in the 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<InstancePoolInner> 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 instance pools in the 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<InstancePoolInner> 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); + } + + /** + * Gets a list of all instance pools 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<InstancePoolInner> 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 instance pools 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 instance pools 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<InstancePoolInner> 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 instance pools 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<InstancePoolInner> 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 instance pools 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<InstancePoolInner> 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/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManagementClientImpl.java index 3994372b64d10..589a265170253 100644 --- a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManagementClientImpl.java +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManagementClientImpl.java @@ -184,6 +184,32 @@ public ServerVulnerabilityAssessmentsInner serverVulnerabilityAssessments() { return this.serverVulnerabilityAssessments; } + /** + * The InstancePoolsInner object to access its operations. + */ + private InstancePoolsInner instancePools; + + /** + * Gets the InstancePoolsInner object to access its operations. + * @return the InstancePoolsInner object. + */ + public InstancePoolsInner instancePools() { + return this.instancePools; + } + + /** + * The UsagesInner object to access its operations. + */ + private UsagesInner usages; + + /** + * Gets the UsagesInner object to access its operations. + * @return the UsagesInner object. + */ + public UsagesInner usages() { + return this.usages; + } + /** * Initializes an instance of SqlManagementClient client. * @@ -223,6 +249,8 @@ protected void initialize() { this.managedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsInner(restClient().retrofit(), this); this.managedInstanceVulnerabilityAssessments = new ManagedInstanceVulnerabilityAssessmentsInner(restClient().retrofit(), this); this.serverVulnerabilityAssessments = new ServerVulnerabilityAssessmentsInner(restClient().retrofit(), this); + this.instancePools = new InstancePoolsInner(restClient().retrofit(), this); + this.usages = new UsagesInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManager.java index dc3589b1981b8..af7d285860ea2 100644 --- a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManager.java +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/SqlManager.java @@ -20,6 +20,8 @@ import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedDatabaseSensitivityLabels; import com.microsoft.azure.management.sql.v2018_06_01_preview.ManagedInstanceVulnerabilityAssessments; import com.microsoft.azure.management.sql.v2018_06_01_preview.ServerVulnerabilityAssessments; +import com.microsoft.azure.management.sql.v2018_06_01_preview.InstancePools; +import com.microsoft.azure.management.sql.v2018_06_01_preview.Usages; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -31,6 +33,8 @@ public final class SqlManager extends ManagerCore implements Usage { + private final SqlManager manager; + + UsageImpl(UsageInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public Integer currentValue() { + return this.inner().currentValue(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Integer limit() { + return this.inner().limit(); + } + + @Override + public Name name() { + return this.inner().name(); + } + + @Override + public Integer requestedLimit() { + return this.inner().requestedLimit(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String unit() { + return this.inner().unit(); + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsageInner.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsageInner.java new file mode 100644 index 0000000000000..eb02c2b2bebd6 --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsageInner.java @@ -0,0 +1,123 @@ +/** + * 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.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2018_06_01_preview.Name; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * ARM usage. + */ +public class UsageInner { + /** + * Resource ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private Name name; + + /** + * Resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Usage unit. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * Usage current value. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentValue; + + /** + * Usage limit. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /** + * Usage requested limit. + */ + @JsonProperty(value = "requestedLimit", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedLimit; + + /** + * Get resource ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get resource name. + * + * @return the name value + */ + public Name name() { + return this.name; + } + + /** + * Get resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get usage unit. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Get usage current value. + * + * @return the currentValue value + */ + public Integer currentValue() { + return this.currentValue; + } + + /** + * Get usage limit. + * + * @return the limit value + */ + public Integer limit() { + return this.limit; + } + + /** + * Get usage requested limit. + * + * @return the requestedLimit value + */ + public Integer requestedLimit() { + return this.requestedLimit; + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsagesImpl.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsagesImpl.java new file mode 100644 index 0000000000000..d360255d176ca --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsagesImpl.java @@ -0,0 +1,53 @@ +/** + * 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.v2018_06_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2018_06_01_preview.Usages; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2018_06_01_preview.Usage; + +class UsagesImpl extends WrapperImpl implements Usages { + private final SqlManager manager; + + UsagesImpl(SqlManager manager) { + super(manager.inner().usages()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private UsageImpl wrapModel(UsageInner inner) { + return new UsageImpl(inner, manager()); + } + + @Override + public Observable listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName) { + UsagesInner client = this.inner(); + return client.listByInstancePoolAsync(resourceGroupName, instancePoolName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Usage call(UsageInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsagesInner.java b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsagesInner.java new file mode 100644 index 0000000000000..461e7d42154ba --- /dev/null +++ b/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/UsagesInner.java @@ -0,0 +1,425 @@ +/** + * 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.v2018_06_01_preview.implementation; + +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.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +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 Usages. + */ +public class UsagesInner { + /** The Retrofit service to perform REST calls. */ + private UsagesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of UsagesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UsagesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(UsagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Usages to be + * used by Retrofit to perform actually REST calls. + */ + interface UsagesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2018_06_01_preview.Usages listByInstancePool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages") + Observable> listByInstancePool(@Path("resourceGroupName") String resourceGroupName, @Path("instancePoolName") String instancePoolName, @Path("subscriptionId") String subscriptionId, @Query("expandChildren") Boolean expandChildren, @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.v2018_06_01_preview.Usages listByInstancePoolNext" }) + @GET + Observable> listByInstancePoolNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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<UsageInner> object if successful. + */ + public PagedList listByInstancePool(final String resourceGroupName, final String instancePoolName) { + ServiceResponse> response = listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param 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> listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageInner> object + */ + public Observable> listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName) { + return listByInstancePoolWithServiceResponseAsync(resourceGroupName, instancePoolName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageInner> object + */ + public Observable>> listByInstancePoolWithServiceResponseAsync(final String resourceGroupName, final String instancePoolName) { + return listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName) + .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(listByInstancePoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstancePoolSinglePageAsync(final String resourceGroupName, final String instancePoolName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName 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 Boolean expandChildren = null; + return service.listByInstancePool(resourceGroupName, instancePoolName, this.client.subscriptionId(), expandChildren, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstancePoolDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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<UsageInner> object if successful. + */ + public PagedList listByInstancePool(final String resourceGroupName, final String instancePoolName, final Boolean expandChildren) { + ServiceResponse> response = listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expandChildren).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @param 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> listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName, final Boolean expandChildren, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expandChildren), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageInner> object + */ + public Observable> listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName, final Boolean expandChildren) { + return listByInstancePoolWithServiceResponseAsync(resourceGroupName, instancePoolName, expandChildren) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageInner> object + */ + public Observable>> listByInstancePoolWithServiceResponseAsync(final String resourceGroupName, final String instancePoolName, final Boolean expandChildren) { + return listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expandChildren) + .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(listByInstancePoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all instance pool usage metrics. + * + 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 instancePoolName The name of the instance pool to be retrieved. + ServiceResponse> * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstancePoolSinglePageAsync(final String resourceGroupName, final String instancePoolName, final Boolean expandChildren) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (instancePoolName == null) { + throw new IllegalArgumentException("Parameter instancePoolName 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.listByInstancePool(resourceGroupName, instancePoolName, this.client.subscriptionId(), expandChildren, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstancePoolDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInstancePoolDelegate(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 all instance pool usage metrics. + * + * @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<UsageInner> object if successful. + */ + public PagedList listByInstancePoolNext(final String nextPageLink) { + ServiceResponse> response = listByInstancePoolNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all instance pool usage metrics. + * + * @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> listByInstancePoolNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstancePoolNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all instance pool usage metrics. + * + * @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<UsageInner> object + */ + public Observable> listByInstancePoolNextAsync(final String nextPageLink) { + return listByInstancePoolNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all instance pool usage metrics. + * + * @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<UsageInner> object + */ + public Observable>> listByInstancePoolNextWithServiceResponseAsync(final String nextPageLink) { + return listByInstancePoolNextSinglePageAsync(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(listByInstancePoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all instance pool usage metrics. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstancePoolNextSinglePageAsync(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.listByInstancePoolNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstancePoolNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInstancePoolNextDelegate(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); + } + +}