diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java index 694657cfb63c0..8b3fc1069f25b 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstance.java @@ -18,6 +18,7 @@ import com.microsoft.azure.arm.model.Creatable; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; import com.microsoft.azure.management.sql.v2015_05_01_preview.implementation.ManagedInstanceInner; /** @@ -59,26 +60,46 @@ public interface ManagedInstance extends HasInner, Resourc */ ResourceIdentity identity(); + /** + * @return the instancePoolId value. + */ + String instancePoolId(); + /** * @return the licenseType value. */ - String licenseType(); + ManagedInstanceLicenseType licenseType(); + + /** + * @return the managedInstanceCreateMode value. + */ + ManagedServerCreateMode managedInstanceCreateMode(); /** * @return the proxyOverride value. */ - ManagedInstanceProxyOverride proxyOverride(); + String proxyOverride(); /** * @return the publicDataEndpointEnabled value. */ Boolean publicDataEndpointEnabled(); + /** + * @return the restorePointInTime value. + */ + DateTime restorePointInTime(); + /** * @return the sku value. */ Sku sku(); + /** + * @return the sourceManagedInstanceId value. + */ + String sourceManagedInstanceId(); + /** * @return the state value. */ @@ -176,6 +197,16 @@ interface WithIdentity { WithCreate withIdentity(ResourceIdentity identity); } + /** + * The stage of the managedinstance update allowing to specify InstancePoolId. + */ + interface WithInstancePoolId { + /** + * Specifies instancePoolId. + */ + WithCreate withInstancePoolId(String instancePoolId); + } + /** * The stage of the managedinstance update allowing to specify LicenseType. */ @@ -183,7 +214,17 @@ interface WithLicenseType { /** * Specifies licenseType. */ - WithCreate withLicenseType(String licenseType); + WithCreate withLicenseType(ManagedInstanceLicenseType licenseType); + } + + /** + * The stage of the managedinstance update allowing to specify ManagedInstanceCreateMode. + */ + interface WithManagedInstanceCreateMode { + /** + * Specifies managedInstanceCreateMode. + */ + WithCreate withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode); } /** @@ -193,7 +234,7 @@ interface WithProxyOverride { /** * Specifies proxyOverride. */ - WithCreate withProxyOverride(ManagedInstanceProxyOverride proxyOverride); + WithCreate withProxyOverride(String proxyOverride); } /** @@ -206,6 +247,16 @@ interface WithPublicDataEndpointEnabled { WithCreate withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled); } + /** + * The stage of the managedinstance update allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + WithCreate withRestorePointInTime(DateTime restorePointInTime); + } + /** * The stage of the managedinstance update allowing to specify Sku. */ @@ -216,6 +267,16 @@ interface WithSku { WithCreate withSku(Sku sku); } + /** + * The stage of the managedinstance update allowing to specify SourceManagedInstanceId. + */ + interface WithSourceManagedInstanceId { + /** + * Specifies sourceManagedInstanceId. + */ + WithCreate withSourceManagedInstanceId(String sourceManagedInstanceId); + } + /** * The stage of the managedinstance update allowing to specify StorageSizeInGB. */ @@ -261,13 +322,13 @@ interface WithVCores { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithCollation, DefinitionStages.WithDnsZonePartner, DefinitionStages.WithIdentity, DefinitionStages.WithLicenseType, DefinitionStages.WithProxyOverride, DefinitionStages.WithPublicDataEndpointEnabled, DefinitionStages.WithSku, DefinitionStages.WithStorageSizeInGB, DefinitionStages.WithSubnetId, DefinitionStages.WithTimezoneId, DefinitionStages.WithVCores { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithCollation, DefinitionStages.WithDnsZonePartner, DefinitionStages.WithIdentity, DefinitionStages.WithInstancePoolId, DefinitionStages.WithLicenseType, DefinitionStages.WithManagedInstanceCreateMode, DefinitionStages.WithProxyOverride, DefinitionStages.WithPublicDataEndpointEnabled, DefinitionStages.WithRestorePointInTime, DefinitionStages.WithSku, DefinitionStages.WithSourceManagedInstanceId, DefinitionStages.WithStorageSizeInGB, DefinitionStages.WithSubnetId, DefinitionStages.WithTimezoneId, DefinitionStages.WithVCores { } } /** * The template for a ManagedInstance update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAdministratorLogin, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithCollation, UpdateStages.WithDnsZonePartner, UpdateStages.WithLicenseType, UpdateStages.WithProxyOverride, UpdateStages.WithPublicDataEndpointEnabled, UpdateStages.WithSku, UpdateStages.WithStorageSizeInGB, UpdateStages.WithSubnetId, UpdateStages.WithTimezoneId, UpdateStages.WithVCores { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAdministratorLogin, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithCollation, UpdateStages.WithDnsZonePartner, UpdateStages.WithInstancePoolId, UpdateStages.WithLicenseType, UpdateStages.WithManagedInstanceCreateMode, UpdateStages.WithProxyOverride, UpdateStages.WithPublicDataEndpointEnabled, UpdateStages.WithRestorePointInTime, UpdateStages.WithSku, UpdateStages.WithSourceManagedInstanceId, UpdateStages.WithStorageSizeInGB, UpdateStages.WithSubnetId, UpdateStages.WithTimezoneId, UpdateStages.WithVCores { } /** @@ -314,6 +375,16 @@ interface WithDnsZonePartner { Update withDnsZonePartner(String dnsZonePartner); } + /** + * The stage of the managedinstance {0} allowing to specify InstancePoolId. + */ + interface WithInstancePoolId { + /** + * Specifies instancePoolId. + */ + Update withInstancePoolId(String instancePoolId); + } + /** * The stage of the managedinstance {0} allowing to specify LicenseType. */ @@ -321,7 +392,17 @@ interface WithLicenseType { /** * Specifies licenseType. */ - Update withLicenseType(String licenseType); + Update withLicenseType(ManagedInstanceLicenseType licenseType); + } + + /** + * The stage of the managedinstance {0} allowing to specify ManagedInstanceCreateMode. + */ + interface WithManagedInstanceCreateMode { + /** + * Specifies managedInstanceCreateMode. + */ + Update withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode); } /** @@ -331,7 +412,7 @@ interface WithProxyOverride { /** * Specifies proxyOverride. */ - Update withProxyOverride(ManagedInstanceProxyOverride proxyOverride); + Update withProxyOverride(String proxyOverride); } /** @@ -344,6 +425,16 @@ interface WithPublicDataEndpointEnabled { Update withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled); } + /** + * The stage of the managedinstance {0} allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + Update withRestorePointInTime(DateTime restorePointInTime); + } + /** * The stage of the managedinstance {0} allowing to specify Sku. */ @@ -354,6 +445,16 @@ interface WithSku { Update withSku(Sku sku); } + /** + * The stage of the managedinstance {0} allowing to specify SourceManagedInstanceId. + */ + interface WithSourceManagedInstanceId { + /** + * Specifies sourceManagedInstanceId. + */ + Update withSourceManagedInstanceId(String sourceManagedInstanceId); + } + /** * The stage of the managedinstance {0} allowing to specify StorageSizeInGB. */ diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceLicenseType.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceLicenseType.java new file mode 100644 index 0000000000000..2fdac3314c3a9 --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceLicenseType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagedInstanceLicenseType. + */ +public final class ManagedInstanceLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for ManagedInstanceLicenseType. */ + public static final ManagedInstanceLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for ManagedInstanceLicenseType. */ + public static final ManagedInstanceLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a ManagedInstanceLicenseType from its string representation. + * @param name a name to look for + * @return the corresponding ManagedInstanceLicenseType + */ + @JsonCreator + public static ManagedInstanceLicenseType fromString(String name) { + return fromString(name, ManagedInstanceLicenseType.class); + } + + /** + * @return known ManagedInstanceLicenseType values + */ + public static Collection values() { + return values(ManagedInstanceLicenseType.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java index 5a6c6f851f4a3..aaa37bbb455b9 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstanceUpdate.java @@ -8,6 +8,7 @@ package com.microsoft.azure.management.sql.v2015_05_01_preview; +import org.joda.time.DateTime; import java.util.Map; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; @@ -23,6 +24,18 @@ public class ManagedInstanceUpdate { @JsonProperty(value = "sku") private Sku sku; + /** + * Specifies the mode of database creation. + * + * Default: Regular instance creation. + * + * Restore: Creates an instance by restoring a set of backups to specific + * point in time. RestorePointInTime and SourceManagedInstanceId must be + * specified. Possible values include: 'Default', 'PointInTimeRestore'. + */ + @JsonProperty(value = "properties.managedInstanceCreateMode") + private ManagedServerCreateMode managedInstanceCreateMode; + /** * The fully qualified domain name of the managed instance. */ @@ -57,19 +70,23 @@ public class ManagedInstanceUpdate { private String state; /** - * The license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * The license type. Possible values are 'LicenseIncluded' (regular price + * inclusive of a new SQL license) and 'BasePrice' (discounted AHB price + * for bringing your own SQL licenses). Possible values include: + * 'LicenseIncluded', 'BasePrice'. */ @JsonProperty(value = "properties.licenseType") - private String licenseType; + private ManagedInstanceLicenseType licenseType; /** - * The number of VCores. + * The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. */ @JsonProperty(value = "properties.vCores") private Integer vCores; /** - * The maximum storage size in GB. + * Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments + * of 32 GB allowed only. */ @JsonProperty(value = "properties.storageSizeInGB") private Integer storageSizeInGB; @@ -100,11 +117,24 @@ public class ManagedInstanceUpdate { private Boolean publicDataEndpointEnabled; /** - * Connection type used for connecting to the instance. Possible values - * include: 'Proxy', 'Redirect', 'Default'. + * The resource identifier of the source managed instance associated with + * create operation of this instance. + */ + @JsonProperty(value = "properties.sourceManagedInstanceId") + private String sourceManagedInstanceId; + + /** + * Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Proxy override of the managed instance. */ @JsonProperty(value = "properties.proxyOverride") - private ManagedInstanceProxyOverride proxyOverride; + private String proxyOverride; /** * Id of the timezone. Allowed values are timezones supported by Windows. @@ -122,6 +152,12 @@ public class ManagedInstanceUpdate { @JsonProperty(value = "properties.timezoneId") private String timezoneId; + /** + * The Id of the instance pool this managed server belongs to. + */ + @JsonProperty(value = "properties.instancePoolId") + private String instancePoolId; + /** * Resource tags. */ @@ -148,6 +184,30 @@ public ManagedInstanceUpdate withSku(Sku sku) { return this; } + /** + * Get specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore'. + * + * @return the managedInstanceCreateMode value + */ + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.managedInstanceCreateMode; + } + + /** + * Set specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore'. + * + * @param managedInstanceCreateMode the managedInstanceCreateMode value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + this.managedInstanceCreateMode = managedInstanceCreateMode; + return this; + } + /** * Get the fully qualified domain name of the managed instance. * @@ -227,27 +287,27 @@ public String state() { } /** - * Get the license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * Get the license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice'. * * @return the licenseType value */ - public String licenseType() { + public ManagedInstanceLicenseType licenseType() { return this.licenseType; } /** - * Set the license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * Set the license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice'. * * @param licenseType the licenseType value to set * @return the ManagedInstanceUpdate object itself. */ - public ManagedInstanceUpdate withLicenseType(String licenseType) { + public ManagedInstanceUpdate withLicenseType(ManagedInstanceLicenseType licenseType) { this.licenseType = licenseType; return this; } /** - * Get the number of VCores. + * Get the number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. * * @return the vCores value */ @@ -256,7 +316,7 @@ public Integer vCores() { } /** - * Set the number of VCores. + * Set the number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. * * @param vCores the vCores value to set * @return the ManagedInstanceUpdate object itself. @@ -267,7 +327,7 @@ public ManagedInstanceUpdate withVCores(Integer vCores) { } /** - * Get the maximum storage size in GB. + * Get storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. * * @return the storageSizeInGB value */ @@ -276,7 +336,7 @@ public Integer storageSizeInGB() { } /** - * Set the maximum storage size in GB. + * Set storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. * * @param storageSizeInGB the storageSizeInGB value to set * @return the ManagedInstanceUpdate object itself. @@ -356,21 +416,61 @@ public ManagedInstanceUpdate withPublicDataEndpointEnabled(Boolean publicDataEnd } /** - * Get connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default'. + * Get the resource identifier of the source managed instance associated with create operation of this instance. + * + * @return the sourceManagedInstanceId value + */ + public String sourceManagedInstanceId() { + return this.sourceManagedInstanceId; + } + + /** + * Set the resource identifier of the source managed instance associated with create operation of this instance. + * + * @param sourceManagedInstanceId the sourceManagedInstanceId value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withSourceManagedInstanceId(String sourceManagedInstanceId) { + this.sourceManagedInstanceId = sourceManagedInstanceId; + return this; + } + + /** + * Get specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get proxy override of the managed instance. * * @return the proxyOverride value */ - public ManagedInstanceProxyOverride proxyOverride() { + public String proxyOverride() { return this.proxyOverride; } /** - * Set connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default'. + * Set proxy override of the managed instance. * * @param proxyOverride the proxyOverride value to set * @return the ManagedInstanceUpdate object itself. */ - public ManagedInstanceUpdate withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + public ManagedInstanceUpdate withProxyOverride(String proxyOverride) { this.proxyOverride = proxyOverride; return this; } @@ -405,6 +505,26 @@ public ManagedInstanceUpdate withTimezoneId(String timezoneId) { return this; } + /** + * Get the Id of the instance pool this managed server belongs to. + * + * @return the instancePoolId value + */ + public String instancePoolId() { + return this.instancePoolId; + } + + /** + * Set the Id of the instance pool this managed server belongs to. + * + * @param instancePoolId the instancePoolId value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withInstancePoolId(String instancePoolId) { + this.instancePoolId = instancePoolId; + return this; + } + /** * Get resource tags. * diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstances.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstances.java index c3949792e1987..3d47531e94ea5 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstances.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedInstances.java @@ -22,4 +22,14 @@ * Type representing ManagedInstances. */ public interface ManagedInstances extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName); + } diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedServerCreateMode.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedServerCreateMode.java new file mode 100644 index 0000000000000..69456304a58db --- /dev/null +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/ManagedServerCreateMode.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2015_05_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagedServerCreateMode. + */ +public final class ManagedServerCreateMode extends ExpandableStringEnum { + /** Static value Default for ManagedServerCreateMode. */ + public static final ManagedServerCreateMode DEFAULT = fromString("Default"); + + /** Static value PointInTimeRestore for ManagedServerCreateMode. */ + public static final ManagedServerCreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** + * Creates or finds a ManagedServerCreateMode from its string representation. + * @param name a name to look for + * @return the corresponding ManagedServerCreateMode + */ + @JsonCreator + public static ManagedServerCreateMode fromString(String name) { + return fromString(name, ManagedServerCreateMode.class); + } + + /** + * @return known ManagedServerCreateMode values + */ + public static Collection values() { + return values(ManagedServerCreateMode.class); + } +} diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java index f81ad888b216c..097dca49914ce 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceImpl.java @@ -12,9 +12,11 @@ import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstance; import rx.Observable; import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstanceUpdate; +import org.joda.time.DateTime; import com.microsoft.azure.management.sql.v2015_05_01_preview.ResourceIdentity; import com.microsoft.azure.management.sql.v2015_05_01_preview.Sku; -import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstanceProxyOverride; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedServerCreateMode; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstanceLicenseType; import rx.functions.Func1; class ManagedInstanceImpl extends GroupableResourceCoreImpl implements ManagedInstance, ManagedInstance.Definition, ManagedInstance.Update { @@ -103,12 +105,22 @@ public ResourceIdentity identity() { } @Override - public String licenseType() { + public String instancePoolId() { + return this.inner().instancePoolId(); + } + + @Override + public ManagedInstanceLicenseType licenseType() { return this.inner().licenseType(); } @Override - public ManagedInstanceProxyOverride proxyOverride() { + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.inner().managedInstanceCreateMode(); + } + + @Override + public String proxyOverride() { return this.inner().proxyOverride(); } @@ -117,11 +129,21 @@ public Boolean publicDataEndpointEnabled() { return this.inner().publicDataEndpointEnabled(); } + @Override + public DateTime restorePointInTime() { + return this.inner().restorePointInTime(); + } + @Override public Sku sku() { return this.inner().sku(); } + @Override + public String sourceManagedInstanceId() { + return this.inner().sourceManagedInstanceId(); + } + @Override public String state() { return this.inner().state(); @@ -194,7 +216,17 @@ public ManagedInstanceImpl withDnsZonePartner(String dnsZonePartner) { } @Override - public ManagedInstanceImpl withLicenseType(String licenseType) { + public ManagedInstanceImpl withInstancePoolId(String instancePoolId) { + if (isInCreateMode()) { + this.inner().withInstancePoolId(instancePoolId); + } else { + this.updateParameter.withInstancePoolId(instancePoolId); + } + return this; + } + + @Override + public ManagedInstanceImpl withLicenseType(ManagedInstanceLicenseType licenseType) { if (isInCreateMode()) { this.inner().withLicenseType(licenseType); } else { @@ -204,7 +236,17 @@ public ManagedInstanceImpl withLicenseType(String licenseType) { } @Override - public ManagedInstanceImpl withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + public ManagedInstanceImpl withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + if (isInCreateMode()) { + this.inner().withManagedInstanceCreateMode(managedInstanceCreateMode); + } else { + this.updateParameter.withManagedInstanceCreateMode(managedInstanceCreateMode); + } + return this; + } + + @Override + public ManagedInstanceImpl withProxyOverride(String proxyOverride) { if (isInCreateMode()) { this.inner().withProxyOverride(proxyOverride); } else { @@ -223,6 +265,16 @@ public ManagedInstanceImpl withPublicDataEndpointEnabled(Boolean publicDataEndpo return this; } + @Override + public ManagedInstanceImpl withRestorePointInTime(DateTime restorePointInTime) { + if (isInCreateMode()) { + this.inner().withRestorePointInTime(restorePointInTime); + } else { + this.updateParameter.withRestorePointInTime(restorePointInTime); + } + return this; + } + @Override public ManagedInstanceImpl withSku(Sku sku) { if (isInCreateMode()) { @@ -233,6 +285,16 @@ public ManagedInstanceImpl withSku(Sku sku) { return this; } + @Override + public ManagedInstanceImpl withSourceManagedInstanceId(String sourceManagedInstanceId) { + if (isInCreateMode()) { + this.inner().withSourceManagedInstanceId(sourceManagedInstanceId); + } else { + this.updateParameter.withSourceManagedInstanceId(sourceManagedInstanceId); + } + return this; + } + @Override public ManagedInstanceImpl withStorageSizeInGB(Integer storageSizeInGB) { if (isInCreateMode()) { diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java index 06b0f97959d6d..70e98f46fb6be 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstanceInner.java @@ -10,7 +10,9 @@ import com.microsoft.azure.management.sql.v2015_05_01_preview.ResourceIdentity; import com.microsoft.azure.management.sql.v2015_05_01_preview.Sku; -import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstanceProxyOverride; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedServerCreateMode; +import com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstanceLicenseType; +import org.joda.time.DateTime; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.Resource; @@ -27,11 +29,24 @@ public class ManagedInstanceInner extends Resource { private ResourceIdentity identity; /** - * Managed instance sku. + * Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, + * BC_Gen4, BC_Gen5. */ @JsonProperty(value = "sku") private Sku sku; + /** + * Specifies the mode of database creation. + * + * Default: Regular instance creation. + * + * Restore: Creates an instance by restoring a set of backups to specific + * point in time. RestorePointInTime and SourceManagedInstanceId must be + * specified. Possible values include: 'Default', 'PointInTimeRestore'. + */ + @JsonProperty(value = "properties.managedInstanceCreateMode") + private ManagedServerCreateMode managedInstanceCreateMode; + /** * The fully qualified domain name of the managed instance. */ @@ -66,19 +81,23 @@ public class ManagedInstanceInner extends Resource { private String state; /** - * The license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * The license type. Possible values are 'LicenseIncluded' (regular price + * inclusive of a new SQL license) and 'BasePrice' (discounted AHB price + * for bringing your own SQL licenses). Possible values include: + * 'LicenseIncluded', 'BasePrice'. */ @JsonProperty(value = "properties.licenseType") - private String licenseType; + private ManagedInstanceLicenseType licenseType; /** - * The number of VCores. + * The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. */ @JsonProperty(value = "properties.vCores") private Integer vCores; /** - * The maximum storage size in GB. + * Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments + * of 32 GB allowed only. */ @JsonProperty(value = "properties.storageSizeInGB") private Integer storageSizeInGB; @@ -109,11 +128,24 @@ public class ManagedInstanceInner extends Resource { private Boolean publicDataEndpointEnabled; /** - * Connection type used for connecting to the instance. Possible values - * include: 'Proxy', 'Redirect', 'Default'. + * The resource identifier of the source managed instance associated with + * create operation of this instance. + */ + @JsonProperty(value = "properties.sourceManagedInstanceId") + private String sourceManagedInstanceId; + + /** + * Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Proxy override of the managed instance. */ @JsonProperty(value = "properties.proxyOverride") - private ManagedInstanceProxyOverride proxyOverride; + private String proxyOverride; /** * Id of the timezone. Allowed values are timezones supported by Windows. @@ -131,6 +163,12 @@ public class ManagedInstanceInner extends Resource { @JsonProperty(value = "properties.timezoneId") private String timezoneId; + /** + * The Id of the instance pool this managed server belongs to. + */ + @JsonProperty(value = "properties.instancePoolId") + private String instancePoolId; + /** * Get the Azure Active Directory identity of the managed instance. * @@ -152,7 +190,7 @@ public ManagedInstanceInner withIdentity(ResourceIdentity identity) { } /** - * Get managed instance sku. + * Get managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5. * * @return the sku value */ @@ -161,7 +199,7 @@ public Sku sku() { } /** - * Set managed instance sku. + * Set managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5. * * @param sku the sku value to set * @return the ManagedInstanceInner object itself. @@ -171,6 +209,30 @@ public ManagedInstanceInner withSku(Sku sku) { return this; } + /** + * Get specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore'. + * + * @return the managedInstanceCreateMode value + */ + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.managedInstanceCreateMode; + } + + /** + * Set specifies the mode of database creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'Default', 'PointInTimeRestore'. + * + * @param managedInstanceCreateMode the managedInstanceCreateMode value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + this.managedInstanceCreateMode = managedInstanceCreateMode; + return this; + } + /** * Get the fully qualified domain name of the managed instance. * @@ -250,27 +312,27 @@ public String state() { } /** - * Get the license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * Get the license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice'. * * @return the licenseType value */ - public String licenseType() { + public ManagedInstanceLicenseType licenseType() { return this.licenseType; } /** - * Set the license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + * Set the license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice'. * * @param licenseType the licenseType value to set * @return the ManagedInstanceInner object itself. */ - public ManagedInstanceInner withLicenseType(String licenseType) { + public ManagedInstanceInner withLicenseType(ManagedInstanceLicenseType licenseType) { this.licenseType = licenseType; return this; } /** - * Get the number of VCores. + * Get the number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. * * @return the vCores value */ @@ -279,7 +341,7 @@ public Integer vCores() { } /** - * Set the number of VCores. + * Set the number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. * * @param vCores the vCores value to set * @return the ManagedInstanceInner object itself. @@ -290,7 +352,7 @@ public ManagedInstanceInner withVCores(Integer vCores) { } /** - * Get the maximum storage size in GB. + * Get storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. * * @return the storageSizeInGB value */ @@ -299,7 +361,7 @@ public Integer storageSizeInGB() { } /** - * Set the maximum storage size in GB. + * Set storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. * * @param storageSizeInGB the storageSizeInGB value to set * @return the ManagedInstanceInner object itself. @@ -379,21 +441,61 @@ public ManagedInstanceInner withPublicDataEndpointEnabled(Boolean publicDataEndp } /** - * Get connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default'. + * Get the resource identifier of the source managed instance associated with create operation of this instance. + * + * @return the sourceManagedInstanceId value + */ + public String sourceManagedInstanceId() { + return this.sourceManagedInstanceId; + } + + /** + * Set the resource identifier of the source managed instance associated with create operation of this instance. + * + * @param sourceManagedInstanceId the sourceManagedInstanceId value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSourceManagedInstanceId(String sourceManagedInstanceId) { + this.sourceManagedInstanceId = sourceManagedInstanceId; + return this; + } + + /** + * Get specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get proxy override of the managed instance. * * @return the proxyOverride value */ - public ManagedInstanceProxyOverride proxyOverride() { + public String proxyOverride() { return this.proxyOverride; } /** - * Set connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default'. + * Set proxy override of the managed instance. * * @param proxyOverride the proxyOverride value to set * @return the ManagedInstanceInner object itself. */ - public ManagedInstanceInner withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + public ManagedInstanceInner withProxyOverride(String proxyOverride) { this.proxyOverride = proxyOverride; return this; } @@ -428,4 +530,24 @@ public ManagedInstanceInner withTimezoneId(String timezoneId) { return this; } + /** + * Get the Id of the instance pool this managed server belongs to. + * + * @return the instancePoolId value + */ + public String instancePoolId() { + return this.instancePoolId; + } + + /** + * Set the Id of the instance pool this managed server belongs to. + * + * @param instancePoolId the instancePoolId value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withInstancePoolId(String instancePoolId) { + this.instancePoolId = instancePoolId; + return this; + } + } diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesImpl.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesImpl.java index 97820344672d3..01f59dd6e2784 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesImpl.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesImpl.java @@ -125,6 +125,24 @@ public ManagedInstanceImpl define(String name) { return wrapModel(name); } + @Override + public Observable listByInstancePoolAsync(final String resourceGroupName, final String instancePoolName) { + ManagedInstancesInner 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 ManagedInstance call(ManagedInstanceInner inner) { + return new ManagedInstanceImpl(inner.name(), inner, manager()); + } + }); + } + @Override protected ManagedInstanceImpl wrapModel(ManagedInstanceInner inner) { return new ManagedInstanceImpl(inner.name(), inner, manager()); diff --git a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java index 2ecb94ce48b0f..4c395d62b04d5 100644 --- a/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java +++ b/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java @@ -66,10 +66,6 @@ public ManagedInstancesInner(Retrofit retrofit, SqlManagementClientImpl client) * used by Retrofit to perform actually REST calls. */ interface ManagedInstancesService { - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances list" }) - @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances") - Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances listByResourceGroup" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances") Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -102,121 +98,26 @@ interface ManagedInstancesService { @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}") Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances listNext" }) - @GET - Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances listByInstancePool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances") + Observable> listByInstancePool(@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.v2015_05_01_preview.ManagedInstances list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances listByResourceGroupNext" }) @GET Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - } - - /** - * Gets a list of all managed instances in the subscription. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PagedList<ManagedInstanceInner> object if successful. - */ - public PagedList list() { - ServiceResponse> response = listSinglePageAsync().toBlocking().single(); - return new PagedList(response.body()) { - @Override - public Page nextPage(String nextPageLink) { - return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); - } - }; - } - - /** - * Gets a list of all managed instances in the subscription. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { - return AzureServiceFuture.fromPageResponse( - listSinglePageAsync(), - new Func1>>>() { - @Override - public Observable>> call(String nextPageLink) { - return listNextSinglePageAsync(nextPageLink); - } - }, - serviceCallback); - } - - /** - * Gets a list of all managed instances in the subscription. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<ManagedInstanceInner> object - */ - public Observable> listAsync() { - return listWithServiceResponseAsync() - .map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - return response.body(); - } - }); - } - - /** - * Gets a list of all managed instances in the subscription. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<ManagedInstanceInner> object - */ - public Observable>> listWithServiceResponseAsync() { - return listSinglePageAsync() - .concatMap(new Func1>, Observable>>>() { - @Override - public Observable>> call(ServiceResponse> page) { - String nextPageLink = page.body().nextPageLink(); - if (nextPageLink == null) { - return Observable.just(page); - } - return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); - } - }); - } + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances listByInstancePoolNext" }) + @GET + Observable> listByInstancePoolNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - /** - * Gets a list of all managed instances in the subscription. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. - */ - public Observable>> listSinglePageAsync() { - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2015_05_01_preview.ManagedInstances listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) - .build(response); } /** @@ -920,17 +821,139 @@ private ServiceResponse beginUpdateDelegate(Response 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 a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @param 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 a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> 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 a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> 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 a list of all managed instances in an instance pool. + * + 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 instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceInner> 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."); + } + return service.listByInstancePool(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> 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 a list of all managed instances in the subscription. * - * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList<ManagedInstanceInner> object if successful. */ - public PagedList listNext(final String nextPageLink) { - ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { @@ -942,15 +965,13 @@ public Page nextPage(String nextPageLink) { /** * Gets a list of all managed instances in the subscription. * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param serviceFuture the ServiceFuture object tracking the Retrofit calls * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listNextSinglePageAsync(nextPageLink), + listSinglePageAsync(), new Func1>>>() { @Override public Observable>> call(String nextPageLink) { @@ -963,12 +984,11 @@ public Observable>> call(String nextP /** * Gets a list of all managed instances in the subscription. * - * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ManagedInstanceInner> object */ - public Observable> listNextAsync(final String nextPageLink) { - return listNextWithServiceResponseAsync(nextPageLink) + public Observable> listAsync() { + return listWithServiceResponseAsync() .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -980,12 +1000,11 @@ public Page call(ServiceResponse>> listNextWithServiceResponseAsync(final String nextPageLink) { - return listNextSinglePageAsync(nextPageLink) + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { @@ -1001,21 +1020,22 @@ public Observable>> call(ServiceRespo /** * Gets a list of all managed instances in the subscription. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listNextSinglePageAsync(final String nextPageLink) { - if (nextPageLink == null) { - throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - String nextUrl = String.format("%s", nextPageLink); - return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1024,7 +1044,7 @@ public Observable>> call(Response> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) @@ -1142,4 +1162,226 @@ private ServiceResponse> listByResourceGroupNextD .build(response); } + /** + * Gets a list of all managed instances in an instance pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceInner> object if successful. + */ + public PagedList 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 a list of all managed instances in an instance pool. + * + * @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 a list of all managed instances in an instance pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable> listByInstancePoolNextAsync(final String nextPageLink) { + return listByInstancePoolNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable>> 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 a list of all managed instances in an instance pool. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> 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); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of all managed instances in the subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + }