diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseState.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseState.java new file mode 100644 index 00000000000..415b124e253 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseState.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseState. + */ +public final class DatabaseState extends ExpandableStringEnum { + /** Static value All for DatabaseState. */ + public static final DatabaseState ALL = fromString("All"); + + /** Static value Live for DatabaseState. */ + public static final DatabaseState LIVE = fromString("Live"); + + /** Static value Deleted for DatabaseState. */ + public static final DatabaseState DELETED = fromString("Deleted"); + + /** + * Creates or finds a DatabaseState from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseState + */ + @JsonCreator + public static DatabaseState fromString(String name) { + return fromString(name, DatabaseState.class); + } + + /** + * @return known DatabaseState values + */ + public static Collection values() { + return values(DatabaseState.class); + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/BackupLongTermRetentionPoliciesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/BackupLongTermRetentionPoliciesInner.java index aa391ba7f30..628ed65af89 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/BackupLongTermRetentionPoliciesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/BackupLongTermRetentionPoliciesInner.java @@ -16,7 +16,6 @@ import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator; import java.io.IOException; -import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; @@ -56,25 +55,25 @@ public BackupLongTermRetentionPoliciesInner(Retrofit retrofit, SqlManagementClie */ interface BackupLongTermRetentionPoliciesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.BackupLongTermRetentionPolicies get" }) - @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}") - Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("backupLongTermRetentionPolicyName") String backupLongTermRetentionPolicyName, @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}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.BackupLongTermRetentionPolicies createOrUpdate" }) - @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}") - Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("backupLongTermRetentionPolicyName") String backupLongTermRetentionPolicyName, @Query("api-version") String apiVersion, @Body BackupLongTermRetentionPolicyInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Body BackupLongTermRetentionPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.BackupLongTermRetentionPolicies beginCreateOrUpdate" }) - @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}") - Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("backupLongTermRetentionPolicyName") String backupLongTermRetentionPolicyName, @Query("api-version") String apiVersion, @Body BackupLongTermRetentionPolicyInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Body BackupLongTermRetentionPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.BackupLongTermRetentionPolicies listByDatabase" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies") - Observable> listByDatabase(@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> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } /** - * Returns a database backup long term retention policy. + * Gets a database's long term retention policy. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. @@ -89,7 +88,7 @@ public BackupLongTermRetentionPolicyInner get(String resourceGroupName, String s } /** - * Returns a database backup long term retention policy. + * Gets a database's long term retention policy. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. @@ -103,7 +102,7 @@ public ServiceFuture getAsync(String resourc } /** - * Returns a database backup long term retention policy. + * Gets a database's long term retention policy. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. @@ -121,7 +120,7 @@ public BackupLongTermRetentionPolicyInner call(ServiceResponse> getWithServiceResponseAsync(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."); } @@ -142,9 +138,12 @@ public Observable> getWithSe if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } - final String backupLongTermRetentionPolicyName = "Default"; - final String apiVersion = "2014-04-01"; - return service.get(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, backupLongTermRetentionPolicyName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String policyName = "default"; + final String apiVersion = "2017-03-01-preview"; + return service.get(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -166,12 +165,12 @@ private ServiceResponse getDelegate(Response } /** - * Creates or updates a database backup long term retention policy. + * Sets a database's long term retention policy. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. - * @param databaseName The name of the database - * @param parameters The required parameters to update a backup long term retention policy + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -182,12 +181,12 @@ public BackupLongTermRetentionPolicyInner createOrUpdate(String resourceGroupNam } /** - * Creates or updates a database backup long term retention policy. + * Sets a database's long term retention policy. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. - * @param databaseName The name of the database - * @param parameters The required parameters to update a backup long term retention policy + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -197,12 +196,12 @@ public ServiceFuture createOrUpdateAsync(Str } /** - * Creates or updates a database backup long term retention policy. + * Sets a database's long term retention policy. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. - * @param databaseName The name of the database - * @param parameters The required parameters to update a backup long term retention policy + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ @@ -216,19 +215,16 @@ public BackupLongTermRetentionPolicyInner call(ServiceResponse> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner 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."); } @@ -238,23 +234,26 @@ public Observable> createOrU if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); - final String backupLongTermRetentionPolicyName = "Default"; - final String apiVersion = "2014-04-01"; - Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, backupLongTermRetentionPolicyName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + final String policyName = "default"; + final String apiVersion = "2017-03-01-preview"; + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); } /** - * Creates or updates a database backup long term retention policy. + * Sets a database's long term retention policy. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. - * @param databaseName The name of the database - * @param parameters The required parameters to update a backup long term retention policy + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -265,12 +264,12 @@ public BackupLongTermRetentionPolicyInner beginCreateOrUpdate(String resourceGro } /** - * Creates or updates a database backup long term retention policy. + * Sets a database's long term retention policy. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. - * @param databaseName The name of the database - * @param parameters The required parameters to update a backup long term retention policy + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -280,12 +279,12 @@ public ServiceFuture beginCreateOrUpdateAsyn } /** - * Creates or updates a database backup long term retention policy. + * Sets a database's long term retention policy. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. - * @param databaseName The name of the database - * @param parameters The required parameters to update a backup long term retention policy + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BackupLongTermRetentionPolicyInner object */ @@ -299,19 +298,16 @@ public BackupLongTermRetentionPolicyInner call(ServiceResponse> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner 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."); } @@ -321,13 +317,16 @@ public Observable> beginCrea if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); - final String backupLongTermRetentionPolicyName = "Default"; - final String apiVersion = "2014-04-01"; - return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, backupLongTermRetentionPolicyName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + final String policyName = "default"; + final String apiVersion = "2017-03-01-preview"; + return service.beginCreateOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -344,14 +343,13 @@ public Observable> call(Resp private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .register(201, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } /** - * Returns a database backup long term retention policy. + * Gets a database's long term retention policy. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. @@ -359,14 +357,14 @@ private ServiceResponse beginCreateOrUpdateD * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<BackupLongTermRetentionPolicyInner> object if successful. + * @return the BackupLongTermRetentionPolicyInner object if successful. */ - public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + public BackupLongTermRetentionPolicyInner listByDatabase(String resourceGroupName, String serverName, String databaseName) { return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); } /** - * Returns a database backup long term retention policy. + * Gets a database's long term retention policy. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. @@ -375,41 +373,38 @@ public List listByDatabase(String resourceGr * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + public ServiceFuture listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); } /** - * Returns a database backup long term retention policy. + * Gets a database's long term retention policy. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. * @param databaseName The name of the database. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<BackupLongTermRetentionPolicyInner> object + * @return the observable to the BackupLongTermRetentionPolicyInner object */ - public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { - return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupLongTermRetentionPolicyInner>() { @Override - public List call(ServiceResponse> response) { + public BackupLongTermRetentionPolicyInner call(ServiceResponse response) { return response.body(); } }); } /** - * Returns a database backup long term retention policy. + * Gets a database's long term retention policy. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. * @param databaseName The name of the database. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<BackupLongTermRetentionPolicyInner> object + * @return the observable to the BackupLongTermRetentionPolicyInner object */ - public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } + public Observable> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -419,14 +414,16 @@ public Observable>> lis if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } - final String apiVersion = "2014-04-01"; - return service.listByDatabase(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable>> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse> result = listByDatabaseDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + ServiceResponse clientResponse = listByDatabaseDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -435,9 +432,9 @@ public Observable>> cal }); } - private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/BackupLongTermRetentionPolicyInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/BackupLongTermRetentionPolicyInner.java index f82ed116e2d..fa8e34765d6 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/BackupLongTermRetentionPolicyInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/BackupLongTermRetentionPolicyInner.java @@ -8,80 +8,115 @@ package com.microsoft.azure.management.sql.implementation; -import com.microsoft.azure.management.sql.BackupLongTermRetentionPolicyState; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; /** - * A backup long term retention policy. + * A long term retention policy. */ @JsonFlatten public class BackupLongTermRetentionPolicyInner extends ProxyResourceInner { /** - * The geo-location where the resource lives. + * The weekly retention policy for an LTR backup in an ISO 8601 format. */ - @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) - private String location; + @JsonProperty(value = "properties.weeklyRetention") + private String weeklyRetention; /** - * The status of the backup long term retention policy. Possible values - * include: 'Disabled', 'Enabled'. + * The montly retention policy for an LTR backup in an ISO 8601 format. */ - @JsonProperty(value = "properties.state", required = true) - private BackupLongTermRetentionPolicyState state; + @JsonProperty(value = "properties.monthlyRetention") + private String monthlyRetention; /** - * The azure recovery services backup protection policy resource id. + * The yearly retention policy for an LTR backup in an ISO 8601 format. */ - @JsonProperty(value = "properties.recoveryServicesBackupPolicyResourceId", required = true) - private String recoveryServicesBackupPolicyResourceId; + @JsonProperty(value = "properties.yearlyRetention") + private String yearlyRetention; /** - * Get the location value. + * The week of year to take the yearly backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.weekOfYear") + private Integer weekOfYear; + + /** + * Get the weeklyRetention value. + * + * @return the weeklyRetention value + */ + public String weeklyRetention() { + return this.weeklyRetention; + } + + /** + * Set the weeklyRetention value. + * + * @param weeklyRetention the weeklyRetention value to set + * @return the BackupLongTermRetentionPolicyInner object itself. + */ + public BackupLongTermRetentionPolicyInner withWeeklyRetention(String weeklyRetention) { + this.weeklyRetention = weeklyRetention; + return this; + } + + /** + * Get the monthlyRetention value. * - * @return the location value + * @return the monthlyRetention value */ - public String location() { - return this.location; + public String monthlyRetention() { + return this.monthlyRetention; + } + + /** + * Set the monthlyRetention value. + * + * @param monthlyRetention the monthlyRetention value to set + * @return the BackupLongTermRetentionPolicyInner object itself. + */ + public BackupLongTermRetentionPolicyInner withMonthlyRetention(String monthlyRetention) { + this.monthlyRetention = monthlyRetention; + return this; } /** - * Get the state value. + * Get the yearlyRetention value. * - * @return the state value + * @return the yearlyRetention value */ - public BackupLongTermRetentionPolicyState state() { - return this.state; + public String yearlyRetention() { + return this.yearlyRetention; } /** - * Set the state value. + * Set the yearlyRetention value. * - * @param state the state value to set + * @param yearlyRetention the yearlyRetention value to set * @return the BackupLongTermRetentionPolicyInner object itself. */ - public BackupLongTermRetentionPolicyInner withState(BackupLongTermRetentionPolicyState state) { - this.state = state; + public BackupLongTermRetentionPolicyInner withYearlyRetention(String yearlyRetention) { + this.yearlyRetention = yearlyRetention; return this; } /** - * Get the recoveryServicesBackupPolicyResourceId value. + * Get the weekOfYear value. * - * @return the recoveryServicesBackupPolicyResourceId value + * @return the weekOfYear value */ - public String recoveryServicesBackupPolicyResourceId() { - return this.recoveryServicesBackupPolicyResourceId; + public Integer weekOfYear() { + return this.weekOfYear; } /** - * Set the recoveryServicesBackupPolicyResourceId value. + * Set the weekOfYear value. * - * @param recoveryServicesBackupPolicyResourceId the recoveryServicesBackupPolicyResourceId value to set + * @param weekOfYear the weekOfYear value to set * @return the BackupLongTermRetentionPolicyInner object itself. */ - public BackupLongTermRetentionPolicyInner withRecoveryServicesBackupPolicyResourceId(String recoveryServicesBackupPolicyResourceId) { - this.recoveryServicesBackupPolicyResourceId = recoveryServicesBackupPolicyResourceId; + public BackupLongTermRetentionPolicyInner withWeekOfYear(Integer weekOfYear) { + this.weekOfYear = weekOfYear; return this; } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/LongTermRetentionBackupInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/LongTermRetentionBackupInner.java new file mode 100644 index 00000000000..f525aeb74ea --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/LongTermRetentionBackupInner.java @@ -0,0 +1,110 @@ +/** + * 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 org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A long term retention backup. + */ +@JsonFlatten +public class LongTermRetentionBackupInner extends ProxyResourceInner { + /** + * The server name that the backup database belong to. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The create time of the server. + */ + @JsonProperty(value = "properties.serverCreateTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime serverCreateTime; + + /** + * The name of the database the backup belong to. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * The delete time of the database. + */ + @JsonProperty(value = "properties.databaseDeletionTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime databaseDeletionTime; + + /** + * The time the backup was taken. + */ + @JsonProperty(value = "properties.backupTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime backupTime; + + /** + * The time the long term retention backup will expire. + */ + @JsonProperty(value = "properties.backupExpirationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime backupExpirationTime; + + /** + * Get the serverName value. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the serverCreateTime value. + * + * @return the serverCreateTime value + */ + public DateTime serverCreateTime() { + return this.serverCreateTime; + } + + /** + * Get the databaseName value. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the databaseDeletionTime value. + * + * @return the databaseDeletionTime value + */ + public DateTime databaseDeletionTime() { + return this.databaseDeletionTime; + } + + /** + * Get the backupTime value. + * + * @return the backupTime value + */ + public DateTime backupTime() { + return this.backupTime; + } + + /** + * Get the backupExpirationTime value. + * + * @return the backupExpirationTime value + */ + public DateTime backupExpirationTime() { + return this.backupExpirationTime; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/LongTermRetentionBackupsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/LongTermRetentionBackupsInner.java new file mode 100644 index 00000000000..769f44cdb54 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/LongTermRetentionBackupsInner.java @@ -0,0 +1,1450 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.sql.DatabaseState; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import 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.HTTP; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LongTermRetentionBackups. + */ +public class LongTermRetentionBackupsInner { + /** The Retrofit service to perform REST calls. */ + private LongTermRetentionBackupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of LongTermRetentionBackupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LongTermRetentionBackupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(LongTermRetentionBackupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for LongTermRetentionBackups to be + * used by Retrofit to perform actually REST calls. + */ + interface LongTermRetentionBackupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.LongTermRetentionBackups get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}") + Observable> get(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @Path("backupName") String backupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.LongTermRetentionBackups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @Path("backupName") String backupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.LongTermRetentionBackups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @Path("backupName") String backupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.LongTermRetentionBackups listByDatabase" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups") + Observable> listByDatabase(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") DatabaseState databaseState, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.LongTermRetentionBackups listByLocation" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups") + Observable> listByLocation(@Path("locationName") String locationName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") DatabaseState databaseState, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.LongTermRetentionBackups listByServer" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups") + Observable> listByServer(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") DatabaseState databaseState, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.LongTermRetentionBackups listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.LongTermRetentionBackups listByLocationNext" }) + @GET + Observable> listByLocationNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.LongTermRetentionBackups listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LongTermRetentionBackupInner object if successful. + */ + public LongTermRetentionBackupInner get(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().single().body(); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LongTermRetentionBackupInner object + */ + public Observable getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1, LongTermRetentionBackupInner>() { + @Override + public LongTermRetentionBackupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LongTermRetentionBackupInner object + */ + public Observable> getWithServiceResponseAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName is required and cannot be null."); + } + if (backupName == null) { + throw new IllegalArgumentException("Parameter backupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.get(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().last().body(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName is required and cannot be null."); + } + if (backupName == null) { + throw new IllegalArgumentException("Parameter backupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + Observable> observable = service.delete(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().single().body(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName is required and cannot be null."); + } + if (backupName == null) { + throw new IllegalArgumentException("Parameter backupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.beginDelete(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByDatabase(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + ServiceResponse> response = listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + return listByDatabaseWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + return listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return service.listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByDatabase(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + ServiceResponse> response = listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByDatabaseWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param longTermRetentionDatabaseName the String value + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + ServiceResponse> * @param locationName The location of the database + ServiceResponse> * @param longTermRetentionServerName the String value + ServiceResponse> * @param longTermRetentionDatabaseName the String value + ServiceResponse> * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + ServiceResponse> * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByLocation(final String locationName) { + ServiceResponse> response = listByLocationSinglePageAsync(locationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByLocationAsync(final String locationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationSinglePageAsync(locationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByLocationAsync(final String locationName) { + return listByLocationWithServiceResponseAsync(locationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String locationName) { + return listByLocationSinglePageAsync(locationName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(final String locationName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return service.listByLocation(locationName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByLocation(final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + ServiceResponse> response = listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByLocationAsync(final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByLocationAsync(final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByLocationWithServiceResponseAsync(locationName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given location. + * + ServiceResponse> * @param locationName The location of the database + ServiceResponse> * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + ServiceResponse> * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(final String locationName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByLocation(locationName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByServer(final String locationName, final String longTermRetentionServerName) { + ServiceResponse> response = listByServerSinglePageAsync(locationName, longTermRetentionServerName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByServerAsync(final String locationName, final String longTermRetentionServerName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(locationName, longTermRetentionServerName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByServerAsync(final String locationName, final String longTermRetentionServerName) { + return listByServerWithServiceResponseAsync(locationName, longTermRetentionServerName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName) { + return listByServerSinglePageAsync(locationName, longTermRetentionServerName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String locationName, final String longTermRetentionServerName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return service.listByServer(locationName, longTermRetentionServerName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByServer(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + ServiceResponse> response = listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByServerAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByServerAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByServerWithServiceResponseAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName the String value + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + return listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + ServiceResponse> * @param locationName The location of the database + ServiceResponse> * @param longTermRetentionServerName the String value + ServiceResponse> * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + ServiceResponse> * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final DatabaseState databaseState) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByServer(locationName, longTermRetentionServerName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServerDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all long term retention backups for a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all long term retention backups for a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByLocationNext(final String nextPageLink) { + ServiceResponse> response = listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByLocationNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByLocationNextAsync(final String nextPageLink) { + return listByLocationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByLocationNextWithServiceResponseAsync(final String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given location. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByLocationNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByServerNext(final String nextPageLink) { + ServiceResponse> response = listByServerNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByServerNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByServerNextWithServiceResponseAsync(final String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByServerNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServerNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/LongTermRetentionPoliciesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/LongTermRetentionPoliciesInner.java new file mode 100644 index 00000000000..faa9deac603 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/LongTermRetentionPoliciesInner.java @@ -0,0 +1,442 @@ +/** + * 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.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +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 LongTermRetentionPolicies. + */ +public class LongTermRetentionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private LongTermRetentionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of LongTermRetentionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LongTermRetentionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(LongTermRetentionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for LongTermRetentionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface LongTermRetentionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.LongTermRetentionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.LongTermRetentionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Body LongTermRetentionPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.LongTermRetentionPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Body LongTermRetentionPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.LongTermRetentionPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LongTermRetentionPolicyInner object if successful. + */ + public LongTermRetentionPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LongTermRetentionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, LongTermRetentionPolicyInner>() { + @Override + public LongTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LongTermRetentionPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String policyName = "default"; + final String apiVersion = "2017-03-01-preview"; + return service.get(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LongTermRetentionPolicyInner object if successful. + */ + public LongTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, LongTermRetentionPolicyInner>() { + @Override + public LongTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String policyName = "default"; + final String apiVersion = "2017-03-01-preview"; + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LongTermRetentionPolicyInner object if successful. + */ + public LongTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LongTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, LongTermRetentionPolicyInner>() { + @Override + public LongTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LongTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String policyName = "default"; + final String apiVersion = "2017-03-01-preview"; + return service.beginCreateOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LongTermRetentionPolicyInner object if successful. + */ + public LongTermRetentionPolicyInner listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LongTermRetentionPolicyInner object + */ + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, LongTermRetentionPolicyInner>() { + @Override + public LongTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LongTermRetentionPolicyInner object + */ + public Observable> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByDatabaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/LongTermRetentionPolicyInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/LongTermRetentionPolicyInner.java new file mode 100644 index 00000000000..90e3c9de9ad --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/LongTermRetentionPolicyInner.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A long term retention policy. + */ +@JsonFlatten +public class LongTermRetentionPolicyInner extends ProxyResourceInner { + /** + * The weekly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.weeklyRetention") + private String weeklyRetention; + + /** + * The montly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.monthlyRetention") + private String monthlyRetention; + + /** + * The yearly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.yearlyRetention") + private String yearlyRetention; + + /** + * The week of year to take the yearly backup in an ISO 8601 format. + */ + @JsonProperty(value = "properties.weekOfYear") + private Integer weekOfYear; + + /** + * Get the weeklyRetention value. + * + * @return the weeklyRetention value + */ + public String weeklyRetention() { + return this.weeklyRetention; + } + + /** + * Set the weeklyRetention value. + * + * @param weeklyRetention the weeklyRetention value to set + * @return the LongTermRetentionPolicyInner object itself. + */ + public LongTermRetentionPolicyInner withWeeklyRetention(String weeklyRetention) { + this.weeklyRetention = weeklyRetention; + return this; + } + + /** + * Get the monthlyRetention value. + * + * @return the monthlyRetention value + */ + public String monthlyRetention() { + return this.monthlyRetention; + } + + /** + * Set the monthlyRetention value. + * + * @param monthlyRetention the monthlyRetention value to set + * @return the LongTermRetentionPolicyInner object itself. + */ + public LongTermRetentionPolicyInner withMonthlyRetention(String monthlyRetention) { + this.monthlyRetention = monthlyRetention; + return this; + } + + /** + * Get the yearlyRetention value. + * + * @return the yearlyRetention value + */ + public String yearlyRetention() { + return this.yearlyRetention; + } + + /** + * Set the yearlyRetention value. + * + * @param yearlyRetention the yearlyRetention value to set + * @return the LongTermRetentionPolicyInner object itself. + */ + public LongTermRetentionPolicyInner withYearlyRetention(String yearlyRetention) { + this.yearlyRetention = yearlyRetention; + return this; + } + + /** + * Get the weekOfYear value. + * + * @return the weekOfYear value + */ + public Integer weekOfYear() { + return this.weekOfYear; + } + + /** + * Set the weekOfYear value. + * + * @param weekOfYear the weekOfYear value to set + * @return the LongTermRetentionPolicyInner object itself. + */ + public LongTermRetentionPolicyInner withWeekOfYear(Integer weekOfYear) { + this.weekOfYear = weekOfYear; + return this; + } + +} 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 47db4c8ca0e..84996f18414 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 @@ -120,32 +120,6 @@ public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClien return this; } - /** - * The BackupLongTermRetentionPoliciesInner object to access its operations. - */ - private BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies; - - /** - * Gets the BackupLongTermRetentionPoliciesInner object to access its operations. - * @return the BackupLongTermRetentionPoliciesInner object. - */ - public BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies() { - return this.backupLongTermRetentionPolicies; - } - - /** - * The BackupLongTermRetentionVaultsInner object to access its operations. - */ - private BackupLongTermRetentionVaultsInner backupLongTermRetentionVaults; - - /** - * Gets the BackupLongTermRetentionVaultsInner object to access its operations. - * @return the BackupLongTermRetentionVaultsInner object. - */ - public BackupLongTermRetentionVaultsInner backupLongTermRetentionVaults() { - return this.backupLongTermRetentionVaults; - } - /** * The RecoverableDatabasesInner object to access its operations. */ @@ -601,6 +575,32 @@ public VirtualNetworkRulesInner virtualNetworkRules() { return this.virtualNetworkRules; } + /** + * The LongTermRetentionBackupsInner object to access its operations. + */ + private LongTermRetentionBackupsInner longTermRetentionBackups; + + /** + * Gets the LongTermRetentionBackupsInner object to access its operations. + * @return the LongTermRetentionBackupsInner object. + */ + public LongTermRetentionBackupsInner longTermRetentionBackups() { + return this.longTermRetentionBackups; + } + + /** + * The BackupLongTermRetentionPoliciesInner object to access its operations. + */ + private BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies; + + /** + * Gets the BackupLongTermRetentionPoliciesInner object to access its operations. + * @return the BackupLongTermRetentionPoliciesInner object. + */ + public BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies() { + return this.backupLongTermRetentionPolicies; + } + /** * The ServerAutomaticTuningsInner object to access its operations. */ @@ -700,8 +700,6 @@ protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; - this.backupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesInner(restClient().retrofit(), this); - this.backupLongTermRetentionVaults = new BackupLongTermRetentionVaultsInner(restClient().retrofit(), this); this.recoverableDatabases = new RecoverableDatabasesInner(restClient().retrofit(), this); this.restorableDroppedDatabases = new RestorableDroppedDatabasesInner(restClient().retrofit(), this); this.capabilities = new CapabilitiesInner(restClient().retrofit(), this); @@ -737,6 +735,8 @@ protected void initialize() { this.syncMembers = new SyncMembersInner(restClient().retrofit(), this); this.subscriptionUsages = new SubscriptionUsagesInner(restClient().retrofit(), this); this.virtualNetworkRules = new VirtualNetworkRulesInner(restClient().retrofit(), this); + this.longTermRetentionBackups = new LongTermRetentionBackupsInner(restClient().retrofit(), this); + this.backupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesInner(restClient().retrofit(), this); this.serverAutomaticTunings = new ServerAutomaticTuningsInner(restClient().retrofit(), this); this.serverDnsAliases = new ServerDnsAliasesInner(restClient().retrofit(), this); this.restorePoints = new RestorePointsInner(restClient().retrofit(), this);