diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.java new file mode 100644 index 000000000000..29905c46f7f2 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.java @@ -0,0 +1,90 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ManagedBackupShortTermRetentionPolicyInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy. + */ +public interface DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databasismanagedinstancemanagedbackupshorttermretentionpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackups.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackups.java index 8a63b778727a..93c595a233d3 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackups.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/LongTermRetentionBackups.java @@ -30,7 +30,7 @@ public interface LongTermRetentionBackups extends HasInner, HasInner { +public interface ManagedBackupShortTermRetentionPolicies extends SupportsCreating, HasInner { /** * Gets a managed database's short term retention policy. * @@ -26,7 +26,7 @@ public interface ManagedBackupShortTermRetentionPolicies extends SupportsCreatin * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName); + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName); /** * Gets a managed database's short term retention policy list. @@ -37,6 +37,6 @@ public interface ManagedBackupShortTermRetentionPolicies extends SupportsCreatin * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName); + Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName); } diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.java new file mode 100644 index 000000000000..00b172538fad --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.java @@ -0,0 +1,42 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies. + */ +public interface ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies extends SupportsCreating, HasInner { + /** + * Gets a dropped database's short 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId); + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByRestorableDroppedDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String restorableDroppedDatabaseId); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.java new file mode 100644 index 000000000000..436c4b6402e9 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.java @@ -0,0 +1,90 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.ManagedBackupShortTermRetentionPolicyInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy. + */ +public interface RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithRestorableDroppedDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy definition. + */ + interface Blank extends WithRestorableDroppedDatabasis { + } + + /** + * The stage of the restorabledroppeddatabasismanagedinstancemanagedbackupshorttermretentionpolicy definition allowing to specify RestorableDroppedDatabasis. + */ + interface WithRestorableDroppedDatabasis { + /** + * Specifies resourceGroupName, managedInstanceName, restorableDroppedDatabaseId. + */ + WithCreate withExistingRestorableDroppedDatabasis(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedManagedDatabase.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedManagedDatabase.java new file mode 100644 index 000000000000..d08e30ec738c --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedManagedDatabase.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.RestorableDroppedManagedDatabaseInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing RestorableDroppedManagedDatabase. + */ +public interface RestorableDroppedManagedDatabase extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the deletionDate value. + */ + DateTime deletionDate(); + + /** + * @return the earliestRestoreDate value. + */ + DateTime earliestRestoreDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedManagedDatabases.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedManagedDatabases.java new file mode 100644 index 000000000000..0926d20816de --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RestorableDroppedManagedDatabases.java @@ -0,0 +1,39 @@ +/** + * 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.v2017_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedManagedDatabase; + +/** + * Type representing RestorableDroppedManagedDatabases. + */ +public interface RestorableDroppedManagedDatabases { + /** + * Gets a restorable dropped managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId); + + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl.java new file mode 100644 index 000000000000..9dc568bb8d6e --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl.java @@ -0,0 +1,100 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl extends CreatableUpdatableImpl implements DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy, DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.Definition, DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + + DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(String name, SqlManager manager) { + super(name, new ManagedBackupShortTermRetentionPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(ManagedBackupShortTermRetentionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedBackupShortTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedBackupShortTermRetentionPolicies(); + return client.updateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedBackupShortTermRetentionPolicies(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java index b4318cbee543..0a75548cd57c 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java @@ -101,8 +101,8 @@ interface LongTermRetentionBackupsService { * Gets a long term retention backup. * * @param locationName The location of the database. - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server @@ -117,8 +117,8 @@ public LongTermRetentionBackupInner get(String locationName, String longTermRete * Gets a long term retention backup. * * @param locationName The location of the database. - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -132,8 +132,8 @@ public ServiceFuture getAsync(String locationName, * Gets a long term retention backup. * * @param locationName The location of the database. - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the LongTermRetentionBackupInner object @@ -151,8 +151,8 @@ public LongTermRetentionBackupInner call(ServiceResponse getDelegate(Response deleteAsync(String locationName, String longTermReten * Deletes a long term retention backup. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -250,8 +250,8 @@ public Void call(ServiceResponse 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 longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -283,8 +283,8 @@ public Observable> deleteWithServiceResponseAsync(String l * Deletes a long term retention backup. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server @@ -298,8 +298,8 @@ public void beginDelete(String locationName, String longTermRetentionServerName, * Deletes a long term retention backup. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -313,8 +313,8 @@ public ServiceFuture beginDeleteAsync(String locationName, String longTerm * Deletes a long term retention backup. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value - * @param longTermRetentionDatabaseName the String value + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. @@ -332,8 +332,8 @@ public Void call(ServiceResponse 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 longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @param backupName The backup name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. @@ -383,8 +383,8 @@ private ServiceResponse beginDeleteDelegate(Response respons * 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 longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName 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 @@ -404,8 +404,8 @@ public Page nextPage(String 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 + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName 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 @@ -426,8 +426,8 @@ public Observable>> call(Stri * 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 longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<LongTermRetentionBackupInner> object */ @@ -445,8 +445,8 @@ public Page call(ServiceResponse>> call(Serv * 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 longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name of the database * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -509,8 +509,8 @@ public Observable>> call(Resp * 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 longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name 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 @@ -532,8 +532,8 @@ public Page nextPage(String 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 + * @param longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name 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. @@ -556,8 +556,8 @@ public Observable>> call(Stri * 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 longTermRetentionServerName The name of the server + * @param longTermRetentionDatabaseName The name 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 @@ -577,8 +577,8 @@ public Page call(ServiceResponse>> call(Serv * 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 longTermRetentionServerName The name of the server + ServiceResponse> * @param longTermRetentionDatabaseName The name 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 @@ -885,7 +885,7 @@ private ServiceResponse> listByLocationDe * Lists the long term retention backups for a given server. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value + * @param longTermRetentionServerName The name of the server * @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 @@ -905,7 +905,7 @@ public Page nextPage(String nextPageLink) { * Lists the long term retention backups for a given server. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value + * @param longTermRetentionServerName The name of the server * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -926,7 +926,7 @@ public Observable>> call(Stri * Lists the long term retention backups for a given server. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value + * @param longTermRetentionServerName The name of the server * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<LongTermRetentionBackupInner> object */ @@ -944,7 +944,7 @@ public Page call(ServiceResponse>> call(Serv * Lists the long term retention backups for a given server. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value + * @param longTermRetentionServerName The name of the server * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -1003,7 +1003,7 @@ public Observable>> call(Resp * Lists the long term retention backups for a given server. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value + * @param longTermRetentionServerName The name of the server * @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 @@ -1025,7 +1025,7 @@ public Page nextPage(String nextPageLink) { * Lists the long term retention backups for a given server. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value + * @param longTermRetentionServerName The name of the server * @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. @@ -1048,7 +1048,7 @@ public Observable>> call(Stri * Lists the long term retention backups for a given server. * * @param locationName The location of the database - * @param longTermRetentionServerName the String value + * @param longTermRetentionServerName The name of the server * @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 @@ -1068,7 +1068,7 @@ public Page call(ServiceResponse>> call(Serv * 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 longTermRetentionServerName The name of the server 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 diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java index 55d69142e474..cf0a72b2ca3a 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java @@ -14,7 +14,7 @@ import rx.Observable; import rx.functions.Func1; import com.microsoft.azure.Page; -import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicy; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy; class ManagedBackupShortTermRetentionPoliciesImpl extends WrapperImpl implements ManagedBackupShortTermRetentionPolicies { private final SqlManager manager; @@ -29,20 +29,20 @@ public SqlManager manager() { } @Override - public ManagedBackupShortTermRetentionPolicyImpl define(String name) { + public DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl define(String name) { return wrapModel(name); } - private ManagedBackupShortTermRetentionPolicyImpl wrapModel(ManagedBackupShortTermRetentionPolicyInner inner) { - return new ManagedBackupShortTermRetentionPolicyImpl(inner, manager()); + private DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl wrapModel(ManagedBackupShortTermRetentionPolicyInner inner) { + return new DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(inner, manager()); } - private ManagedBackupShortTermRetentionPolicyImpl wrapModel(String name) { - return new ManagedBackupShortTermRetentionPolicyImpl(name, this.manager()); + private DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl wrapModel(String name) { + return new DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(name, this.manager()); } @Override - public Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + public Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { ManagedBackupShortTermRetentionPoliciesInner client = this.inner(); return client.listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName) .flatMapIterable(new Func1, Iterable>() { @@ -51,21 +51,21 @@ public Iterable call(Page() { + .map(new Func1() { @Override - public ManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { + public DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { return wrapModel(inner); } }); } @Override - public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { ManagedBackupShortTermRetentionPoliciesInner client = this.inner(); return client.getAsync(resourceGroupName, managedInstanceName, databaseName) - .map(new Func1() { + .map(new Func1() { @Override - public ManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { + public DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { return wrapModel(inner); } }); diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.java new file mode 100644 index 000000000000..38e3c577867b --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.java @@ -0,0 +1,74 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy; + +class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl extends WrapperImpl implements ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { + private final SqlManager manager; + + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl(SqlManager manager) { + super(manager.inner().managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl define(String name) { + return wrapModel(name); + } + + private RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl wrapModel(ManagedBackupShortTermRetentionPolicyInner inner) { + return new RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(inner, manager()); + } + + private RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl wrapModel(String name) { + return new RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByRestorableDroppedDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String restorableDroppedDatabaseId) { + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner client = this.inner(); + return client.listByRestorableDroppedDatabaseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId) + .map(new Func1() { + @Override + public RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy call(ManagedBackupShortTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner.java new file mode 100644 index 000000000000..94498c7b4c6f --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner.java @@ -0,0 +1,1135 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.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.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies. + */ +public class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, @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.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ManagedBackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies listByRestorableDroppedDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}/backupShortTermRetentionPolicies") + Observable> listByRestorableDroppedDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, @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.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies listByRestorableDroppedDatabaseNext" }) + @GET + Observable> listByRestorableDroppedDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a dropped database's short 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner get(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).toBlocking().single().body(); + } + + /** + * Gets a dropped database's short 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId 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 getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), serviceCallback); + } + + /** + * Gets a dropped database's short 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a dropped database's short 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String policyName = "default"; + return service.get(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId 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 createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String policyName = "default"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays), 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String policyName = "default"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId 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 beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String policyName = "default"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays), 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String policyName = "default"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = 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); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner update(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId 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 updateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String policyName = "default"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.update(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner update(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays), 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String policyName = "default"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.update(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId 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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId 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 beginUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String policyName = "default"; + final Integer retentionDays = null; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginUpdate(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ManagedBackupShortTermRetentionPolicyInner object if successful. + */ + public ManagedBackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays), 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, retentionDays).map(new Func1, ManagedBackupShortTermRetentionPolicyInner>() { + @Override + public ManagedBackupShortTermRetentionPolicyInner 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedBackupShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Integer retentionDays) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String policyName = "default"; + ManagedBackupShortTermRetentionPolicyInner parameters = new ManagedBackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginUpdate(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId 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<ManagedBackupShortTermRetentionPolicyInner> object if successful. + */ + public PagedList listByRestorableDroppedDatabase(final String resourceGroupName, final String managedInstanceName, final String restorableDroppedDatabaseId) { + ServiceResponse> response = listByRestorableDroppedDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByRestorableDroppedDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId 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> listByRestorableDroppedDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String restorableDroppedDatabaseId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByRestorableDroppedDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByRestorableDroppedDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedBackupShortTermRetentionPolicyInner> object + */ + public Observable> listByRestorableDroppedDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String restorableDroppedDatabaseId) { + return listByRestorableDroppedDatabaseWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedBackupShortTermRetentionPolicyInner> object + */ + public Observable>> listByRestorableDroppedDatabaseWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName, final String restorableDroppedDatabaseId) { + return listByRestorableDroppedDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId) + .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(listByRestorableDroppedDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a dropped database's short term retention policy list. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param managedInstanceName The name of the managed instance. + ServiceResponse> * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedBackupShortTermRetentionPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByRestorableDroppedDatabaseSinglePageAsync(final String resourceGroupName, final String managedInstanceName, final String restorableDroppedDatabaseId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByRestorableDroppedDatabase(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByRestorableDroppedDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByRestorableDroppedDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @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<ManagedBackupShortTermRetentionPolicyInner> object if successful. + */ + public PagedList listByRestorableDroppedDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByRestorableDroppedDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByRestorableDroppedDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @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> listByRestorableDroppedDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByRestorableDroppedDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByRestorableDroppedDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @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<ManagedBackupShortTermRetentionPolicyInner> object + */ + public Observable> listByRestorableDroppedDatabaseNextAsync(final String nextPageLink) { + return listByRestorableDroppedDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a dropped database's short term retention policy list. + * + * @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<ManagedBackupShortTermRetentionPolicyInner> object + */ + public Observable>> listByRestorableDroppedDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByRestorableDroppedDatabaseNextSinglePageAsync(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(listByRestorableDroppedDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a dropped database's short term retention policy list. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedBackupShortTermRetentionPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByRestorableDroppedDatabaseNextSinglePageAsync(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.listByRestorableDroppedDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByRestorableDroppedDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByRestorableDroppedDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl.java new file mode 100644 index 000000000000..cc596c500883 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl.java @@ -0,0 +1,100 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl extends CreatableUpdatableImpl implements RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy, RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.Definition, RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String restorableDroppedDatabaseId; + + RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(String name, SqlManager manager) { + super(name, new ManagedBackupShortTermRetentionPolicyInner()); + this.manager = manager; + // Set resource name + this.restorableDroppedDatabaseId = name; + // + } + + RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl(ManagedBackupShortTermRetentionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.restorableDroppedDatabaseId = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.restorableDroppedDatabaseId = IdParsingUtils.getValueFromIdByName(inner.id(), "restorableDroppedDatabases"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.restorableDroppedDatabaseId) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies(); + return client.updateAsync(this.resourceGroupName, this.managedInstanceName, this.restorableDroppedDatabaseId) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.restorableDroppedDatabaseId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer retentionDays() { + return this.inner().retentionDays(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl withExistingRestorableDroppedDatabasis(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabaseImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabaseImpl.java new file mode 100644 index 000000000000..ed54b6bbf916 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabaseImpl.java @@ -0,0 +1,89 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedManagedDatabase; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.Map; + +class RestorableDroppedManagedDatabaseImpl extends IndexableRefreshableWrapperImpl implements RestorableDroppedManagedDatabase { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String restorableDroppedDatabaseId; + + RestorableDroppedManagedDatabaseImpl(RestorableDroppedManagedDatabaseInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + this.restorableDroppedDatabaseId = IdParsingUtils.getValueFromIdByName(inner.id(), "restorableDroppedDatabases"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RestorableDroppedManagedDatabasesInner client = this.manager().inner().restorableDroppedManagedDatabases(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.restorableDroppedDatabaseId); + } + + + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public DateTime deletionDate() { + return this.inner().deletionDate(); + } + + @Override + public DateTime earliestRestoreDate() { + return this.inner().earliestRestoreDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabaseInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabaseInner.java new file mode 100644 index 000000000000..0ab7503467f7 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabaseInner.java @@ -0,0 +1,81 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A restorable dropped managed database resource. + */ +@JsonFlatten +public class RestorableDroppedManagedDatabaseInner extends Resource { + /** + * The name of the database. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The deletion date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.deletionDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime deletionDate; + + /** + * The earliest restore date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * Get the name of the database. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the deletion date of the database (ISO8601 format). + * + * @return the deletionDate value + */ + public DateTime deletionDate() { + return this.deletionDate; + } + + /** + * Get the earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabasesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabasesImpl.java new file mode 100644 index 000000000000..d46ff7922490 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabasesImpl.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.sql.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedManagedDatabases; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedManagedDatabase; +import com.microsoft.azure.Page; + +class RestorableDroppedManagedDatabasesImpl extends WrapperImpl implements RestorableDroppedManagedDatabases { + private final SqlManager manager; + + RestorableDroppedManagedDatabasesImpl(SqlManager manager) { + super(manager.inner().restorableDroppedManagedDatabases()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private RestorableDroppedManagedDatabaseImpl wrapRestorableDroppedManagedDatabaseModel(RestorableDroppedManagedDatabaseInner inner) { + return new RestorableDroppedManagedDatabaseImpl(inner, manager()); + } + + private Observable getRestorableDroppedManagedDatabaseInnerUsingRestorableDroppedManagedDatabasesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + String restorableDroppedDatabaseId = IdParsingUtils.getValueFromIdByName(id, "restorableDroppedDatabases"); + RestorableDroppedManagedDatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + RestorableDroppedManagedDatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId) + .map(new Func1() { + @Override + public RestorableDroppedManagedDatabase call(RestorableDroppedManagedDatabaseInner inner) { + return wrapRestorableDroppedManagedDatabaseModel(inner); + } + }); + } + + @Override + public Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + RestorableDroppedManagedDatabasesInner client = this.inner(); + return client.listByInstanceAsync(resourceGroupName, managedInstanceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public RestorableDroppedManagedDatabase call(RestorableDroppedManagedDatabaseInner inner) { + return wrapRestorableDroppedManagedDatabaseModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabasesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabasesInner.java new file mode 100644 index 000000000000..3ec919754da3 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RestorableDroppedManagedDatabasesInner.java @@ -0,0 +1,401 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.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.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 RestorableDroppedManagedDatabases. + */ +public class RestorableDroppedManagedDatabasesInner { + /** The Retrofit service to perform REST calls. */ + private RestorableDroppedManagedDatabasesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RestorableDroppedManagedDatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RestorableDroppedManagedDatabasesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RestorableDroppedManagedDatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for RestorableDroppedManagedDatabases to be + * used by Retrofit to perform actually REST calls. + */ + interface RestorableDroppedManagedDatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedManagedDatabases listByInstance" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases") + Observable> listByInstance(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedManagedDatabases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, @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.v2017_03_01_preview.RestorableDroppedManagedDatabases listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<RestorableDroppedManagedDatabaseInner> object if successful. + */ + public PagedList listByInstance(final String resourceGroupName, final String managedInstanceName) { + ServiceResponse> response = listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RestorableDroppedManagedDatabaseInner> object + */ + public Observable> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + return listByInstanceWithServiceResponseAsync(resourceGroupName, managedInstanceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of restorable dropped managed databases. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RestorableDroppedManagedDatabaseInner> object + */ + public Observable>> listByInstanceWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName) { + return listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of restorable dropped managed databases. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RestorableDroppedManagedDatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstanceSinglePageAsync(final String resourceGroupName, final String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByInstance(resourceGroupName, managedInstanceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstanceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInstanceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a restorable dropped managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId 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 RestorableDroppedManagedDatabaseInner object if successful. + */ + public RestorableDroppedManagedDatabaseInner get(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).toBlocking().single().body(); + } + + /** + * Gets a restorable dropped managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId 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 getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), serviceCallback); + } + + /** + * Gets a restorable dropped managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorableDroppedManagedDatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId).map(new Func1, RestorableDroppedManagedDatabaseInner>() { + @Override + public RestorableDroppedManagedDatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a restorable dropped managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RestorableDroppedManagedDatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (restorableDroppedDatabaseId == null) { + throw new IllegalArgumentException("Parameter restorableDroppedDatabaseId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = 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); + } + + /** + * Gets a list of restorable dropped managed databases. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<RestorableDroppedManagedDatabaseInner> object if successful. + */ + public PagedList listByInstanceNext(final String nextPageLink) { + ServiceResponse> response = listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of restorable dropped managed databases. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInstanceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInstanceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of restorable dropped managed databases. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RestorableDroppedManagedDatabaseInner> object + */ + public Observable> listByInstanceNextAsync(final String nextPageLink) { + return listByInstanceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of restorable dropped managed databases. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RestorableDroppedManagedDatabaseInner> object + */ + public Observable>> listByInstanceNextWithServiceResponseAsync(final String nextPageLink) { + return listByInstanceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInstanceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of restorable dropped managed databases. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RestorableDroppedManagedDatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInstanceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByInstanceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInstanceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInstanceNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java index f0fdd0ef1571..3e441c6be62c 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManagementClientImpl.java @@ -418,6 +418,32 @@ public ManagedDatabasesInner managedDatabases() { return this.managedDatabases; } + /** + * The ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner object to access its operations. + */ + private ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; + + /** + * Gets the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner object to access its operations. + * @return the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner object. + */ + public ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() { + return this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; + } + + /** + * The RestorableDroppedManagedDatabasesInner object to access its operations. + */ + private RestorableDroppedManagedDatabasesInner restorableDroppedManagedDatabases; + + /** + * Gets the RestorableDroppedManagedDatabasesInner object to access its operations. + * @return the RestorableDroppedManagedDatabasesInner object. + */ + public RestorableDroppedManagedDatabasesInner restorableDroppedManagedDatabases() { + return this.restorableDroppedManagedDatabases; + } + /** * The RestorePointsInner object to access its operations. */ @@ -553,6 +579,8 @@ protected void initialize() { this.backupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesInner(restClient().retrofit(), this); this.managedBackupShortTermRetentionPolicies = new ManagedBackupShortTermRetentionPoliciesInner(restClient().retrofit(), this); this.managedDatabases = new ManagedDatabasesInner(restClient().retrofit(), this); + this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies = new ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner(restClient().retrofit(), this); + this.restorableDroppedManagedDatabases = new RestorableDroppedManagedDatabasesInner(restClient().retrofit(), this); this.restorePoints = new RestorePointsInner(restClient().retrofit(), this); this.serverAutomaticTunings = new ServerAutomaticTuningsInner(restClient().retrofit(), this); this.serverDnsAliases = new ServerDnsAliasesInner(restClient().retrofit(), this); diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java index 0a09877ffea8..d14cd0893ed9 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SqlManager.java @@ -38,6 +38,8 @@ import com.microsoft.azure.management.sql.v2017_03_01_preview.BackupLongTermRetentionPolicies; import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedBackupShortTermRetentionPolicies; import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabases; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorableDroppedManagedDatabases; import com.microsoft.azure.management.sql.v2017_03_01_preview.RestorePoints; import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerAutomaticTunings; import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerDnsAliases; @@ -73,6 +75,8 @@ public final class SqlManager extends ManagerCore