diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/CompleteDatabaseRestoreDefinition.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/CompleteDatabaseRestoreDefinition.java new file mode 100644 index 00000000000..328f252320f --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/CompleteDatabaseRestoreDefinition.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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains the information necessary to perform a complete database restore + * operation. + */ +public class CompleteDatabaseRestoreDefinition { + /** + * The last backup name to apply. + */ + @JsonProperty(value = "lastBackupName", required = true) + private String lastBackupName; + + /** + * Get the lastBackupName value. + * + * @return the lastBackupName value + */ + public String lastBackupName() { + return this.lastBackupName; + } + + /** + * Set the lastBackupName value. + * + * @param lastBackupName the lastBackupName value to set + * @return the CompleteDatabaseRestoreDefinition object itself. + */ + public CompleteDatabaseRestoreDefinition withLastBackupName(String lastBackupName) { + this.lastBackupName = lastBackupName; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/InstanceFailoverGroupReadOnlyEndpoint.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/InstanceFailoverGroupReadOnlyEndpoint.java new file mode 100644 index 00000000000..7ed65cc4b4c --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/InstanceFailoverGroupReadOnlyEndpoint.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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Read-only endpoint of the failover group instance. + */ +public class InstanceFailoverGroupReadOnlyEndpoint { + /** + * Failover policy of the read-only endpoint for the failover group. + * Possible values include: 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "failoverPolicy") + private ReadOnlyEndpointFailoverPolicy failoverPolicy; + + /** + * Get the failoverPolicy value. + * + * @return the failoverPolicy value + */ + public ReadOnlyEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set the failoverPolicy value. + * + * @param failoverPolicy the failoverPolicy value to set + * @return the InstanceFailoverGroupReadOnlyEndpoint object itself. + */ + public InstanceFailoverGroupReadOnlyEndpoint withFailoverPolicy(ReadOnlyEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/InstanceFailoverGroupReadWriteEndpoint.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/InstanceFailoverGroupReadWriteEndpoint.java new file mode 100644 index 00000000000..4718a45bf99 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/InstanceFailoverGroupReadWriteEndpoint.java @@ -0,0 +1,73 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Read-write endpoint of the failover group instance. + */ +public class InstanceFailoverGroupReadWriteEndpoint { + /** + * Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes + * is required. Possible values include: 'Manual', 'Automatic'. + */ + @JsonProperty(value = "failoverPolicy", required = true) + private ReadWriteEndpointFailoverPolicy failoverPolicy; + + /** + * Grace period before failover with data loss is attempted for the + * read-write endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + */ + @JsonProperty(value = "failoverWithDataLossGracePeriodMinutes") + private Integer failoverWithDataLossGracePeriodMinutes; + + /** + * Get the failoverPolicy value. + * + * @return the failoverPolicy value + */ + public ReadWriteEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set the failoverPolicy value. + * + * @param failoverPolicy the failoverPolicy value to set + * @return the InstanceFailoverGroupReadWriteEndpoint object itself. + */ + public InstanceFailoverGroupReadWriteEndpoint withFailoverPolicy(ReadWriteEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Get the failoverWithDataLossGracePeriodMinutes value. + * + * @return the failoverWithDataLossGracePeriodMinutes value + */ + public Integer failoverWithDataLossGracePeriodMinutes() { + return this.failoverWithDataLossGracePeriodMinutes; + } + + /** + * Set the failoverWithDataLossGracePeriodMinutes value. + * + * @param failoverWithDataLossGracePeriodMinutes the failoverWithDataLossGracePeriodMinutes value to set + * @return the InstanceFailoverGroupReadWriteEndpoint object itself. + */ + public InstanceFailoverGroupReadWriteEndpoint withFailoverWithDataLossGracePeriodMinutes(Integer failoverWithDataLossGracePeriodMinutes) { + this.failoverWithDataLossGracePeriodMinutes = failoverWithDataLossGracePeriodMinutes; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/InstanceFailoverGroupReplicationRole.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/InstanceFailoverGroupReplicationRole.java new file mode 100644 index 00000000000..408d409ae62 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/InstanceFailoverGroupReplicationRole.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; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for InstanceFailoverGroupReplicationRole. + */ +public final class InstanceFailoverGroupReplicationRole extends ExpandableStringEnum { + /** Static value Primary for InstanceFailoverGroupReplicationRole. */ + public static final InstanceFailoverGroupReplicationRole PRIMARY = fromString("Primary"); + + /** Static value Secondary for InstanceFailoverGroupReplicationRole. */ + public static final InstanceFailoverGroupReplicationRole SECONDARY = fromString("Secondary"); + + /** + * Creates or finds a InstanceFailoverGroupReplicationRole from its string representation. + * @param name a name to look for + * @return the corresponding InstanceFailoverGroupReplicationRole + */ + @JsonCreator + public static InstanceFailoverGroupReplicationRole fromString(String name) { + return fromString(name, InstanceFailoverGroupReplicationRole.class); + } + + /** + * @return known InstanceFailoverGroupReplicationRole values + */ + public static Collection values() { + return values(InstanceFailoverGroupReplicationRole.class); + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedDatabaseCreateMode.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedDatabaseCreateMode.java new file mode 100644 index 00000000000..7954e9b4dbf --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedDatabaseCreateMode.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; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagedDatabaseCreateMode. + */ +public final class ManagedDatabaseCreateMode extends ExpandableStringEnum { + /** Static value Default for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode DEFAULT = fromString("Default"); + + /** Static value RestoreExternalBackup for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode RESTORE_EXTERNAL_BACKUP = fromString("RestoreExternalBackup"); + + /** Static value PointInTimeRestore for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** + * Creates or finds a ManagedDatabaseCreateMode from its string representation. + * @param name a name to look for + * @return the corresponding ManagedDatabaseCreateMode + */ + @JsonCreator + public static ManagedDatabaseCreateMode fromString(String name) { + return fromString(name, ManagedDatabaseCreateMode.class); + } + + /** + * @return known ManagedDatabaseCreateMode values + */ + public static Collection values() { + return values(ManagedDatabaseCreateMode.class); + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedDatabaseStatus.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedDatabaseStatus.java new file mode 100644 index 00000000000..20edf62aad2 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedDatabaseStatus.java @@ -0,0 +1,50 @@ +/** + * 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; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagedDatabaseStatus. + */ +public final class ManagedDatabaseStatus extends ExpandableStringEnum { + /** Static value Online for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus ONLINE = fromString("Online"); + + /** Static value Offline for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus OFFLINE = fromString("Offline"); + + /** Static value Shutdown for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus SHUTDOWN = fromString("Shutdown"); + + /** Static value Creating for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus CREATING = fromString("Creating"); + + /** Static value Inaccessible for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus INACCESSIBLE = fromString("Inaccessible"); + + /** + * Creates or finds a ManagedDatabaseStatus from its string representation. + * @param name a name to look for + * @return the corresponding ManagedDatabaseStatus + */ + @JsonCreator + public static ManagedDatabaseStatus fromString(String name) { + return fromString(name, ManagedDatabaseStatus.class); + } + + /** + * @return known ManagedDatabaseStatus values + */ + public static Collection values() { + return values(ManagedDatabaseStatus.class); + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedInstancePairInfo.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedInstancePairInfo.java new file mode 100644 index 00000000000..d6f36227ecf --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedInstancePairInfo.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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Pairs of Managed Instances in the failover group. + */ +public class ManagedInstancePairInfo { + /** + * Id of Primary Managed Instance in pair. + */ + @JsonProperty(value = "primaryManagedInstanceId") + private String primaryManagedInstanceId; + + /** + * Id of Partner Managed Instance in pair. + */ + @JsonProperty(value = "partnerManagedInstanceId") + private String partnerManagedInstanceId; + + /** + * Get the primaryManagedInstanceId value. + * + * @return the primaryManagedInstanceId value + */ + public String primaryManagedInstanceId() { + return this.primaryManagedInstanceId; + } + + /** + * Set the primaryManagedInstanceId value. + * + * @param primaryManagedInstanceId the primaryManagedInstanceId value to set + * @return the ManagedInstancePairInfo object itself. + */ + public ManagedInstancePairInfo withPrimaryManagedInstanceId(String primaryManagedInstanceId) { + this.primaryManagedInstanceId = primaryManagedInstanceId; + return this; + } + + /** + * Get the partnerManagedInstanceId value. + * + * @return the partnerManagedInstanceId value + */ + public String partnerManagedInstanceId() { + return this.partnerManagedInstanceId; + } + + /** + * Set the partnerManagedInstanceId value. + * + * @param partnerManagedInstanceId the partnerManagedInstanceId value to set + * @return the ManagedInstancePairInfo object itself. + */ + public ManagedInstancePairInfo withPartnerManagedInstanceId(String partnerManagedInstanceId) { + this.partnerManagedInstanceId = partnerManagedInstanceId; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/PartnerRegionInfo.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/PartnerRegionInfo.java new file mode 100644 index 00000000000..c835ce1d52d --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/PartnerRegionInfo.java @@ -0,0 +1,59 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Partner region information for the failover group. + */ +public class PartnerRegionInfo { + /** + * Geo location of the partner managed instances. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Replication role of the partner managed instances. Possible values + * include: 'Primary', 'Secondary'. + */ + @JsonProperty(value = "replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private InstanceFailoverGroupReplicationRole replicationRole; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the PartnerRegionInfo object itself. + */ + public PartnerRegionInfo withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the replicationRole value. + * + * @return the replicationRole value + */ + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/InstanceFailoverGroupInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/InstanceFailoverGroupInner.java new file mode 100644 index 00000000000..a2be1ffbbb1 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/InstanceFailoverGroupInner.java @@ -0,0 +1,160 @@ +/** + * 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.implementation; + +import com.microsoft.azure.management.sql.InstanceFailoverGroupReadWriteEndpoint; +import com.microsoft.azure.management.sql.InstanceFailoverGroupReadOnlyEndpoint; +import com.microsoft.azure.management.sql.InstanceFailoverGroupReplicationRole; +import java.util.List; +import com.microsoft.azure.management.sql.PartnerRegionInfo; +import com.microsoft.azure.management.sql.ManagedInstancePairInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An instance failover group. + */ +@JsonFlatten +public class InstanceFailoverGroupInner extends ProxyResourceInner { + /** + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readWriteEndpoint", required = true) + private InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint; + + /** + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readOnlyEndpoint") + private InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /** + * Local replication role of the failover group instance. Possible values + * include: 'Primary', 'Secondary'. + */ + @JsonProperty(value = "properties.replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private InstanceFailoverGroupReplicationRole replicationRole; + + /** + * Replication state of the failover group instance. + */ + @JsonProperty(value = "properties.replicationState", access = JsonProperty.Access.WRITE_ONLY) + private String replicationState; + + /** + * Partner region information for the failover group. + */ + @JsonProperty(value = "properties.partnerRegions", required = true) + private List partnerRegions; + + /** + * List of managed instance pairs in the failover group. + */ + @JsonProperty(value = "properties.managedInstancePairs", required = true) + private List managedInstancePairs; + + /** + * Get the readWriteEndpoint value. + * + * @return the readWriteEndpoint value + */ + public InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set the readWriteEndpoint value. + * + * @param readWriteEndpoint the readWriteEndpoint value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get the readOnlyEndpoint value. + * + * @return the readOnlyEndpoint value + */ + public InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set the readOnlyEndpoint value. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get the replicationRole value. + * + * @return the replicationRole value + */ + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Get the replicationState value. + * + * @return the replicationState value + */ + public String replicationState() { + return this.replicationState; + } + + /** + * Get the partnerRegions value. + * + * @return the partnerRegions value + */ + public List partnerRegions() { + return this.partnerRegions; + } + + /** + * Set the partnerRegions value. + * + * @param partnerRegions the partnerRegions value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withPartnerRegions(List partnerRegions) { + this.partnerRegions = partnerRegions; + return this; + } + + /** + * Get the managedInstancePairs value. + * + * @return the managedInstancePairs value + */ + public List managedInstancePairs() { + return this.managedInstancePairs; + } + + /** + * Set the managedInstancePairs value. + * + * @param managedInstancePairs the managedInstancePairs value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withManagedInstancePairs(List managedInstancePairs) { + this.managedInstancePairs = managedInstancePairs; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/InstanceFailoverGroupsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/InstanceFailoverGroupsInner.java new file mode 100644 index 00000000000..daf54253c58 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/InstanceFailoverGroupsInner.java @@ -0,0 +1,1114 @@ +/** + * 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.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.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +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 InstanceFailoverGroups. + */ +public class InstanceFailoverGroupsInner { + /** The Retrofit service to perform REST calls. */ + private InstanceFailoverGroupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of InstanceFailoverGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public InstanceFailoverGroupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(InstanceFailoverGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for InstanceFailoverGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface InstanceFailoverGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.InstanceFailoverGroups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.InstanceFailoverGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body InstanceFailoverGroupInner 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.InstanceFailoverGroups beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body InstanceFailoverGroupInner 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.InstanceFailoverGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.InstanceFailoverGroups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.InstanceFailoverGroups listByLocation" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups") + Observable> listByLocation(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @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.InstanceFailoverGroups failover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/failover") + Observable> failover(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.InstanceFailoverGroups beginFailover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/failover") + Observable> beginFailover(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.InstanceFailoverGroups forceFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + Observable> forceFailoverAllowDataLoss(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.InstanceFailoverGroups beginForceFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + Observable> beginForceFailoverAllowDataLoss(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @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.InstanceFailoverGroups listByLocationNext" }) + @GET + Observable> listByLocationNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner get(String resourceGroupName, String locationName, String failoverGroupName) { + return getWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param 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 getAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable getAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return getWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-10-01-preview"; + return service.get(resourceGroupName, locationName, failoverGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner createOrUpdate(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param 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 locationName, String failoverGroupName, InstanceFailoverGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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."); + } + Validator.validate(parameters); + final String apiVersion = "2017-10-01-preview"; + Observable> observable = service.createOrUpdate(resourceGroupName, locationName, failoverGroupName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner beginCreateOrUpdate(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param 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 locationName, String failoverGroupName, InstanceFailoverGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName 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."); + } + Validator.validate(parameters); + final String apiVersion = "2017-10-01-preview"; + return service.beginCreateOrUpdate(resourceGroupName, locationName, failoverGroupName, this.client.subscriptionId(), parameters, 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 a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 locationName, String failoverGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param 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 locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-10-01-preview"; + Observable> observable = service.delete(resourceGroupName, locationName, failoverGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 locationName, String failoverGroupName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param 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 locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-10-01-preview"; + return service.beginDelete(resourceGroupName, locationName, failoverGroupName, this.client.subscriptionId(), 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); + } + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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<InstanceFailoverGroupInner> object if successful. + */ + public PagedList listByLocation(final String resourceGroupName, final String locationName) { + ServiceResponse> response = listByLocationSinglePageAsync(resourceGroupName, locationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param 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> listByLocationAsync(final String resourceGroupName, final String locationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationSinglePageAsync(resourceGroupName, locationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstanceFailoverGroupInner> object + */ + public Observable> listByLocationAsync(final String resourceGroupName, final String locationName) { + return listByLocationWithServiceResponseAsync(resourceGroupName, locationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstanceFailoverGroupInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String resourceGroupName, final String locationName) { + return listByLocationSinglePageAsync(resourceGroupName, locationName) + .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(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the failover groups in a location. + * + 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 locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstanceFailoverGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(final String resourceGroupName, final String locationName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-10-01-preview"; + return service.listByLocation(resourceGroupName, locationName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationDelegate(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); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner failover(String resourceGroupName, String locationName, String failoverGroupName) { + return failoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param 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 failoverAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return failoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-10-01-preview"; + Observable> observable = service.failover(resourceGroupName, locationName, failoverGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner beginFailover(String resourceGroupName, String locationName, String failoverGroupName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param 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 beginFailoverAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable beginFailoverAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> beginFailoverWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-10-01-preview"; + return service.beginFailover(resourceGroupName, locationName, failoverGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginFailoverDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginFailoverDelegate(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); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner forceFailoverAllowDataLoss(String resourceGroupName, String locationName, String failoverGroupName) { + return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param 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 forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> forceFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-10-01-preview"; + Observable> observable = service.forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner beginForceFailoverAllowDataLoss(String resourceGroupName, String locationName, String failoverGroupName) { + return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param 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 beginForceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable beginForceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> beginForceFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-10-01-preview"; + return service.beginForceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginForceFailoverAllowDataLossDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginForceFailoverAllowDataLossDelegate(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); + } + + /** + * Lists the failover groups in a location. + * + * @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<InstanceFailoverGroupInner> object if successful. + */ + public PagedList listByLocationNext(final String nextPageLink) { + ServiceResponse> response = listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the failover groups in a location. + * + * @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> listByLocationNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the failover groups in a location. + * + * @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<InstanceFailoverGroupInner> object + */ + public Observable> listByLocationNextAsync(final String nextPageLink) { + return listByLocationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the failover groups in a location. + * + * @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<InstanceFailoverGroupInner> object + */ + public Observable>> listByLocationNextWithServiceResponseAsync(final String nextPageLink) { + return listByLocationNextSinglePageAsync(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(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the failover groups in a location. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstanceFailoverGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationNextSinglePageAsync(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.listByLocationNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationNextDelegate(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/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedDatabaseInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedDatabaseInner.java new file mode 100644 index 00000000000..7c2b398629d --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedDatabaseInner.java @@ -0,0 +1,295 @@ +/** + * 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.implementation; + +import com.microsoft.azure.management.sql.ManagedDatabaseStatus; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.CatalogCollationType; +import com.microsoft.azure.management.sql.ManagedDatabaseCreateMode; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A managed database resource. + */ +@JsonFlatten +public class ManagedDatabaseInner extends TrackedResourceInner { + /** + * Collation of the managed database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * Status for the database. Possible values include: 'Online', 'Offline', + * 'Shutdown', 'Creating', 'Inaccessible'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private ManagedDatabaseStatus status; + + /** + * Creation date of the database. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * Earliest restore point in time for point in time restore. + */ + @JsonProperty(value = "properties.earliestRestorePoint", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestorePoint; + + /** + * Conditional. If createMode is PointInTimeRestore, this value is + * required. Specifies the point in time (ISO8601 format) of the source + * database that will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Geo paired region. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * Collation of the metadata catalog. Possible values include: + * 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /** + * Managed database create mode. PointInTimeRestore: Create a database by + * restoring a point in time backup of an existing database. + * SourceDatabaseName, SourceManagedInstanceName and PointInTime must be + * specified. RestoreExternalBackup: Create a database by restoring from + * external backup files. Collation, StorageContainerUri and + * StorageContainerSasToken must be specified. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + */ + @JsonProperty(value = "properties.createMode") + private ManagedDatabaseCreateMode createMode; + + /** + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the uri of the storage container where backups for + * this restore are stored. + */ + @JsonProperty(value = "properties.storageContainerUri") + private String storageContainerUri; + + /** + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + */ + @JsonProperty(value = "properties.storageContainerSasToken") + private String storageContainerSasToken; + + /** + * Instance Failover Group resource identifier that this managed database + * belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * Get the collation value. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation value. + * + * @param collation the collation value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the status value. + * + * @return the status value + */ + public ManagedDatabaseStatus status() { + return this.status; + } + + /** + * Get the creationDate value. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the earliestRestorePoint value. + * + * @return the earliestRestorePoint value + */ + public DateTime earliestRestorePoint() { + return this.earliestRestorePoint; + } + + /** + * Get the restorePointInTime value. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime value. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the defaultSecondaryLocation value. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the catalogCollation value. + * + * @return the catalogCollation value + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set the catalogCollation value. + * + * @param catalogCollation the catalogCollation value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get the createMode value. + * + * @return the createMode value + */ + public ManagedDatabaseCreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode value. + * + * @param createMode the createMode value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withCreateMode(ManagedDatabaseCreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the storageContainerUri value. + * + * @return the storageContainerUri value + */ + public String storageContainerUri() { + return this.storageContainerUri; + } + + /** + * Set the storageContainerUri value. + * + * @param storageContainerUri the storageContainerUri value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withStorageContainerUri(String storageContainerUri) { + this.storageContainerUri = storageContainerUri; + return this; + } + + /** + * Get the sourceDatabaseId value. + * + * @return the sourceDatabaseId value + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set the sourceDatabaseId value. + * + * @param sourceDatabaseId the sourceDatabaseId value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the storageContainerSasToken value. + * + * @return the storageContainerSasToken value + */ + public String storageContainerSasToken() { + return this.storageContainerSasToken; + } + + /** + * Set the storageContainerSasToken value. + * + * @param storageContainerSasToken the storageContainerSasToken value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withStorageContainerSasToken(String storageContainerSasToken) { + this.storageContainerSasToken = storageContainerSasToken; + return this; + } + + /** + * Get the failoverGroupId value. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedDatabaseUpdateInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedDatabaseUpdateInner.java new file mode 100644 index 00000000000..30ec27597ca --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedDatabaseUpdateInner.java @@ -0,0 +1,322 @@ +/** + * 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.implementation; + +import com.microsoft.azure.management.sql.ManagedDatabaseStatus; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.CatalogCollationType; +import com.microsoft.azure.management.sql.ManagedDatabaseCreateMode; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An managed database update. + */ +@JsonFlatten +public class ManagedDatabaseUpdateInner { + /** + * Collation of the managed database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * Status for the database. Possible values include: 'Online', 'Offline', + * 'Shutdown', 'Creating', 'Inaccessible'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private ManagedDatabaseStatus status; + + /** + * Creation date of the database. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * Earliest restore point in time for point in time restore. + */ + @JsonProperty(value = "properties.earliestRestorePoint", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestorePoint; + + /** + * Conditional. If createMode is PointInTimeRestore, this value is + * required. Specifies the point in time (ISO8601 format) of the source + * database that will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Geo paired region. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * Collation of the metadata catalog. Possible values include: + * 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /** + * Managed database create mode. PointInTimeRestore: Create a database by + * restoring a point in time backup of an existing database. + * SourceDatabaseName, SourceManagedInstanceName and PointInTime must be + * specified. RestoreExternalBackup: Create a database by restoring from + * external backup files. Collation, StorageContainerUri and + * StorageContainerSasToken must be specified. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + */ + @JsonProperty(value = "properties.createMode") + private ManagedDatabaseCreateMode createMode; + + /** + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the uri of the storage container where backups for + * this restore are stored. + */ + @JsonProperty(value = "properties.storageContainerUri") + private String storageContainerUri; + + /** + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + */ + @JsonProperty(value = "properties.storageContainerSasToken") + private String storageContainerSasToken; + + /** + * Instance Failover Group resource identifier that this managed database + * belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the collation value. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation value. + * + * @param collation the collation value to set + * @return the ManagedDatabaseUpdateInner object itself. + */ + public ManagedDatabaseUpdateInner withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the status value. + * + * @return the status value + */ + public ManagedDatabaseStatus status() { + return this.status; + } + + /** + * Get the creationDate value. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the earliestRestorePoint value. + * + * @return the earliestRestorePoint value + */ + public DateTime earliestRestorePoint() { + return this.earliestRestorePoint; + } + + /** + * Get the restorePointInTime value. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime value. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the ManagedDatabaseUpdateInner object itself. + */ + public ManagedDatabaseUpdateInner withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the defaultSecondaryLocation value. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the catalogCollation value. + * + * @return the catalogCollation value + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set the catalogCollation value. + * + * @param catalogCollation the catalogCollation value to set + * @return the ManagedDatabaseUpdateInner object itself. + */ + public ManagedDatabaseUpdateInner withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get the createMode value. + * + * @return the createMode value + */ + public ManagedDatabaseCreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode value. + * + * @param createMode the createMode value to set + * @return the ManagedDatabaseUpdateInner object itself. + */ + public ManagedDatabaseUpdateInner withCreateMode(ManagedDatabaseCreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the storageContainerUri value. + * + * @return the storageContainerUri value + */ + public String storageContainerUri() { + return this.storageContainerUri; + } + + /** + * Set the storageContainerUri value. + * + * @param storageContainerUri the storageContainerUri value to set + * @return the ManagedDatabaseUpdateInner object itself. + */ + public ManagedDatabaseUpdateInner withStorageContainerUri(String storageContainerUri) { + this.storageContainerUri = storageContainerUri; + return this; + } + + /** + * Get the sourceDatabaseId value. + * + * @return the sourceDatabaseId value + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set the sourceDatabaseId value. + * + * @param sourceDatabaseId the sourceDatabaseId value to set + * @return the ManagedDatabaseUpdateInner object itself. + */ + public ManagedDatabaseUpdateInner withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the storageContainerSasToken value. + * + * @return the storageContainerSasToken value + */ + public String storageContainerSasToken() { + return this.storageContainerSasToken; + } + + /** + * Set the storageContainerSasToken value. + * + * @param storageContainerSasToken the storageContainerSasToken value to set + * @return the ManagedDatabaseUpdateInner object itself. + */ + public ManagedDatabaseUpdateInner withStorageContainerSasToken(String storageContainerSasToken) { + this.storageContainerSasToken = storageContainerSasToken; + return this; + } + + /** + * Get the failoverGroupId value. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the ManagedDatabaseUpdateInner object itself. + */ + public ManagedDatabaseUpdateInner withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedDatabasesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedDatabasesInner.java new file mode 100644 index 00000000000..4e370c10d31 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedDatabasesInner.java @@ -0,0 +1,1135 @@ +/** + * 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.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.management.sql.CompleteDatabaseRestoreDefinition; +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.UUID; +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.POST; +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 ManagedDatabases. + */ +public class ManagedDatabasesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabasesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabasesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabases to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ManagedDatabases completeRestore" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/managedDatabaseRestoreAzureAsyncOperation/{operationId}/completeRestore") + Observable> completeRestore(@Path("locationName") String locationName, @Path("operationId") UUID operationId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CompleteDatabaseRestoreDefinition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ManagedDatabases beginCompleteRestore" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/managedDatabaseRestoreAzureAsyncOperation/{operationId}/completeRestore") + Observable> beginCompleteRestore(@Path("locationName") String locationName, @Path("operationId") UUID operationId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CompleteDatabaseRestoreDefinition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ManagedDatabases listByInstance" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases") + Observable> listByInstance(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @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.ManagedDatabases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ManagedDatabases createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseInner 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.ManagedDatabases beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseInner 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.ManagedDatabases delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ManagedDatabases beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ManagedDatabases update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseUpdateInner 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.ManagedDatabases beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseUpdateInner 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.ManagedDatabases listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @param lastBackupName The last backup name to apply + * @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 completeRestore(String locationName, UUID operationId, String lastBackupName) { + completeRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).toBlocking().last().body(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @param lastBackupName The last backup name to apply + * @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 completeRestoreAsync(String locationName, UUID operationId, String lastBackupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(completeRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName), serviceCallback); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @param lastBackupName The last backup name to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable completeRestoreAsync(String locationName, UUID operationId, String lastBackupName) { + return completeRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @param lastBackupName The last backup name to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> completeRestoreWithServiceResponseAsync(String locationName, UUID operationId, String lastBackupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId 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 (lastBackupName == null) { + throw new IllegalArgumentException("Parameter lastBackupName is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + CompleteDatabaseRestoreDefinition parameters = new CompleteDatabaseRestoreDefinition(); + parameters.withLastBackupName(lastBackupName); + Observable> observable = service.completeRestore(locationName, operationId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @param lastBackupName The last backup name to apply + * @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 beginCompleteRestore(String locationName, UUID operationId, String lastBackupName) { + beginCompleteRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).toBlocking().single().body(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @param lastBackupName The last backup name to apply + * @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 beginCompleteRestoreAsync(String locationName, UUID operationId, String lastBackupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCompleteRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName), serviceCallback); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @param lastBackupName The last backup name to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginCompleteRestoreAsync(String locationName, UUID operationId, String lastBackupName) { + return beginCompleteRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Completes the restore operation on a managed database. + * + * @param locationName The name of the region where the resource is located. + * @param operationId Management operation id that this request tries to complete. + * @param lastBackupName The last backup name to apply + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginCompleteRestoreWithServiceResponseAsync(String locationName, UUID operationId, String lastBackupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId 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 (lastBackupName == null) { + throw new IllegalArgumentException("Parameter lastBackupName is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + CompleteDatabaseRestoreDefinition parameters = new CompleteDatabaseRestoreDefinition(); + parameters.withLastBackupName(lastBackupName); + return service.beginCompleteRestore(locationName, operationId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCompleteRestoreDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCompleteRestoreDelegate(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 managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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<ManagedDatabaseInner> object if successful. + */ + public PagedList listByInstance(final String resourceGroupName, final String managedInstanceName) { + ServiceResponse> response = listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param 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> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedDatabaseInner> object + */ + public Observable> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + return listByInstanceWithServiceResponseAsync(resourceGroupName, managedInstanceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedDatabaseInner> object + */ + public Observable>> listByInstanceWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName) { + return listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName) + .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(listByInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of managed databases. + * + 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedDatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstanceSinglePageAsync(final String resourceGroupName, final String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByInstance(resourceGroupName, managedInstanceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstanceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInstanceDelegate(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 managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 ManagedDatabaseInner object if successful. + */ + public ManagedDatabaseInner get(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param 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 getAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedDatabaseInner>() { + @Override + public ManagedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.get(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 ManagedDatabaseInner object if successful. + */ + public ManagedDatabaseInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @param 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 managedInstanceName, String databaseName, ManagedDatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedDatabaseInner>() { + @Override + public ManagedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-03-01-preview"; + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 ManagedDatabaseInner object if successful. + */ + public ManagedDatabaseInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @param 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 managedInstanceName, String databaseName, ManagedDatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedDatabaseInner>() { + @Override + public ManagedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-03-01-preview"; + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), parameters, 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 the managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 managedInstanceName, String databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().last().body(); + } + + /** + * Deletes the managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param 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 managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Deletes the managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + Observable> observable = service.delete(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 managedInstanceName, String databaseName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Deletes the managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param 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 managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Deletes the managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.beginDelete(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), 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 existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 ManagedDatabaseInner object if successful. + */ + public ManagedDatabaseInner update(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @param 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 managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedDatabaseInner>() { + @Override + public ManagedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-03-01-preview"; + Observable> observable = service.update(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 ManagedDatabaseInner object if successful. + */ + public ManagedDatabaseInner beginUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @param 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 managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedDatabaseInner>() { + @Override + public ManagedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-03-01-preview"; + return service.beginUpdate(resourceGroupName, managedInstanceName, databaseName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of managed databases. + * + * @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<ManagedDatabaseInner> object if successful. + */ + public PagedList listByInstanceNext(final String nextPageLink) { + ServiceResponse> response = listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of managed databases. + * + * @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> listByInstanceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstanceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of managed databases. + * + * @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<ManagedDatabaseInner> object + */ + public Observable> listByInstanceNextAsync(final String nextPageLink) { + return listByInstanceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of managed databases. + * + * @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<ManagedDatabaseInner> object + */ + public Observable>> listByInstanceNextWithServiceResponseAsync(final String nextPageLink) { + return listByInstanceNextSinglePageAsync(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(listByInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of managed databases. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedDatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstanceNextSinglePageAsync(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.listByInstanceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstanceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInstanceNextDelegate(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/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedInstanceInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedInstanceInner.java new file mode 100644 index 00000000000..4d6cf1fc5df --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedInstanceInner.java @@ -0,0 +1,262 @@ +/** + * 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.implementation; + +import com.microsoft.azure.management.sql.ResourceIdentity; +import com.microsoft.azure.management.sql.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An Azure SQL managed instance. + */ +@JsonFlatten +public class ManagedInstanceInner extends TrackedResourceInner { + /** + * The Azure Active Directory identity of the managed instance. + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /** + * Managed instance sku. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * The fully qualified domain name of the managed instance. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** + * Administrator username for the managed instance. Can only be specified + * when the managed instance is being created (and is required for + * creation). + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /** + * The administrator login password (required for managed instance + * creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /** + * Subnet resource ID for the managed instance. + */ + @JsonProperty(value = "properties.subnetId") + private String subnetId; + + /** + * The state of the managed instance. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private String licenseType; + + /** + * The number of VCores. + */ + @JsonProperty(value = "properties.vCores") + private Integer vCores; + + /** + * The maximum storage size in GB. + */ + @JsonProperty(value = "properties.storageSizeInGB") + private Integer storageSizeInGB; + + /** + * Get the identity value. + * + * @return the identity value + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the identity value. + * + * @param identity the identity value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the fullyQualifiedDomainName value. + * + * @return the fullyQualifiedDomainName value + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get the administratorLogin value. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin value. + * + * @param administratorLogin the administratorLogin value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword value. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword value. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the subnetId value. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId value. + * + * @param subnetId the subnetId value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the state value. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the licenseType value. + * + * @return the licenseType value + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType value. + * + * @param licenseType the licenseType value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the vCores value. + * + * @return the vCores value + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the vCores value. + * + * @param vCores the vCores value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the storageSizeInGB value. + * + * @return the storageSizeInGB value + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set the storageSizeInGB value. + * + * @param storageSizeInGB the storageSizeInGB value to set + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withStorageSizeInGB(Integer storageSizeInGB) { + this.storageSizeInGB = storageSizeInGB; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedInstanceUpdateInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedInstanceUpdateInner.java new file mode 100644 index 00000000000..1fa1d9a56a4 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedInstanceUpdateInner.java @@ -0,0 +1,262 @@ +/** + * 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.implementation; + +import com.microsoft.azure.management.sql.Sku; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An update request for an Azure SQL Database managed instance. + */ +@JsonFlatten +public class ManagedInstanceUpdateInner { + /** + * Managed instance sku. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * The fully qualified domain name of the managed instance. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** + * Administrator username for the managed instance. Can only be specified + * when the managed instance is being created (and is required for + * creation). + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /** + * The administrator login password (required for managed instance + * creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /** + * Subnet resource ID for the managed instance. + */ + @JsonProperty(value = "properties.subnetId") + private String subnetId; + + /** + * The state of the managed instance. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private String licenseType; + + /** + * The number of VCores. + */ + @JsonProperty(value = "properties.vCores") + private Integer vCores; + + /** + * The maximum storage size in GB. + */ + @JsonProperty(value = "properties.storageSizeInGB") + private Integer storageSizeInGB; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the ManagedInstanceUpdateInner object itself. + */ + public ManagedInstanceUpdateInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the fullyQualifiedDomainName value. + * + * @return the fullyQualifiedDomainName value + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get the administratorLogin value. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin value. + * + * @param administratorLogin the administratorLogin value to set + * @return the ManagedInstanceUpdateInner object itself. + */ + public ManagedInstanceUpdateInner withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword value. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword value. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ManagedInstanceUpdateInner object itself. + */ + public ManagedInstanceUpdateInner withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the subnetId value. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId value. + * + * @param subnetId the subnetId value to set + * @return the ManagedInstanceUpdateInner object itself. + */ + public ManagedInstanceUpdateInner withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the state value. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the licenseType value. + * + * @return the licenseType value + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType value. + * + * @param licenseType the licenseType value to set + * @return the ManagedInstanceUpdateInner object itself. + */ + public ManagedInstanceUpdateInner withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the vCores value. + * + * @return the vCores value + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the vCores value. + * + * @param vCores the vCores value to set + * @return the ManagedInstanceUpdateInner object itself. + */ + public ManagedInstanceUpdateInner withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the storageSizeInGB value. + * + * @return the storageSizeInGB value + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set the storageSizeInGB value. + * + * @param storageSizeInGB the storageSizeInGB value to set + * @return the ManagedInstanceUpdateInner object itself. + */ + public ManagedInstanceUpdateInner withStorageSizeInGB(Integer storageSizeInGB) { + this.storageSizeInGB = storageSizeInGB; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the ManagedInstanceUpdateInner object itself. + */ + public ManagedInstanceUpdateInner withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedInstancesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedInstancesInner.java new file mode 100644 index 00000000000..5b2c7bea3a4 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedInstancesInner.java @@ -0,0 +1,1126 @@ +/** + * 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.implementation; + +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsGet; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsDelete; +import com.microsoft.azure.management.resources.fluentcore.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.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.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 ManagedInstances. + */ +public class ManagedInstancesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ManagedInstancesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstancesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedInstancesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedInstancesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedInstances to be + * 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.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.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ManagedInstances getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @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.ManagedInstances createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceInner 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.ManagedInstances beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceInner 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.ManagedInstances delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @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.ManagedInstances beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @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.ManagedInstances update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceUpdateInner 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.ManagedInstances beginUpdate" }) + @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 ManagedInstanceUpdateInner 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.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.ManagedInstances listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2015-05-01-preview"; + return service.list(this.client.subscriptionId(), 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 managed instances in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 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 managed instances in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param 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 managed instances in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> 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 managed instances in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> 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 managed instances in a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceInner> 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."); + } + final String apiVersion = "2015-05-01-preview"; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), 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 managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 ManagedInstanceInner object if successful. + */ + public ManagedInstanceInner getByResourceGroup(String resourceGroupName, String managedInstanceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body(); + } + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param 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 managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String managedInstanceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, ManagedInstanceInner>() { + @Override + public ManagedInstanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2015-05-01-preview"; + return service.getByResourceGroup(resourceGroupName, managedInstanceName, this.client.subscriptionId(), 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 a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 ManagedInstanceInner object if successful. + */ + public ManagedInstanceInner createOrUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @param 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 managedInstanceName, ManagedInstanceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceInner>() { + @Override + public ManagedInstanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName 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."); + } + Validator.validate(parameters); + final String apiVersion = "2015-05-01-preview"; + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 ManagedInstanceInner object if successful. + */ + public ManagedInstanceInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @param 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 managedInstanceName, ManagedInstanceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceInner>() { + @Override + public ManagedInstanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName 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."); + } + Validator.validate(parameters); + final String apiVersion = "2015-05-01-preview"; + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, this.client.subscriptionId(), parameters, 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 a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 managedInstanceName) { + deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().last().body(); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param 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 managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String managedInstanceName) { + return deleteWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2015-05-01-preview"; + Observable> observable = service.delete(resourceGroupName, managedInstanceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 managedInstanceName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body(); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param 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 managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String managedInstanceName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2015-05-01-preview"; + return service.beginDelete(resourceGroupName, managedInstanceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 ManagedInstanceInner object if successful. + */ + public ManagedInstanceInner update(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdateInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @param 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 managedInstanceName, ManagedInstanceUpdateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdateInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceInner>() { + @Override + public ManagedInstanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdateInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName 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."); + } + Validator.validate(parameters); + final String apiVersion = "2015-05-01-preview"; + Observable> observable = service.update(resourceGroupName, managedInstanceName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 ManagedInstanceInner object if successful. + */ + public ManagedInstanceInner beginUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdateInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @param 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 managedInstanceName, ManagedInstanceUpdateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdateInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceInner>() { + @Override + public ManagedInstanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param parameters The requested managed instance resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedInstanceInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdateInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName 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."); + } + Validator.validate(parameters); + final String apiVersion = "2015-05-01-preview"; + return service.beginUpdate(resourceGroupName, managedInstanceName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of all 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); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedInstanceInner> 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 managed instances in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> 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 managed instances in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedInstanceInner> 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 managed instances in a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java index ea22aa1e1d8..514be65e015 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java @@ -471,6 +471,19 @@ public FailoverGroupsInner failoverGroups() { return this.failoverGroups; } + /** + * The ManagedInstancesInner object to access its operations. + */ + private ManagedInstancesInner managedInstances; + + /** + * Gets the ManagedInstancesInner object to access its operations. + * @return the ManagedInstancesInner object. + */ + public ManagedInstancesInner managedInstances() { + return this.managedInstances; + } + /** * The OperationsInner object to access its operations. */ @@ -588,6 +601,19 @@ public BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies() { return this.backupLongTermRetentionPolicies; } + /** + * The ManagedDatabasesInner object to access its operations. + */ + private ManagedDatabasesInner managedDatabases; + + /** + * Gets the ManagedDatabasesInner object to access its operations. + * @return the ManagedDatabasesInner object. + */ + public ManagedDatabasesInner managedDatabases() { + return this.managedDatabases; + } + /** * The ServerAutomaticTuningsInner object to access its operations. */ @@ -666,6 +692,19 @@ public CapabilitiesInner capabilities() { return this.capabilities; } + /** + * The InstanceFailoverGroupsInner object to access its operations. + */ + private InstanceFailoverGroupsInner instanceFailoverGroups; + + /** + * Gets the InstanceFailoverGroupsInner object to access its operations. + * @return the InstanceFailoverGroupsInner object. + */ + public InstanceFailoverGroupsInner instanceFailoverGroups() { + return this.instanceFailoverGroups; + } + /** * Initializes an instance of SqlManagementClient client. * @@ -727,6 +766,7 @@ protected void initialize() { this.databaseAutomaticTunings = new DatabaseAutomaticTuningsInner(restClient().retrofit(), this); this.encryptionProtectors = new EncryptionProtectorsInner(restClient().retrofit(), this); this.failoverGroups = new FailoverGroupsInner(restClient().retrofit(), this); + this.managedInstances = new ManagedInstancesInner(restClient().retrofit(), this); this.operations = new OperationsInner(restClient().retrofit(), this); this.serverKeys = new ServerKeysInner(restClient().retrofit(), this); this.syncAgents = new SyncAgentsInner(restClient().retrofit(), this); @@ -736,12 +776,14 @@ protected void initialize() { this.virtualNetworkRules = new VirtualNetworkRulesInner(restClient().retrofit(), this); this.longTermRetentionBackups = new LongTermRetentionBackupsInner(restClient().retrofit(), this); this.backupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesInner(restClient().retrofit(), this); + this.managedDatabases = new ManagedDatabasesInner(restClient().retrofit(), this); this.serverAutomaticTunings = new ServerAutomaticTuningsInner(restClient().retrofit(), this); this.serverDnsAliases = new ServerDnsAliasesInner(restClient().retrofit(), this); this.restorePoints = new RestorePointsInner(restClient().retrofit(), this); this.databaseOperations = new DatabaseOperationsInner(restClient().retrofit(), this); this.elasticPoolOperations = new ElasticPoolOperationsInner(restClient().retrofit(), this); this.capabilities = new CapabilitiesInner(restClient().retrofit(), this); + this.instanceFailoverGroups = new InstanceFailoverGroupsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); }