diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ElasticPoolState.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ElasticPoolState.java new file mode 100644 index 000000000000..63294605e702 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ElasticPoolState.java @@ -0,0 +1,62 @@ +/** + * 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.JsonValue; + +/** + * Defines values for ElasticPoolState. + */ +public final class ElasticPoolState { + /** Static value Creating for ElasticPoolState. */ + public static final ElasticPoolState CREATING = new ElasticPoolState("Creating"); + + /** Static value Ready for ElasticPoolState. */ + public static final ElasticPoolState READY = new ElasticPoolState("Ready"); + + /** Static value Disabled for ElasticPoolState. */ + public static final ElasticPoolState DISABLED = new ElasticPoolState("Disabled"); + + private String value; + + /** + * Creates a custom value for ElasticPoolState. + * @param value the custom value + */ + public ElasticPoolState(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + @Override + public int hashCode() { + return value.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof ElasticPoolState)) { + return false; + } + if (obj == this) { + return true; + } + ElasticPoolState rhs = (ElasticPoolState) obj; + if (value == null) { + return rhs.value == null; + } else { + return value.equals(rhs.value); + } + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ResourceMoveDefinition.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ResourceMoveDefinition.java deleted file mode 100644 index 078d1cf68336..000000000000 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ResourceMoveDefinition.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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; - - -/** - * Contains the information necessary to perform a resource move (rename). - */ -public class ResourceMoveDefinition { - /** - * The target ID for the resource. - */ - private String id; - - /** - * Get the id value. - * - * @return the id value - */ - public String id() { - return this.id; - } - - /** - * Set the id value. - * - * @param id the id value to set - * @return the ResourceMoveDefinition object itself. - */ - public ResourceMoveDefinition withId(String id) { - this.id = id; - return this; - } - -} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ServiceObjectiveName.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ServiceObjectiveName.java new file mode 100644 index 000000000000..7aeab7ef55aa --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ServiceObjectiveName.java @@ -0,0 +1,77 @@ +/** + * 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.JsonValue; + +/** + * Defines values for ServiceObjectiveName. + */ +public final class ServiceObjectiveName { + /** Static value Basic for ServiceObjectiveName. */ + public static final ServiceObjectiveName BASIC = new ServiceObjectiveName("Basic"); + + /** Static value S0 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S0 = new ServiceObjectiveName("S0"); + + /** Static value S1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S1 = new ServiceObjectiveName("S1"); + + /** Static value S2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S2 = new ServiceObjectiveName("S2"); + + /** Static value S3 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S3 = new ServiceObjectiveName("S3"); + + /** Static value P1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P1 = new ServiceObjectiveName("P1"); + + /** Static value P2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P2 = new ServiceObjectiveName("P2"); + + /** Static value P3 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P3 = new ServiceObjectiveName("P3"); + + private String value; + + /** + * Creates a custom value for ServiceObjectiveName. + * @param value the custom value + */ + public ServiceObjectiveName(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + @Override + public int hashCode() { + return value.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof ServiceObjectiveName)) { + return false; + } + if (obj == this) { + return true; + } + ServiceObjectiveName rhs = (ServiceObjectiveName) obj; + if (value == null) { + return rhs.value == null; + } else { + return value.equals(rhs.value); + } + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlDatabase.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlDatabase.java index e06b90f90c0b..4bfbc254387e 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlDatabase.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlDatabase.java @@ -92,12 +92,12 @@ public interface SqlDatabase extends * SQL Database, this is the Service Level Objective that is being * applied to the Azure SQL Database */ - String requestedServiceObjectiveName(); + ServiceObjectiveName requestedServiceObjectiveName(); /** * @return the Service Level Objective of the Azure SQL Database. */ - String serviceLevelObjective(); + ServiceObjectiveName serviceLevelObjective(); /** * @return the status of the Azure SQL Database diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlElasticPool.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlElasticPool.java index 7f59f6853def..34d1fa1cc791 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlElasticPool.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlElasticPool.java @@ -39,7 +39,7 @@ public interface SqlElasticPool extends /** * @return the state of the Azure SQL Elastic Pool */ - String state(); + ElasticPoolState state(); /** * @return the edition of Azure SQL Elastic Pool diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlFirewallRule.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlFirewallRule.java index 1f4e2ee67d7f..6103323e45a9 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlFirewallRule.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlFirewallRule.java @@ -12,7 +12,7 @@ import com.microsoft.azure.management.resources.fluentcore.model.Refreshable; import com.microsoft.azure.management.resources.fluentcore.model.Updatable; import com.microsoft.azure.management.resources.fluentcore.model.Wrapper; -import com.microsoft.azure.management.sql.implementation.FirewallRuleInner; +import com.microsoft.azure.management.sql.implementation.ServerFirewallRuleInner; /** * An immutable client-side representation of an Azure SQL Server FirewallRule. @@ -22,7 +22,7 @@ public interface SqlFirewallRule extends IndependentChild, Refreshable, Updatable, - Wrapper { + Wrapper { /** * @return the SQL Server name to which this firewall rule belongs diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseInner.java index 5982dbd254c8..a95b97fb93e8 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseInner.java @@ -11,6 +11,7 @@ import org.joda.time.DateTime; import java.util.UUID; import com.microsoft.azure.management.sql.DatabaseEditions; +import com.microsoft.azure.management.sql.ServiceObjectiveName; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; @@ -80,25 +81,30 @@ public class DatabaseInner extends Resource { /** * The configured Service Level Objective Id of the Azure SQL Database. - * This is the Service Level Objective that is being applied to the Azure - * SQL Database. + * This is the Service Level Objective that is in the process of being + * applied to the Azure SQL Database. Once successfully updated, it will + * match the value of currentServiceObjectiveId property. */ @JsonProperty(value = "properties.requestedServiceObjectiveId") private UUID requestedServiceObjectiveId; /** * The name of the configured Service Level Objective of the Azure SQL - * Database. This is the Service Level Objective that is being applied to - * the Azure SQL Database. + * Database. This is the Service Level Objective that is in the process + * of being applied to the Azure SQL Database. Once successfully + * updated, it will match the value of serviceLevelObjective property. + * Possible values include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', + * 'P3'. */ @JsonProperty(value = "properties.requestedServiceObjectiveName") - private String requestedServiceObjectiveName; + private ServiceObjectiveName requestedServiceObjectiveName; /** - * The Service Level Objective of the Azure SQL Database. + * The current Service Level Objective of the Azure SQL Database. Possible + * values include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3'. */ @JsonProperty(value = "properties.serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) - private String serviceLevelObjective; + private ServiceObjectiveName serviceLevelObjective; /** * The status of the Azure SQL Database. @@ -278,7 +284,7 @@ public DatabaseInner withRequestedServiceObjectiveId(UUID requestedServiceObject * * @return the requestedServiceObjectiveName value */ - public String requestedServiceObjectiveName() { + public ServiceObjectiveName requestedServiceObjectiveName() { return this.requestedServiceObjectiveName; } @@ -288,7 +294,7 @@ public String requestedServiceObjectiveName() { * @param requestedServiceObjectiveName the requestedServiceObjectiveName value to set * @return the DatabaseInner object itself. */ - public DatabaseInner withRequestedServiceObjectiveName(String requestedServiceObjectiveName) { + public DatabaseInner withRequestedServiceObjectiveName(ServiceObjectiveName requestedServiceObjectiveName) { this.requestedServiceObjectiveName = requestedServiceObjectiveName; return this; } @@ -298,7 +304,7 @@ public DatabaseInner withRequestedServiceObjectiveName(String requestedServiceOb * * @return the serviceLevelObjective value */ - public String serviceLevelObjective() { + public ServiceObjectiveName serviceLevelObjective() { return this.serviceLevelObjective; } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabasesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabasesInner.java index c8187791846b..d525686fe843 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabasesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabasesInner.java @@ -15,7 +15,6 @@ import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.sql.ArmErrorResponseMessageException; -import com.microsoft.azure.management.sql.ResourceMoveDefinition; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCall; @@ -65,10 +64,6 @@ public DatabasesInner(Retrofit retrofit, SqlManagementClientImpl client) { * used by Retrofit to perform actually REST calls. */ interface DatabasesService { - @Headers("Content-Type: application/json; charset=utf-8") - @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move") - Observable> rename(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ResourceMoveDefinition definition, @Header("User-Agent") String userAgent); - @Headers("Content-Type: application/json; charset=utf-8") @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditRecords") Observable> listEngineAuditRecords(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -91,7 +86,7 @@ interface DatabasesService { @Headers("Content-Type: application/json; charset=utf-8") @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints") - Observable> listRestorePointss(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> listRestorePoints(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") @@ -127,11 +122,11 @@ interface DatabasesService { @Headers("Content-Type: application/json; charset=utf-8") @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current") - Observable> getTransparentDataEncryptionConfiguration(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body TransparentDataEncryptionInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> createOrUpdateTransparentDataEncryptionConfiguration(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body TransparentDataEncryptionInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current") - Observable> getTransparentDataEncryption(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getTransparentDataEncryptionConfiguration(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/current/operationResults") @@ -215,176 +210,6 @@ interface DatabasesService { } - /** - * Renames an Azure SQL Database. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Database Server on which the Azure SQL Database is hosted. - * @param databaseName The name of the Azure SQL Database to rename. - */ - public void rename(String resourceGroupName, String serverName, String databaseName) { - renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().getBody(); - } - - /** - * Renames an Azure SQL Database. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Database Server on which the Azure SQL Database is hosted. - * @param databaseName The name of the Azure SQL Database to rename. - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @return the {@link ServiceCall} object - */ - public ServiceCall renameAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { - return ServiceCall.create(renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); - } - - /** - * Renames an Azure SQL Database. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Database Server on which the Azure SQL Database is hosted. - * @param databaseName The name of the Azure SQL Database to rename. - * @return the {@link ServiceResponse} object if successful. - */ - public Observable renameAsync(String resourceGroupName, String serverName, String databaseName) { - return renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { - @Override - public Void call(ServiceResponse response) { - return response.getBody(); - } - }); - } - - /** - * Renames an Azure SQL Database. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Database Server on which the Azure SQL Database is hosted. - * @param databaseName The name of the Azure SQL Database to rename. - * @return the {@link ServiceResponse} object if successful. - */ - public Observable> renameWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (serverName == null) { - throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); - } - if (databaseName == null) { - throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); - } - final String apiVersion = "2015-05-01-preview"; - final String id = null; - ResourceMoveDefinition definition = new ResourceMoveDefinition(); - definition.withId(null); - return service.rename(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, apiVersion, this.client.acceptLanguage(), definition, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = renameDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - /** - * Renames an Azure SQL Database. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Database Server on which the Azure SQL Database is hosted. - * @param databaseName The name of the Azure SQL Database to rename. - * @param id The target ID for the resource - */ - public void rename(String resourceGroupName, String serverName, String databaseName, String id) { - renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id).toBlocking().single().getBody(); - } - - /** - * Renames an Azure SQL Database. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Database Server on which the Azure SQL Database is hosted. - * @param databaseName The name of the Azure SQL Database to rename. - * @param id The target ID for the resource - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @return the {@link ServiceCall} object - */ - public ServiceCall renameAsync(String resourceGroupName, String serverName, String databaseName, String id, final ServiceCallback serviceCallback) { - return ServiceCall.create(renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id), serviceCallback); - } - - /** - * Renames an Azure SQL Database. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Database Server on which the Azure SQL Database is hosted. - * @param databaseName The name of the Azure SQL Database to rename. - * @param id The target ID for the resource - * @return the {@link ServiceResponse} object if successful. - */ - public Observable renameAsync(String resourceGroupName, String serverName, String databaseName, String id) { - return renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id).map(new Func1, Void>() { - @Override - public Void call(ServiceResponse response) { - return response.getBody(); - } - }); - } - - /** - * Renames an Azure SQL Database. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Database Server on which the Azure SQL Database is hosted. - * @param databaseName The name of the Azure SQL Database to rename. - * @param id The target ID for the resource - * @return the {@link ServiceResponse} object if successful. - */ - public Observable> renameWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String id) { - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (serverName == null) { - throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); - } - if (databaseName == null) { - throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); - } - final String apiVersion = "2015-05-01-preview"; - ResourceMoveDefinition definition = new ResourceMoveDefinition(); - definition.withId(id); - return service.rename(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, apiVersion, this.client.acceptLanguage(), definition, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = renameDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse renameDelegate(Response response) throws ArmErrorResponseMessageException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.mapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ArmErrorResponseMessageException.class) - .build(response); - } - /** * Get a list of database engine audit records. * @@ -938,8 +763,8 @@ private ServiceResponse beginResumeDataWarehouseDelegate(Response listRestorePointss(String resourceGroupName, String serverName, String databaseName) { - return listRestorePointssWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().getBody(); + public List listRestorePoints(String resourceGroupName, String serverName, String databaseName) { + return listRestorePointsWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().getBody(); } /** @@ -951,8 +776,8 @@ public List listRestorePointss(String resourceGroupName, Stri * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */ - public ServiceCall> listRestorePointssAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { - return ServiceCall.create(listRestorePointssWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + public ServiceCall> listRestorePointsAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceCall.create(listRestorePointsWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); } /** @@ -963,8 +788,8 @@ public ServiceCall> listRestorePointssAsync(String resou * @param databaseName The name of the Azure SQL Database from which to retrieve available restore points. * @return the observable to the List<RestorePointInner> object */ - public Observable> listRestorePointssAsync(String resourceGroupName, String serverName, String databaseName) { - return listRestorePointssWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + public Observable> listRestorePointsAsync(String resourceGroupName, String serverName, String databaseName) { + return listRestorePointsWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { @Override public List call(ServiceResponse> response) { return response.getBody(); @@ -980,7 +805,7 @@ public List call(ServiceResponse> res * @param databaseName The name of the Azure SQL Database from which to retrieve available restore points. * @return the observable to the List<RestorePointInner> object */ - public Observable>> listRestorePointssWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + public Observable>> listRestorePointsWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -994,12 +819,12 @@ public Observable>> listRestorePointssWi throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } final String apiVersion = "2014-04-01"; - return service.listRestorePointss(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.listRestorePoints(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listRestorePointssDelegate(response); + ServiceResponse> result = listRestorePointsDelegate(response); ServiceResponse> clientResponse = new ServiceResponse>(result.getBody().getItems(), result.getResponse()); return Observable.just(clientResponse); } catch (Throwable t) { @@ -1009,7 +834,7 @@ public Observable>> call(Response> listRestorePointssDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse> listRestorePointsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) @@ -1017,7 +842,7 @@ private ServiceResponse> listRestorePointssDelegate } /** - * Creates a new Azure SQL database or updates an existing Azure SQL database. + * Creates a new Azure SQL database or updates an existing Azure SQL database. Location is a required property in the request body and it must be the same as the location of the Sql Server. * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server @@ -1030,7 +855,7 @@ public DatabaseInner createOrUpdate(String resourceGroupName, String serverName, } /** - * Creates a new Azure SQL database or updates an existing Azure SQL database. + * Creates a new Azure SQL database or updates an existing Azure SQL database. Location is a required property in the request body and it must be the same as the location of the Sql Server. * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server @@ -1044,7 +869,7 @@ public ServiceCall createOrUpdateAsync(String resourceGroupName, } /** - * Creates a new Azure SQL database or updates an existing Azure SQL database. + * Creates a new Azure SQL database or updates an existing Azure SQL database. Location is a required property in the request body and it must be the same as the location of the Sql Server. * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server @@ -1062,7 +887,7 @@ public DatabaseInner call(ServiceResponse response) { } /** - * Creates a new Azure SQL database or updates an existing Azure SQL database. + * Creates a new Azure SQL database or updates an existing Azure SQL database. Location is a required property in the request body and it must be the same as the location of the Sql Server. * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server @@ -1093,7 +918,7 @@ public Observable> createOrUpdateWithServiceRespo } /** - * Creates a new Azure SQL database or updates an existing Azure SQL database. + * Creates a new Azure SQL database or updates an existing Azure SQL database. Location is a required property in the request body and it must be the same as the location of the Sql Server. * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server @@ -1106,7 +931,7 @@ public DatabaseInner beginCreateOrUpdate(String resourceGroupName, String server } /** - * Creates a new Azure SQL database or updates an existing Azure SQL database. + * Creates a new Azure SQL database or updates an existing Azure SQL database. Location is a required property in the request body and it must be the same as the location of the Sql Server. * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server @@ -1120,7 +945,7 @@ public ServiceCall beginCreateOrUpdateAsync(String resourceGroupN } /** - * Creates a new Azure SQL database or updates an existing Azure SQL database. + * Creates a new Azure SQL database or updates an existing Azure SQL database. Location is a required property in the request body and it must be the same as the location of the Sql Server. * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server @@ -1138,7 +963,7 @@ public DatabaseInner call(ServiceResponse response) { } /** - * Creates a new Azure SQL database or updates an existing Azure SQL database. + * Creates a new Azure SQL database or updates an existing Azure SQL database. Location is a required property in the request body and it must be the same as the location of the Sql Server. * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server @@ -1791,8 +1616,8 @@ private ServiceResponse> listServiceTierAdvis * @param parameters The required parameters for creating or updating transparent data encryption. * @return the TransparentDataEncryptionInner object if successful. */ - public TransparentDataEncryptionInner getTransparentDataEncryptionConfiguration(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionInner parameters) { - return getTransparentDataEncryptionConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().getBody(); + public TransparentDataEncryptionInner createOrUpdateTransparentDataEncryptionConfiguration(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionInner parameters) { + return createOrUpdateTransparentDataEncryptionConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().getBody(); } /** @@ -1805,8 +1630,8 @@ public TransparentDataEncryptionInner getTransparentDataEncryptionConfiguration( * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */ - public ServiceCall getTransparentDataEncryptionConfigurationAsync(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionInner parameters, final ServiceCallback serviceCallback) { - return ServiceCall.create(getTransparentDataEncryptionConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + public ServiceCall createOrUpdateTransparentDataEncryptionConfigurationAsync(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionInner parameters, final ServiceCallback serviceCallback) { + return ServiceCall.create(createOrUpdateTransparentDataEncryptionConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); } /** @@ -1818,8 +1643,8 @@ public ServiceCall getTransparentDataEncryptionC * @param parameters The required parameters for creating or updating transparent data encryption. * @return the observable to the TransparentDataEncryptionInner object */ - public Observable getTransparentDataEncryptionConfigurationAsync(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionInner parameters) { - return getTransparentDataEncryptionConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, TransparentDataEncryptionInner>() { + public Observable createOrUpdateTransparentDataEncryptionConfigurationAsync(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionInner parameters) { + return createOrUpdateTransparentDataEncryptionConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, TransparentDataEncryptionInner>() { @Override public TransparentDataEncryptionInner call(ServiceResponse response) { return response.getBody(); @@ -1836,7 +1661,7 @@ public TransparentDataEncryptionInner call(ServiceResponse> getTransparentDataEncryptionConfigurationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionInner parameters) { + public Observable> createOrUpdateTransparentDataEncryptionConfigurationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionInner parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1854,12 +1679,12 @@ public Observable> getTransparen } Validator.validate(parameters); final String apiVersion = "2014-04-01"; - return service.getTransparentDataEncryptionConfiguration(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + return service.createOrUpdateTransparentDataEncryptionConfiguration(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = getTransparentDataEncryptionConfigurationDelegate(response); + ServiceResponse clientResponse = createOrUpdateTransparentDataEncryptionConfigurationDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1868,7 +1693,7 @@ public Observable> call(Response }); } - private ServiceResponse getTransparentDataEncryptionConfigurationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse createOrUpdateTransparentDataEncryptionConfigurationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType()) @@ -1884,8 +1709,8 @@ private ServiceResponse getTransparentDataEncryp * @param databaseName The name of the Azure SQL Database for which the Transparent Data Encryption applies. * @return the TransparentDataEncryptionInner object if successful. */ - public TransparentDataEncryptionInner getTransparentDataEncryption(String resourceGroupName, String serverName, String databaseName) { - return getTransparentDataEncryptionWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().getBody(); + public TransparentDataEncryptionInner getTransparentDataEncryptionConfiguration(String resourceGroupName, String serverName, String databaseName) { + return getTransparentDataEncryptionConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().getBody(); } /** @@ -1897,8 +1722,8 @@ public TransparentDataEncryptionInner getTransparentDataEncryption(String resour * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */ - public ServiceCall getTransparentDataEncryptionAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { - return ServiceCall.create(getTransparentDataEncryptionWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + public ServiceCall getTransparentDataEncryptionConfigurationAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceCall.create(getTransparentDataEncryptionConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); } /** @@ -1909,8 +1734,8 @@ public ServiceCall getTransparentDataEncryptionA * @param databaseName The name of the Azure SQL Database for which the Transparent Data Encryption applies. * @return the observable to the TransparentDataEncryptionInner object */ - public Observable getTransparentDataEncryptionAsync(String resourceGroupName, String serverName, String databaseName) { - return getTransparentDataEncryptionWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, TransparentDataEncryptionInner>() { + public Observable getTransparentDataEncryptionConfigurationAsync(String resourceGroupName, String serverName, String databaseName) { + return getTransparentDataEncryptionConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, TransparentDataEncryptionInner>() { @Override public TransparentDataEncryptionInner call(ServiceResponse response) { return response.getBody(); @@ -1926,7 +1751,7 @@ public TransparentDataEncryptionInner call(ServiceResponse> getTransparentDataEncryptionWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + public Observable> getTransparentDataEncryptionConfigurationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1940,12 +1765,12 @@ public Observable> getTransparen throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } final String apiVersion = "2014-04-01"; - return service.getTransparentDataEncryption(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.getTransparentDataEncryptionConfiguration(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = getTransparentDataEncryptionDelegate(response); + ServiceResponse clientResponse = getTransparentDataEncryptionConfigurationDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1954,7 +1779,7 @@ public Observable> call(Response }); } - private ServiceResponse getTransparentDataEncryptionDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse getTransparentDataEncryptionConfigurationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolActivityInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolActivityInner.java index e547c5be0aa9..a2265bd41e6b 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolActivityInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolActivityInner.java @@ -109,8 +109,7 @@ public class ElasticPoolActivityInner extends Resource { private DateTime startTime; /** - * The current state of the operation. Possible values include: - * 'Creating', 'Ready', 'Disabled'. + * The current state of the operation. */ @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) private String state; diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolInner.java index 0fcc9e19609c..d084d812d708 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolInner.java @@ -9,6 +9,7 @@ package com.microsoft.azure.management.sql.implementation; import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.ElasticPoolState; import com.microsoft.azure.management.sql.ElasticPoolEditions; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; @@ -26,10 +27,11 @@ public class ElasticPoolInner extends Resource { private DateTime creationDate; /** - * The state of the Azure SQL Elastic Pool. + * The state of the Azure SQL Elastic Pool. Possible values include: + * 'Creating', 'Ready', 'Disabled'. */ @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) - private String state; + private ElasticPoolState state; /** * The edition of the Azure SQL Elastic Pool. Possible values include: @@ -41,25 +43,25 @@ public class ElasticPoolInner extends Resource { /** * The total shared DTU for the SQL Azure Database Elastic Pool. */ - @JsonProperty(value = "properties.dtu", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "properties.dtu") private Integer dtu; /** * The maximum DTU any one SQL Azure Database can consume. */ - @JsonProperty(value = "properties.databaseDtuMax", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "properties.databaseDtuMax") private Integer databaseDtuMax; /** * The minimum DTU all SQL Azure Databases are guaranteed. */ - @JsonProperty(value = "properties.databaseDtuMin", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "properties.databaseDtuMin") private Integer databaseDtuMin; /** * Gets storage limit for the SQL Azure Database Elastic Pool in MB. */ - @JsonProperty(value = "properties.storageMB", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "properties.storageMB") private Integer storageMB; /** @@ -76,7 +78,7 @@ public DateTime creationDate() { * * @return the state value */ - public String state() { + public ElasticPoolState state() { return this.state; } @@ -109,6 +111,17 @@ public Integer dtu() { return this.dtu; } + /** + * Set the dtu value. + * + * @param dtu the dtu value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withDtu(Integer dtu) { + this.dtu = dtu; + return this; + } + /** * Get the databaseDtuMax value. * @@ -118,6 +131,17 @@ public Integer databaseDtuMax() { return this.databaseDtuMax; } + /** + * Set the databaseDtuMax value. + * + * @param databaseDtuMax the databaseDtuMax value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withDatabaseDtuMax(Integer databaseDtuMax) { + this.databaseDtuMax = databaseDtuMax; + return this; + } + /** * Get the databaseDtuMin value. * @@ -127,6 +151,17 @@ public Integer databaseDtuMin() { return this.databaseDtuMin; } + /** + * Set the databaseDtuMin value. + * + * @param databaseDtuMin the databaseDtuMin value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withDatabaseDtuMin(Integer databaseDtuMin) { + this.databaseDtuMin = databaseDtuMin; + return this; + } + /** * Get the storageMB value. * @@ -136,4 +171,15 @@ public Integer storageMB() { return this.storageMB; } + /** + * Set the storageMB value. + * + * @param storageMB the storageMB value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withStorageMB(Integer storageMB) { + this.storageMB = storageMB; + return this; + } + } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolsDatabaseActivitysInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolsDatabaseActivitysInner.java deleted file mode 100644 index 1932f9a510ce..000000000000 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolsDatabaseActivitysInner.java +++ /dev/null @@ -1,148 +0,0 @@ -/** - * 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.AzureServiceResponseBuilder; -import com.microsoft.azure.CloudException; -import com.microsoft.rest.ServiceCall; -import com.microsoft.rest.ServiceCallback; -import com.microsoft.rest.ServiceResponse; -import java.io.IOException; -import java.util.List; -import okhttp3.ResponseBody; -import retrofit2.http.GET; -import retrofit2.http.Header; -import retrofit2.http.Headers; -import retrofit2.http.Path; -import retrofit2.http.Query; -import retrofit2.Response; -import rx.functions.Func1; -import rx.Observable; - -/** - * An instance of this class provides access to all the operations defined - * in ElasticPoolsDatabaseActivitys. - */ -public final class ElasticPoolsDatabaseActivitysInner { - /** The Retrofit service to perform REST calls. */ - private ElasticPoolsDatabaseActivitysService service; - /** The service client containing this operation class. */ - private SqlManagementClientImpl client; - - /** - * Initializes an instance of ElasticPoolsDatabaseActivitysInner. - * - * @param retrofit the Retrofit instance built from a Retrofit Builder. - * @param client the instance of the service client containing this operation class. - */ - public ElasticPoolsDatabaseActivitysInner(Retrofit retrofit, SqlManagementClientImpl client) { - this.service = retrofit.create(ElasticPoolsDatabaseActivitysService.class); - this.client = client; - } - - /** - * The interface defining all the services for ElasticPoolsDatabaseActivitys to be - * used by Retrofit to perform actually REST calls. - */ - interface ElasticPoolsDatabaseActivitysService { - @Headers("Content-Type: application/json; charset=utf-8") - @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity") - Observable> list(@Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - } - - /** - * Returns information about activity on Azure SQL databases inside of an Azure SQL elastic pool. - * - * @param elasticPoolName The name of the Azure SQL Elastic Pool. - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @return the List<ElasticPoolDatabaseActivityInner> object if successful. - */ - public List list(String elasticPoolName, String resourceGroupName, String serverName) { - return listWithServiceResponseAsync(elasticPoolName, resourceGroupName, serverName).toBlocking().single().getBody(); - } - - /** - * Returns information about activity on Azure SQL databases inside of an Azure SQL elastic pool. - * - * @param elasticPoolName The name of the Azure SQL Elastic Pool. - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @return the {@link ServiceCall} object - */ - public ServiceCall> listAsync(String elasticPoolName, String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { - return ServiceCall.create(listWithServiceResponseAsync(elasticPoolName, resourceGroupName, serverName), serviceCallback); - } - - /** - * Returns information about activity on Azure SQL databases inside of an Azure SQL elastic pool. - * - * @param elasticPoolName The name of the Azure SQL Elastic Pool. - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @return the observable to the List<ElasticPoolDatabaseActivityInner> object - */ - public Observable> listAsync(String elasticPoolName, String resourceGroupName, String serverName) { - return listWithServiceResponseAsync(elasticPoolName, resourceGroupName, serverName).map(new Func1>, List>() { - @Override - public List call(ServiceResponse> response) { - return response.getBody(); - } - }); - } - - /** - * Returns information about activity on Azure SQL databases inside of an Azure SQL elastic pool. - * - * @param elasticPoolName The name of the Azure SQL Elastic Pool. - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @return the observable to the List<ElasticPoolDatabaseActivityInner> object - */ - public Observable>> listWithServiceResponseAsync(String elasticPoolName, String resourceGroupName, String serverName) { - if (elasticPoolName == null) { - throw new IllegalArgumentException("Parameter elasticPoolName 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 (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (serverName == null) { - throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); - } - final String apiVersion = "2014-04-01"; - return service.list(elasticPoolName, this.client.subscriptionId(), resourceGroupName, serverName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.getBody().getItems(), result.getResponse()); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) - .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/ElasticPoolsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolsInner.java index 1b55174becad..4078415dc5d7 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolsInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolsInner.java @@ -81,6 +81,10 @@ interface ElasticPoolsService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity") Observable> listActivity(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity") + Observable> listDatabaseActivity(@Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers("Content-Type: application/json; charset=utf-8") @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases/{databaseName}") Observable> getDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -596,6 +600,92 @@ private ServiceResponse> listActivityDelegat .build(response); } + /** + * Returns information about activity on Azure SQL databases inside of an Azure SQL elastic pool. + * + * @param elasticPoolName The name of the Azure SQL Elastic Pool. + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @return the List<ElasticPoolDatabaseActivityInner> object if successful. + */ + public List listDatabaseActivity(String elasticPoolName, String resourceGroupName, String serverName) { + return listDatabaseActivityWithServiceResponseAsync(elasticPoolName, resourceGroupName, serverName).toBlocking().single().getBody(); + } + + /** + * Returns information about activity on Azure SQL databases inside of an Azure SQL elastic pool. + * + * @param elasticPoolName The name of the Azure SQL Elastic Pool. + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall> listDatabaseActivityAsync(String elasticPoolName, String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceCall.create(listDatabaseActivityWithServiceResponseAsync(elasticPoolName, resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns information about activity on Azure SQL databases inside of an Azure SQL elastic pool. + * + * @param elasticPoolName The name of the Azure SQL Elastic Pool. + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @return the observable to the List<ElasticPoolDatabaseActivityInner> object + */ + public Observable> listDatabaseActivityAsync(String elasticPoolName, String resourceGroupName, String serverName) { + return listDatabaseActivityWithServiceResponseAsync(elasticPoolName, resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.getBody(); + } + }); + } + + /** + * Returns information about activity on Azure SQL databases inside of an Azure SQL elastic pool. + * + * @param elasticPoolName The name of the Azure SQL Elastic Pool. + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @return the observable to the List<ElasticPoolDatabaseActivityInner> object + */ + public Observable>> listDatabaseActivityWithServiceResponseAsync(String elasticPoolName, String resourceGroupName, String serverName) { + if (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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 (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + final String apiVersion = "2014-04-01"; + return service.listDatabaseActivity(elasticPoolName, this.client.subscriptionId(), resourceGroupName, serverName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDatabaseActivityDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.getBody().getItems(), result.getResponse()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDatabaseActivityDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Returns information about an Azure SQL database inside of an Azure SQL elastic pool. * diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/FirewallRuleInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerFirewallRuleInner.java similarity index 55% rename from azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/FirewallRuleInner.java rename to azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerFirewallRuleInner.java index 84c3ac50e334..e795b495b6db 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/FirewallRuleInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerFirewallRuleInner.java @@ -16,21 +16,51 @@ * Represents an Azure SQL Server Firewall Rule. */ @JsonFlatten -public class FirewallRuleInner extends SqlSubResource { +public class ServerFirewallRuleInner extends SqlSubResource { /** - * The start IP address of the Azure SQL Database Firewall Rule. Must be - * IPv4 format. + * Kind of server that contains this firewall rule. + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Location of the server that contains this firewall rule. + */ + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The start IP address of the Azure SQL Database Server Firewall Rule. + * Must be IPv4 format. */ @JsonProperty(value = "properties.startIpAddress") private String startIpAddress; /** - * The end IP address of the Azure SQL Database Firewall Rule. Must be - * IPv4 format. + * The end IP address of the Azure SQL Database Server Firewall Rule. Must + * be IPv4 format. */ @JsonProperty(value = "properties.endIpAddress") private String endIpAddress; + /** + * Get the kind value. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + /** * Get the startIpAddress value. * @@ -44,9 +74,9 @@ public String startIpAddress() { * Set the startIpAddress value. * * @param startIpAddress the startIpAddress value to set - * @return the FirewallRuleInner object itself. + * @return the ServerFirewallRuleInner object itself. */ - public FirewallRuleInner withStartIpAddress(String startIpAddress) { + public ServerFirewallRuleInner withStartIpAddress(String startIpAddress) { this.startIpAddress = startIpAddress; return this; } @@ -64,9 +94,9 @@ public String endIpAddress() { * Set the endIpAddress value. * * @param endIpAddress the endIpAddress value to set - * @return the FirewallRuleInner object itself. + * @return the ServerFirewallRuleInner object itself. */ - public FirewallRuleInner withEndIpAddress(String endIpAddress) { + public ServerFirewallRuleInner withEndIpAddress(String endIpAddress) { this.endIpAddress = endIpAddress; return this; } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerUpgradesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerUpgradesInner.java deleted file mode 100644 index 590020de07cf..000000000000 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerUpgradesInner.java +++ /dev/null @@ -1,384 +0,0 @@ -/** - * 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.AzureServiceResponseBuilder; -import com.microsoft.azure.CloudException; -import com.microsoft.rest.ServiceCall; -import com.microsoft.rest.ServiceCallback; -import com.microsoft.rest.ServiceResponse; -import com.microsoft.rest.Validator; -import java.io.IOException; -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.Query; -import retrofit2.Response; -import rx.functions.Func1; -import rx.Observable; - -/** - * An instance of this class provides access to all the operations defined - * in ServerUpgrades. - */ -public final class ServerUpgradesInner { - /** The Retrofit service to perform REST calls. */ - private ServerUpgradesService service; - /** The service client containing this operation class. */ - private SqlManagementClientImpl client; - - /** - * Initializes an instance of ServerUpgradesInner. - * - * @param retrofit the Retrofit instance built from a Retrofit Builder. - * @param client the instance of the service client containing this operation class. - */ - public ServerUpgradesInner(Retrofit retrofit, SqlManagementClientImpl client) { - this.service = retrofit.create(ServerUpgradesService.class); - this.client = client; - } - - /** - * The interface defining all the services for ServerUpgrades to be - * used by Retrofit to perform actually REST calls. - */ - interface ServerUpgradesService { - @Headers("Content-Type: application/json; charset=utf-8") - @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/operationResults/versionUpgrade", method = "DELETE", hasBody = true) - Observable> cancel(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers("Content-Type: application/json; charset=utf-8") - @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/operationResults/versionUpgrade") - Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers("Content-Type: application/json; charset=utf-8") - @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/upgrade") - Observable> start(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerUpgradeStartParametersInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers("Content-Type: application/json; charset=utf-8") - @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/upgrade") - Observable> beginStart(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerUpgradeStartParametersInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - } - - /** - * Cancel a pending upgrade for the Azure SQL Server. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - */ - public void cancel(String resourceGroupName, String serverName) { - cancelWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().getBody(); - } - - /** - * Cancel a pending upgrade for the Azure SQL Server. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @return the {@link ServiceCall} object - */ - public ServiceCall cancelAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { - return ServiceCall.create(cancelWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); - } - - /** - * Cancel a pending upgrade for the Azure SQL Server. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @return the {@link ServiceResponse} object if successful. - */ - public Observable cancelAsync(String resourceGroupName, String serverName) { - return cancelWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, Void>() { - @Override - public Void call(ServiceResponse response) { - return response.getBody(); - } - }); - } - - /** - * Cancel a pending upgrade for the Azure SQL Server. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @return the {@link ServiceResponse} object if successful. - */ - public Observable> cancelWithServiceResponseAsync(String resourceGroupName, String serverName) { - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (serverName == null) { - throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); - } - final String apiVersion = "2014-04-01"; - return service.cancel(this.client.subscriptionId(), resourceGroupName, serverName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = cancelDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse cancelDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.mapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .register(204, new TypeToken() { }.getType()) - .build(response); - } - - /** - * Returns information about Upgrade status of an Azure SQL Server. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @return the ServerUpgradeGetResultInner object if successful. - */ - public ServerUpgradeGetResultInner get(String resourceGroupName, String serverName) { - return getWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().getBody(); - } - - /** - * Returns information about Upgrade status of an Azure SQL Server. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @return the {@link ServiceCall} object - */ - public ServiceCall getAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { - return ServiceCall.create(getWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); - } - - /** - * Returns information about Upgrade status of an Azure SQL Server. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @return the observable to the ServerUpgradeGetResultInner object - */ - public Observable getAsync(String resourceGroupName, String serverName) { - return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerUpgradeGetResultInner>() { - @Override - public ServerUpgradeGetResultInner call(ServiceResponse response) { - return response.getBody(); - } - }); - } - - /** - * Returns information about Upgrade status of an Azure SQL Server. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @return the observable to the ServerUpgradeGetResultInner object - */ - public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName) { - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (serverName == null) { - throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); - } - final String apiVersion = "2014-04-01"; - return service.get(this.client.subscriptionId(), resourceGroupName, serverName, 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 new AzureServiceResponseBuilder(this.client.mapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - - /** - * Start an Azure SQL Server Upgrade. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @param parameters The required parameters for the Azure SQL Server Upgrade. - */ - public void start(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters) { - startWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().getBody(); - } - - /** - * Start an Azure SQL Server Upgrade. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @param parameters The required parameters for the Azure SQL Server Upgrade. - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @return the {@link ServiceCall} object - */ - public ServiceCall startAsync(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters, final ServiceCallback serviceCallback) { - return ServiceCall.create(startWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); - } - - /** - * Start an Azure SQL Server Upgrade. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @param parameters The required parameters for the Azure SQL Server Upgrade. - * @return the observable for the request - */ - public Observable startAsync(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters) { - return startWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, Void>() { - @Override - public Void call(ServiceResponse response) { - return response.getBody(); - } - }); - } - - /** - * Start an Azure SQL Server Upgrade. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @param parameters The required parameters for the Azure SQL Server Upgrade. - * @return the observable for the request - */ - public Observable> startWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters) { - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (serverName == null) { - throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); - } - if (parameters == null) { - throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); - } - Validator.validate(parameters); - final String apiVersion = "2014-04-01"; - Observable> observable = service.start(this.client.subscriptionId(), resourceGroupName, serverName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); - } - - /** - * Start an Azure SQL Server Upgrade. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @param parameters The required parameters for the Azure SQL Server Upgrade. - */ - public void beginStart(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters) { - beginStartWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().getBody(); - } - - /** - * Start an Azure SQL Server Upgrade. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @param parameters The required parameters for the Azure SQL Server Upgrade. - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @return the {@link ServiceCall} object - */ - public ServiceCall beginStartAsync(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters, final ServiceCallback serviceCallback) { - return ServiceCall.create(beginStartWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); - } - - /** - * Start an Azure SQL Server Upgrade. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @param parameters The required parameters for the Azure SQL Server Upgrade. - * @return the {@link ServiceResponse} object if successful. - */ - public Observable beginStartAsync(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters) { - return beginStartWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, Void>() { - @Override - public Void call(ServiceResponse response) { - return response.getBody(); - } - }); - } - - /** - * Start an Azure SQL Server Upgrade. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @param parameters The required parameters for the Azure SQL Server Upgrade. - * @return the {@link ServiceResponse} object if successful. - */ - public Observable> beginStartWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters) { - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (serverName == null) { - throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); - } - if (parameters == null) { - throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); - } - Validator.validate(parameters); - final String apiVersion = "2014-04-01"; - return service.beginStart(this.client.subscriptionId(), resourceGroupName, serverName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginStartDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse beginStartDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.mapperAdapter()) - .register(202, new TypeToken() { }.getType()) - .build(response); - } - -} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerUsagesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerUsagesInner.java deleted file mode 100644 index 082206e3e899..000000000000 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerUsagesInner.java +++ /dev/null @@ -1,141 +0,0 @@ -/** - * 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.AzureServiceResponseBuilder; -import com.microsoft.azure.CloudException; -import com.microsoft.rest.ServiceCall; -import com.microsoft.rest.ServiceCallback; -import com.microsoft.rest.ServiceResponse; -import java.io.IOException; -import java.util.List; -import okhttp3.ResponseBody; -import retrofit2.http.GET; -import retrofit2.http.Header; -import retrofit2.http.Headers; -import retrofit2.http.Path; -import retrofit2.http.Query; -import retrofit2.Response; -import rx.functions.Func1; -import rx.Observable; - -/** - * An instance of this class provides access to all the operations defined - * in ServerUsages. - */ -public final class ServerUsagesInner { - /** The Retrofit service to perform REST calls. */ - private ServerUsagesService service; - /** The service client containing this operation class. */ - private SqlManagementClientImpl client; - - /** - * Initializes an instance of ServerUsagesInner. - * - * @param retrofit the Retrofit instance built from a Retrofit Builder. - * @param client the instance of the service client containing this operation class. - */ - public ServerUsagesInner(Retrofit retrofit, SqlManagementClientImpl client) { - this.service = retrofit.create(ServerUsagesService.class); - this.client = client; - } - - /** - * The interface defining all the services for ServerUsages to be - * used by Retrofit to perform actually REST calls. - */ - interface ServerUsagesService { - @Headers("Content-Type: application/json; charset=utf-8") - @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages") - Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - } - - /** - * Returns information about Azure SQL Server usage. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @return the List<ServerMetricInner> object if successful. - */ - public List list(String resourceGroupName, String serverName) { - return listWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().getBody(); - } - - /** - * Returns information about Azure SQL Server usage. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @return the {@link ServiceCall} object - */ - public ServiceCall> listAsync(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { - return ServiceCall.create(listWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); - } - - /** - * Returns information about Azure SQL Server usage. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @return the observable to the List<ServerMetricInner> object - */ - public Observable> listAsync(String resourceGroupName, String serverName) { - return listWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { - @Override - public List call(ServiceResponse> response) { - return response.getBody(); - } - }); - } - - /** - * Returns information about Azure SQL Server usage. - * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. - * @param serverName The name of the Azure SQL Server - * @return the observable to the List<ServerMetricInner> object - */ - public Observable>> listWithServiceResponseAsync(String resourceGroupName, String serverName) { - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (serverName == null) { - throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); - } - final String apiVersion = "2014-04-01"; - return service.list(this.client.subscriptionId(), resourceGroupName, serverName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.getBody().getItems(), result.getResponse()); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) - .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/ServersInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServersInner.java index 57757a6b70a0..80b7deb453ac 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServersInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServersInner.java @@ -79,6 +79,26 @@ interface ServersService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers") Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/operationResults/versionUpgrade", method = "DELETE", hasBody = true) + Observable> cancelUpgrade(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/operationResults/versionUpgrade") + Observable> getUpgrade(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/upgrade") + Observable> startUpgrade(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerUpgradeStartParametersInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/upgrade") + Observable> beginStartUpgrade(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerUpgradeStartParametersInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages") + Observable> listUsages(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers("Content-Type: application/json; charset=utf-8") @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}") Observable> getServiceObjective(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("serviceObjectiveName") String serviceObjectiveName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -88,16 +108,16 @@ interface ServersService { Observable> listServiceObjectives(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") - @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRule}") - Observable> createOrUpdateFirewallRule(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRule") String firewallRule, @Query("api-version") String apiVersion, @Body FirewallRuleInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}") + Observable> createOrUpdateFirewallRule(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @Query("api-version") String apiVersion, @Body ServerFirewallRuleInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") - @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRule}", method = "DELETE", hasBody = true) - Observable> deleteFirewallRules(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRule") String firewallRule, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", method = "DELETE", hasBody = true) + Observable> deleteFirewallRule(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") - @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRule}") - Observable> getFirewallRule(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRule") String firewallRule, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}") + Observable> getFirewallRule(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers("Content-Type: application/json; charset=utf-8") @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules") @@ -556,6 +576,392 @@ private ServiceResponse> listByResourceGroupDelegate(Resp .build(response); } + /** + * Cancel a pending upgrade for the Azure SQL Server. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + */ + public void cancelUpgrade(String resourceGroupName, String serverName) { + cancelUpgradeWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().getBody(); + } + + /** + * Cancel a pending upgrade for the Azure SQL Server. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall cancelUpgradeAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceCall.create(cancelUpgradeWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Cancel a pending upgrade for the Azure SQL Server. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelUpgradeAsync(String resourceGroupName, String serverName) { + return cancelUpgradeWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Cancel a pending upgrade for the Azure SQL Server. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelUpgradeWithServiceResponseAsync(String resourceGroupName, String serverName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + final String apiVersion = "2014-04-01"; + return service.cancelUpgrade(this.client.subscriptionId(), resourceGroupName, serverName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelUpgradeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelUpgradeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .build(response); + } + + /** + * Returns information about Upgrade status of an Azure SQL Server. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @return the ServerUpgradeGetResultInner object if successful. + */ + public ServerUpgradeGetResultInner getUpgrade(String resourceGroupName, String serverName) { + return getUpgradeWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().getBody(); + } + + /** + * Returns information about Upgrade status of an Azure SQL Server. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall getUpgradeAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceCall.create(getUpgradeWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns information about Upgrade status of an Azure SQL Server. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @return the observable to the ServerUpgradeGetResultInner object + */ + public Observable getUpgradeAsync(String resourceGroupName, String serverName) { + return getUpgradeWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerUpgradeGetResultInner>() { + @Override + public ServerUpgradeGetResultInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Returns information about Upgrade status of an Azure SQL Server. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @return the observable to the ServerUpgradeGetResultInner object + */ + public Observable> getUpgradeWithServiceResponseAsync(String resourceGroupName, String serverName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + final String apiVersion = "2014-04-01"; + return service.getUpgrade(this.client.subscriptionId(), resourceGroupName, serverName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getUpgradeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getUpgradeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Start an Azure SQL Server Upgrade. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @param parameters The required parameters for the Azure SQL Server Upgrade. + */ + public void startUpgrade(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters) { + startUpgradeWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().getBody(); + } + + /** + * Start an Azure SQL Server Upgrade. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @param parameters The required parameters for the Azure SQL Server Upgrade. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall startUpgradeAsync(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceCall.create(startUpgradeWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Start an Azure SQL Server Upgrade. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @param parameters The required parameters for the Azure SQL Server Upgrade. + * @return the observable for the request + */ + public Observable startUpgradeAsync(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters) { + return startUpgradeWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Start an Azure SQL Server Upgrade. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @param parameters The required parameters for the Azure SQL Server Upgrade. + * @return the observable for the request + */ + public Observable> startUpgradeWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2014-04-01"; + Observable> observable = service.startUpgrade(this.client.subscriptionId(), resourceGroupName, serverName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Start an Azure SQL Server Upgrade. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @param parameters The required parameters for the Azure SQL Server Upgrade. + */ + public void beginStartUpgrade(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters) { + beginStartUpgradeWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().getBody(); + } + + /** + * Start an Azure SQL Server Upgrade. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @param parameters The required parameters for the Azure SQL Server Upgrade. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginStartUpgradeAsync(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginStartUpgradeWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Start an Azure SQL Server Upgrade. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @param parameters The required parameters for the Azure SQL Server Upgrade. + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginStartUpgradeAsync(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters) { + return beginStartUpgradeWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Start an Azure SQL Server Upgrade. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @param parameters The required parameters for the Azure SQL Server Upgrade. + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginStartUpgradeWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpgradeStartParametersInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2014-04-01"; + return service.beginStartUpgrade(this.client.subscriptionId(), resourceGroupName, serverName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginStartUpgradeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginStartUpgradeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .build(response); + } + + /** + * Returns information about Azure SQL Server usage. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @return the List<ServerMetricInner> object if successful. + */ + public List listUsages(String resourceGroupName, String serverName) { + return listUsagesWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().getBody(); + } + + /** + * Returns information about Azure SQL Server usage. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall> listUsagesAsync(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceCall.create(listUsagesWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns information about Azure SQL Server usage. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @return the observable to the List<ServerMetricInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String serverName) { + return listUsagesWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.getBody(); + } + }); + } + + /** + * Returns information about Azure SQL Server usage. + * + * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param serverName The name of the Azure SQL Server + * @return the observable to the List<ServerMetricInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String serverName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + final String apiVersion = "2014-04-01"; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, serverName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listUsagesDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.getBody().getItems(), result.getResponse()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listUsagesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Returns information about an Azure SQL Database Service Objective. * @@ -725,12 +1131,12 @@ private ServiceResponse> listServiceObjectivesD * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server - * @param firewallRule The name of the Azure SQL Server Firewall Rule. + * @param firewallRuleName The name of the Azure SQL Server Firewall Rule. * @param parameters The required parameters for createing or updating a firewall rule. - * @return the FirewallRuleInner object if successful. + * @return the ServerFirewallRuleInner object if successful. */ - public FirewallRuleInner createOrUpdateFirewallRule(String resourceGroupName, String serverName, String firewallRule, FirewallRuleInner parameters) { - return createOrUpdateFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRule, parameters).toBlocking().single().getBody(); + public ServerFirewallRuleInner createOrUpdateFirewallRule(String resourceGroupName, String serverName, String firewallRuleName, ServerFirewallRuleInner parameters) { + return createOrUpdateFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).toBlocking().single().getBody(); } /** @@ -738,13 +1144,13 @@ public FirewallRuleInner createOrUpdateFirewallRule(String resourceGroupName, St * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server - * @param firewallRule The name of the Azure SQL Server Firewall Rule. + * @param firewallRuleName The name of the Azure SQL Server Firewall Rule. * @param parameters The required parameters for createing or updating a firewall rule. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */ - public ServiceCall createOrUpdateFirewallRuleAsync(String resourceGroupName, String serverName, String firewallRule, FirewallRuleInner parameters, final ServiceCallback serviceCallback) { - return ServiceCall.create(createOrUpdateFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRule, parameters), serviceCallback); + public ServiceCall createOrUpdateFirewallRuleAsync(String resourceGroupName, String serverName, String firewallRuleName, ServerFirewallRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceCall.create(createOrUpdateFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters), serviceCallback); } /** @@ -752,14 +1158,14 @@ public ServiceCall createOrUpdateFirewallRuleAsync(String res * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server - * @param firewallRule The name of the Azure SQL Server Firewall Rule. + * @param firewallRuleName The name of the Azure SQL Server Firewall Rule. * @param parameters The required parameters for createing or updating a firewall rule. - * @return the observable to the FirewallRuleInner object + * @return the observable to the ServerFirewallRuleInner object */ - public Observable createOrUpdateFirewallRuleAsync(String resourceGroupName, String serverName, String firewallRule, FirewallRuleInner parameters) { - return createOrUpdateFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRule, parameters).map(new Func1, FirewallRuleInner>() { + public Observable createOrUpdateFirewallRuleAsync(String resourceGroupName, String serverName, String firewallRuleName, ServerFirewallRuleInner parameters) { + return createOrUpdateFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).map(new Func1, ServerFirewallRuleInner>() { @Override - public FirewallRuleInner call(ServiceResponse response) { + public ServerFirewallRuleInner call(ServiceResponse response) { return response.getBody(); } }); @@ -770,11 +1176,11 @@ public FirewallRuleInner call(ServiceResponse response) { * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server - * @param firewallRule The name of the Azure SQL Server Firewall Rule. + * @param firewallRuleName The name of the Azure SQL Server Firewall Rule. * @param parameters The required parameters for createing or updating a firewall rule. - * @return the observable to the FirewallRuleInner object + * @return the observable to the ServerFirewallRuleInner object */ - public Observable> createOrUpdateFirewallRuleWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRule, FirewallRuleInner parameters) { + public Observable> createOrUpdateFirewallRuleWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName, ServerFirewallRuleInner parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -784,20 +1190,20 @@ public Observable> createOrUpdateFirewallRule if (serverName == null) { throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); } - if (firewallRule == null) { - throw new IllegalArgumentException("Parameter firewallRule is required and cannot be null."); + if (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName 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 = "2014-04-01"; - return service.createOrUpdateFirewallRule(this.client.subscriptionId(), resourceGroupName, serverName, firewallRule, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.createOrUpdateFirewallRule(this.client.subscriptionId(), resourceGroupName, serverName, firewallRuleName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = createOrUpdateFirewallRuleDelegate(response); + ServiceResponse clientResponse = createOrUpdateFirewallRuleDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -806,10 +1212,10 @@ public Observable> call(Response createOrUpdateFirewallRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.mapperAdapter()) - .register(200, new TypeToken() { }.getType()) - .register(201, new TypeToken() { }.getType()) + private ServiceResponse createOrUpdateFirewallRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -819,10 +1225,10 @@ private ServiceResponse createOrUpdateFirewallRuleDelegate(Re * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server - * @param firewallRule The name of the Azure SQL Server Firewall Rule. + * @param firewallRuleName The name of the Azure SQL Server Firewall Rule. */ - public void deleteFirewallRules(String resourceGroupName, String serverName, String firewallRule) { - deleteFirewallRulesWithServiceResponseAsync(resourceGroupName, serverName, firewallRule).toBlocking().single().getBody(); + public void deleteFirewallRule(String resourceGroupName, String serverName, String firewallRuleName) { + deleteFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).toBlocking().single().getBody(); } /** @@ -830,12 +1236,12 @@ public void deleteFirewallRules(String resourceGroupName, String serverName, Str * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server - * @param firewallRule The name of the Azure SQL Server Firewall Rule. + * @param firewallRuleName The name of the Azure SQL Server Firewall Rule. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */ - public ServiceCall deleteFirewallRulesAsync(String resourceGroupName, String serverName, String firewallRule, final ServiceCallback serviceCallback) { - return ServiceCall.create(deleteFirewallRulesWithServiceResponseAsync(resourceGroupName, serverName, firewallRule), serviceCallback); + public ServiceCall deleteFirewallRuleAsync(String resourceGroupName, String serverName, String firewallRuleName, final ServiceCallback serviceCallback) { + return ServiceCall.create(deleteFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName), serviceCallback); } /** @@ -843,11 +1249,11 @@ public ServiceCall deleteFirewallRulesAsync(String resourceGroupName, Stri * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server - * @param firewallRule The name of the Azure SQL Server Firewall Rule. + * @param firewallRuleName The name of the Azure SQL Server Firewall Rule. * @return the {@link ServiceResponse} object if successful. */ - public Observable deleteFirewallRulesAsync(String resourceGroupName, String serverName, String firewallRule) { - return deleteFirewallRulesWithServiceResponseAsync(resourceGroupName, serverName, firewallRule).map(new Func1, Void>() { + public Observable deleteFirewallRuleAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return deleteFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { return response.getBody(); @@ -860,10 +1266,10 @@ public Void call(ServiceResponse response) { * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server - * @param firewallRule The name of the Azure SQL Server Firewall Rule. + * @param firewallRuleName The name of the Azure SQL Server Firewall Rule. * @return the {@link ServiceResponse} object if successful. */ - public Observable> deleteFirewallRulesWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRule) { + public Observable> deleteFirewallRuleWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -873,16 +1279,16 @@ public Observable> deleteFirewallRulesWithServiceResponseA if (serverName == null) { throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); } - if (firewallRule == null) { - throw new IllegalArgumentException("Parameter firewallRule is required and cannot be null."); + if (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null."); } final String apiVersion = "2014-04-01"; - return service.deleteFirewallRules(this.client.subscriptionId(), resourceGroupName, serverName, firewallRule, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.deleteFirewallRule(this.client.subscriptionId(), resourceGroupName, serverName, firewallRuleName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = deleteFirewallRulesDelegate(response); + ServiceResponse clientResponse = deleteFirewallRuleDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -891,7 +1297,7 @@ public Observable> call(Response response) { }); } - private ServiceResponse deleteFirewallRulesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse deleteFirewallRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return new AzureServiceResponseBuilder(this.client.mapperAdapter()) .register(200, new TypeToken() { }.getType()) .register(204, new TypeToken() { }.getType()) @@ -903,11 +1309,11 @@ private ServiceResponse deleteFirewallRulesDelegate(Response * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server - * @param firewallRule The name of the Azure SQL Server Firewall Rule. - * @return the FirewallRuleInner object if successful. + * @param firewallRuleName The name of the Azure SQL Server Firewall Rule. + * @return the ServerFirewallRuleInner object if successful. */ - public FirewallRuleInner getFirewallRule(String resourceGroupName, String serverName, String firewallRule) { - return getFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRule).toBlocking().single().getBody(); + public ServerFirewallRuleInner getFirewallRule(String resourceGroupName, String serverName, String firewallRuleName) { + return getFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).toBlocking().single().getBody(); } /** @@ -915,12 +1321,12 @@ public FirewallRuleInner getFirewallRule(String resourceGroupName, String server * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server - * @param firewallRule The name of the Azure SQL Server Firewall Rule. + * @param firewallRuleName The name of the Azure SQL Server Firewall Rule. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */ - public ServiceCall getFirewallRuleAsync(String resourceGroupName, String serverName, String firewallRule, final ServiceCallback serviceCallback) { - return ServiceCall.create(getFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRule), serviceCallback); + public ServiceCall getFirewallRuleAsync(String resourceGroupName, String serverName, String firewallRuleName, final ServiceCallback serviceCallback) { + return ServiceCall.create(getFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName), serviceCallback); } /** @@ -928,13 +1334,13 @@ public ServiceCall getFirewallRuleAsync(String resourceGroupN * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server - * @param firewallRule The name of the Azure SQL Server Firewall Rule. - * @return the observable to the FirewallRuleInner object + * @param firewallRuleName The name of the Azure SQL Server Firewall Rule. + * @return the observable to the ServerFirewallRuleInner object */ - public Observable getFirewallRuleAsync(String resourceGroupName, String serverName, String firewallRule) { - return getFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRule).map(new Func1, FirewallRuleInner>() { + public Observable getFirewallRuleAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return getFirewallRuleWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).map(new Func1, ServerFirewallRuleInner>() { @Override - public FirewallRuleInner call(ServiceResponse response) { + public ServerFirewallRuleInner call(ServiceResponse response) { return response.getBody(); } }); @@ -945,10 +1351,10 @@ public FirewallRuleInner call(ServiceResponse response) { * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server - * @param firewallRule The name of the Azure SQL Server Firewall Rule. - * @return the observable to the FirewallRuleInner object + * @param firewallRuleName The name of the Azure SQL Server Firewall Rule. + * @return the observable to the ServerFirewallRuleInner object */ - public Observable> getFirewallRuleWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRule) { + public Observable> getFirewallRuleWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -958,16 +1364,16 @@ public Observable> getFirewallRuleWithService if (serverName == null) { throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); } - if (firewallRule == null) { - throw new IllegalArgumentException("Parameter firewallRule is required and cannot be null."); + if (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null."); } final String apiVersion = "2014-04-01"; - return service.getFirewallRule(this.client.subscriptionId(), resourceGroupName, serverName, firewallRule, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.getFirewallRule(this.client.subscriptionId(), resourceGroupName, serverName, firewallRuleName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = getFirewallRuleDelegate(response); + ServiceResponse clientResponse = getFirewallRuleDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -976,9 +1382,9 @@ public Observable> call(Response getFirewallRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder(this.client.mapperAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse getFirewallRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -988,9 +1394,9 @@ private ServiceResponse getFirewallRuleDelegate(Response listFirewallRules(String resourceGroupName, String serverName) { + public List listFirewallRules(String resourceGroupName, String serverName) { return listFirewallRulesWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().getBody(); } @@ -1002,7 +1408,7 @@ public List listFirewallRules(String resourceGroupName, Strin * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */ - public ServiceCall> listFirewallRulesAsync(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + public ServiceCall> listFirewallRulesAsync(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { return ServiceCall.create(listFirewallRulesWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); } @@ -1011,12 +1417,12 @@ public ServiceCall> listFirewallRulesAsync(String resour * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server - * @return the observable to the List<FirewallRuleInner> object + * @return the observable to the List<ServerFirewallRuleInner> object */ - public Observable> listFirewallRulesAsync(String resourceGroupName, String serverName) { - return listFirewallRulesWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + public Observable> listFirewallRulesAsync(String resourceGroupName, String serverName) { + return listFirewallRulesWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { @Override - public List call(ServiceResponse> response) { + public List call(ServiceResponse> response) { return response.getBody(); } }); @@ -1027,9 +1433,9 @@ public List call(ServiceResponse> res * * @param resourceGroupName The name of the Resource Group to which the resource belongs. * @param serverName The name of the Azure SQL Server - * @return the observable to the List<FirewallRuleInner> object + * @return the observable to the List<ServerFirewallRuleInner> object */ - public Observable>> listFirewallRulesWithServiceResponseAsync(String resourceGroupName, String serverName) { + public Observable>> listFirewallRulesWithServiceResponseAsync(String resourceGroupName, String serverName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1041,12 +1447,12 @@ public Observable>> listFirewallRulesWit } final String apiVersion = "2014-04-01"; return service.listFirewallRules(this.client.subscriptionId(), resourceGroupName, serverName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listFirewallRulesDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.getBody().getItems(), result.getResponse()); + ServiceResponse> result = listFirewallRulesDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.getBody().getItems(), result.getResponse()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1055,9 +1461,9 @@ public Observable>> call(Response> listFirewallRulesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listFirewallRulesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, CloudException>(this.client.mapperAdapter()) + .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/SloUsageMetricInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SloUsageMetricInner.java index 47640c961a11..895404ca44b6 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SloUsageMetricInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SloUsageMetricInner.java @@ -8,6 +8,7 @@ package com.microsoft.azure.management.sql.implementation; +import com.microsoft.azure.management.sql.ServiceObjectiveName; import java.util.UUID; import com.microsoft.azure.Resource; @@ -16,12 +17,13 @@ */ public class SloUsageMetricInner extends Resource { /** - * Gets or sets serviceLevelObjective for SLO usage metric. + * The serviceLevelObjective for SLO usage metric. Possible values + * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3'. */ - private String serviceLevelObjective; + private ServiceObjectiveName serviceLevelObjective; /** - * Gets or sets serviceLevelObjectiveId for SLO usage metric. + * The serviceLevelObjectiveId for SLO usage metric. */ private UUID serviceLevelObjectiveId; @@ -35,7 +37,7 @@ public class SloUsageMetricInner extends Resource { * * @return the serviceLevelObjective value */ - public String serviceLevelObjective() { + public ServiceObjectiveName serviceLevelObjective() { return this.serviceLevelObjective; } @@ -45,7 +47,7 @@ public String serviceLevelObjective() { * @param serviceLevelObjective the serviceLevelObjective value to set * @return the SloUsageMetricInner object itself. */ - public SloUsageMetricInner withServiceLevelObjective(String serviceLevelObjective) { + public SloUsageMetricInner withServiceLevelObjective(ServiceObjectiveName serviceLevelObjective) { this.serviceLevelObjective = serviceLevelObjective; return this; } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlDatabaseImpl.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlDatabaseImpl.java index 954c630d223b..45879580c204 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlDatabaseImpl.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlDatabaseImpl.java @@ -11,6 +11,7 @@ import com.microsoft.azure.management.resources.fluentcore.model.Creatable; import com.microsoft.azure.management.sql.DatabaseEditions; import com.microsoft.azure.management.sql.ElasticPoolEditions; +import com.microsoft.azure.management.sql.ServiceObjectiveName; import com.microsoft.azure.management.sql.SqlDatabase; import com.microsoft.azure.management.sql.SqlElasticPool; import com.microsoft.azure.management.sql.SqlElasticPools; @@ -95,12 +96,12 @@ public String maxSizeBytes() { } @Override - public String requestedServiceObjectiveName() { + public ServiceObjectiveName requestedServiceObjectiveName() { return this.inner().requestedServiceObjectiveName(); } @Override - public String serviceLevelObjective() { + public ServiceObjectiveName serviceLevelObjective() { return this.inner().serviceLevelObjective(); } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlElasticPoolImpl.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlElasticPoolImpl.java index 9a4a204f12ca..3d8b61ae661d 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlElasticPoolImpl.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlElasticPoolImpl.java @@ -10,6 +10,7 @@ import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.IndependentChildResourceImpl; import com.microsoft.azure.management.resources.fluentcore.model.Creatable; import com.microsoft.azure.management.sql.ElasticPoolEditions; +import com.microsoft.azure.management.sql.ElasticPoolState; import com.microsoft.azure.management.sql.SqlElasticPool; import com.microsoft.azure.management.sql.SqlServer; import org.joda.time.DateTime; @@ -49,7 +50,7 @@ public DateTime creationDate() { } @Override - public String state() { + public ElasticPoolState state() { return this.inner().state(); } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlFirewallRuleImpl.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlFirewallRuleImpl.java index 598bb1a72ef2..32ffe0039a98 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlFirewallRuleImpl.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlFirewallRuleImpl.java @@ -24,7 +24,7 @@ public class SqlFirewallRuleImpl extends IndependentChildImpl< SqlFirewallRule, SqlServer, - FirewallRuleInner, + ServerFirewallRuleInner, SqlFirewallRuleImpl> implements SqlFirewallRule, SqlFirewallRule.Definition, @@ -33,7 +33,7 @@ public class SqlFirewallRuleImpl private final ServersInner innerCollection; protected SqlFirewallRuleImpl(String name, - FirewallRuleInner innerObject, + ServerFirewallRuleInner innerObject, ServersInner innerCollection) { super(name, innerObject); this.innerCollection = innerCollection; @@ -62,7 +62,7 @@ public SqlFirewallRule refresh() { } @Override - protected void setParentName(FirewallRuleInner inner) { + protected void setParentName(ServerFirewallRuleInner inner) { if (inner.id() != null) { this.parentName = ResourceId.parseResourceId(inner.id()).parent().name(); } @@ -73,9 +73,9 @@ protected Observable createChildResourceAsync() { final SqlFirewallRule self = this; return this.innerCollection.createOrUpdateFirewallRuleAsync(this.resourceGroupName(), this.sqlServerName(), this.name(), this.inner()) - .map(new Func1() { + .map(new Func1() { @Override - public SqlFirewallRule call(FirewallRuleInner databaseInner) { + public SqlFirewallRule call(ServerFirewallRuleInner databaseInner) { setInner(databaseInner); return self; diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlFirewallRulesImpl.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlFirewallRulesImpl.java index f4594a49cacf..7ee3447bb276 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlFirewallRulesImpl.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlFirewallRulesImpl.java @@ -23,7 +23,7 @@ public class SqlFirewallRulesImpl extends IndependentChildrenImpl< SqlFirewallRule, SqlFirewallRuleImpl, - FirewallRuleInner, + ServerFirewallRuleInner, ServersInner, SqlServerManager> implements SqlFirewallRules, @@ -37,7 +37,7 @@ protected SqlFirewallRulesImpl(ServersInner innerCollection, SqlServerManager ma @Override protected SqlFirewallRuleImpl wrapModel(String name) { - FirewallRuleInner inner = new FirewallRuleInner(); + ServerFirewallRuleInner inner = new ServerFirewallRuleInner(); return new SqlFirewallRuleImpl( name, @@ -56,7 +56,7 @@ public PagedList listByParent(String resourceGroupName, String } @Override - protected SqlFirewallRuleImpl wrapModel(FirewallRuleInner inner) { + protected SqlFirewallRuleImpl wrapModel(ServerFirewallRuleInner inner) { if (inner == null) { return null; } @@ -70,7 +70,7 @@ public SqlFirewallRule.DefinitionStages.Blank define(String name) { @Override public Observable deleteByParentAsync(String groupName, String parentName, String name) { - return this.innerCollection.deleteFirewallRulesAsync(groupName, parentName, name); + return this.innerCollection.deleteFirewallRuleAsync(groupName, parentName, name); } @Override @@ -95,7 +95,7 @@ public PagedList listBySqlServer(GroupableResource sqlServer) { @Override public SqlFirewallRuleImpl definedWithSqlServer(String resourceGroupName, String sqlServerName, String firewallRuleName) { - FirewallRuleInner inner = new FirewallRuleInner(); + ServerFirewallRuleInner inner = new ServerFirewallRuleInner(); return new SqlFirewallRuleImpl( firewallRuleName, 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 542cfc8c2a7d..c35ecb89e9c7 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 @@ -28,11 +28,11 @@ public AzureClient getAzureClient() { return this.azureClient; } - /** The subscription credentials which uniquely identify Microsoft Azure subscription. */ + /** Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ private String subscriptionId; /** - * Gets The subscription credentials which uniquely identify Microsoft Azure subscription. + * Gets Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. * * @return the subscriptionId value. */ @@ -41,7 +41,7 @@ public String subscriptionId() { } /** - * Sets The subscription credentials which uniquely identify Microsoft Azure subscription. + * Sets Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. * * @param subscriptionId the subscriptionId value. * @return the service client itself @@ -224,32 +224,6 @@ public ServersInner servers() { return this.servers; } - /** - * The ServerUpgradesInner object to access its operations. - */ - private ServerUpgradesInner serverUpgrades; - - /** - * Gets the ServerUpgradesInner object to access its operations. - * @return the ServerUpgradesInner object. - */ - public ServerUpgradesInner serverUpgrades() { - return this.serverUpgrades; - } - - /** - * The ServerUsagesInner object to access its operations. - */ - private ServerUsagesInner serverUsages; - - /** - * Gets the ServerUsagesInner object to access its operations. - * @return the ServerUsagesInner object. - */ - public ServerUsagesInner serverUsages() { - return this.serverUsages; - } - /** * The ElasticPoolsInner object to access its operations. */ @@ -263,19 +237,6 @@ public ElasticPoolsInner elasticPools() { return this.elasticPools; } - /** - * The ElasticPoolsDatabaseActivitysInner object to access its operations. - */ - private ElasticPoolsDatabaseActivitysInner elasticPoolsDatabaseActivitys; - - /** - * Gets the ElasticPoolsDatabaseActivitysInner object to access its operations. - * @return the ElasticPoolsDatabaseActivitysInner object. - */ - public ElasticPoolsDatabaseActivitysInner elasticPoolsDatabaseActivitys() { - return this.elasticPoolsDatabaseActivitys; - } - /** * The RecommendedElasticPoolsInner object to access its operations. */ @@ -372,10 +333,7 @@ protected void initialize() { this.serverAdvisors = new ServerAdvisorsInner(restClient().retrofit(), this); this.serverRecommendedActions = new ServerRecommendedActionsInner(restClient().retrofit(), this); this.servers = new ServersInner(restClient().retrofit(), this); - this.serverUpgrades = new ServerUpgradesInner(restClient().retrofit(), this); - this.serverUsages = new ServerUsagesInner(restClient().retrofit(), this); this.elasticPools = new ElasticPoolsInner(restClient().retrofit(), this); - this.elasticPoolsDatabaseActivitys = new ElasticPoolsDatabaseActivitysInner(restClient().retrofit(), this); this.recommendedElasticPools = new RecommendedElasticPoolsInner(restClient().retrofit(), this); this.auditingPolicies = new AuditingPoliciesInner(restClient().retrofit(), this); this.dataMaskings = new DataMaskingsInner(restClient().retrofit(), this);