diff --git a/sql/resource-manager/v2017_03_01_preview/pom.xml b/sql/resource-manager/v2017_03_01_preview/pom.xml index 30cff3767809..d345667442f0 100644 --- a/sql/resource-manager/v2017_03_01_preview/pom.xml +++ b/sql/resource-manager/v2017_03_01_preview/pom.xml @@ -11,8 +11,8 @@ com.microsoft.azure azure-arm-parent - 1.1.0 - ../../../pom.management.xml + 0.0.3-beta + ../../../pom.xml azure-mgmt-sql 1.0.0-beta 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..a8ccb62d2956 --- /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,118 @@ +/** + * 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.WithRetentionDays, 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. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal + * @param managedInstanceName The name of the managed instance + * @param databaseName The name of the database + * @return the next definition stage + */ + WithRetentionDays withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName); + } + + /** + * The stage of the databasismanagedinstancemanagedbackupshorttermretentionpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported + * @return the next definition stage + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * 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, UpdateStages.WithRetentionDays { + } + + /** + * Grouping of DatabasisManagedInstanceManagedBackupShortTermRetentionPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the databasismanagedinstancemanagedbackupshorttermretentionpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported + * @return the next update stage + */ + Update withRetentionDays(Integer retentionDays); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabel.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabel.java new file mode 100644 index 000000000000..21c1e23aca52 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabel.java @@ -0,0 +1,60 @@ +/** + * 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.SensitivityLabelInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing DatabasisServerSensitivityLabel. + */ +public interface DatabasisServerSensitivityLabel extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the informationType value. + */ + String informationType(); + + /** + * @return the informationTypeId value. + */ + String informationTypeId(); + + /** + * @return the isDisabled value. + */ + Boolean isDisabled(); + + /** + * @return the labelId value. + */ + String labelId(); + + /** + * @return the labelName value. + */ + String labelName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @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/DatabasisServerSensitivityLabelModel.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabelModel.java new file mode 100644 index 000000000000..9d49d9cfc18d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/DatabasisServerSensitivityLabelModel.java @@ -0,0 +1,60 @@ +/** + * 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.SensitivityLabelInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; + +/** + * Type representing DatabasisServerSensitivityLabelModel. + */ +public interface DatabasisServerSensitivityLabelModel extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the informationType value. + */ + String informationType(); + + /** + * @return the informationTypeId value. + */ + String informationTypeId(); + + /** + * @return the isDisabled value. + */ + Boolean isDisabled(); + + /** + * @return the labelId value. + */ + String labelId(); + + /** + * @return the labelName value. + */ + String labelName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @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/JobSchedule.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobSchedule.java index 788a7ecb607d..28da5d250b08 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobSchedule.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobSchedule.java @@ -40,7 +40,7 @@ public class JobSchedule { private Boolean enabled; /** - * Value of the schedule's recurring interval, if the scheduletype is + * Value of the schedule's recurring interval, if the schedule type is * recurring. ISO8601 duration format. */ @JsonProperty(value = "interval") @@ -127,7 +127,7 @@ public JobSchedule withEnabled(Boolean enabled) { } /** - * Get value of the schedule's recurring interval, if the scheduletype is recurring. ISO8601 duration format. + * Get value of the schedule's recurring interval, if the schedule type is recurring. ISO8601 duration format. * * @return the interval value */ @@ -136,7 +136,7 @@ public String interval() { } /** - * Set value of the schedule's recurring interval, if the scheduletype is recurring. ISO8601 duration format. + * Set value of the schedule's recurring interval, if the schedule type is recurring. ISO8601 duration format. * * @param interval the interval value to set * @return the JobSchedule object itself. diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepExecutions.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepExecutions.java index ca9d5c77d55b..d096a4ddb832 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepExecutions.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/JobStepExecutions.java @@ -9,8 +9,7 @@ package com.microsoft.azure.management.sql.v2017_03_01_preview; import rx.Observable; - -import java.util.UUID; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ExecutionJobJobAgentServerJobExecution; /** * Type representing JobStepExecutions. 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..5ecd51c6a511 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 @@ -20,55 +20,114 @@ public interface LongTermRetentionBackups extends HasInner listByLocationAsync(final String locationName); + Observable listByResourceGroupLocationAsync(final String resourceGroupName, final String locationName); /** * Lists the long term retention backups for a given server. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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 for the request */ - Observable listByServerAsync(final String locationName, final String longTermRetentionServerName); + Observable listByResourceGroupServerAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName); /** * 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 for the request */ Observable getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName); + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @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 + */ + Completable deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName); + /** * 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 for the request */ Observable listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName); + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(final String locationName); + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The name of the server + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(final String locationName, final String longTermRetentionServerName); + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @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 + */ + Observable getByResourceGroupAsync(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName); + + /** + * Lists all long term retention backups for a 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 locationName The location of the database + * @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 for the request + */ + Observable listByResourceGroupDatabaseAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName); + /** * Deletes a long term retention backup. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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 */ - Completable deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName); + Completable deleteByResourceGroupAsync(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName); } diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicies.java index 03caf7827e71..d688cbdf5c32 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicies.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedBackupShortTermRetentionPolicies.java @@ -16,7 +16,7 @@ /** * Type representing ManagedBackupShortTermRetentionPolicies. */ -public interface ManagedBackupShortTermRetentionPolicies extends SupportsCreating, 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/ManagedDatabase.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabase.java index 555f5588dd34..c41adf6979a4 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabase.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabase.java @@ -74,6 +74,16 @@ public interface ManagedDatabase extends HasInner, Indexab */ String name(); + /** + * @return the recoverableDatabaseId value. + */ + String recoverableDatabaseId(); + + /** + * @return the restorableDroppedDatabaseId value. + */ + String restorableDroppedDatabaseId(); + /** * @return the restorePointInTime value. */ @@ -180,12 +190,36 @@ interface WithCollation { interface WithCreateMode { /** * Specifies createMode. - * @param createMode Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * @param createMode Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery' * @return the next definition stage */ WithCreate withCreateMode(ManagedDatabaseCreateMode createMode); } + /** + * The stage of the manageddatabase definition allowing to specify RecoverableDatabaseId. + */ + interface WithRecoverableDatabaseId { + /** + * Specifies recoverableDatabaseId. + * @param recoverableDatabaseId The resource identifier of the recoverable database associated with create operation of this database + * @return the next definition stage + */ + WithCreate withRecoverableDatabaseId(String recoverableDatabaseId); + } + + /** + * The stage of the manageddatabase definition allowing to specify RestorableDroppedDatabaseId. + */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies restorableDroppedDatabaseId. + * @param restorableDroppedDatabaseId The restorable dropped database resource id to restore when creating this database + * @return the next definition stage + */ + WithCreate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + /** * The stage of the manageddatabase definition allowing to specify RestorePointInTime. */ @@ -251,13 +285,13 @@ interface WithTags { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, DefinitionStages.WithCatalogCollation, DefinitionStages.WithCollation, DefinitionStages.WithCreateMode, DefinitionStages.WithRestorePointInTime, DefinitionStages.WithSourceDatabaseId, DefinitionStages.WithStorageContainerSasToken, DefinitionStages.WithStorageContainerUri, DefinitionStages.WithTags { + interface WithCreate extends Creatable, DefinitionStages.WithCatalogCollation, DefinitionStages.WithCollation, DefinitionStages.WithCreateMode, DefinitionStages.WithRecoverableDatabaseId, DefinitionStages.WithRestorableDroppedDatabaseId, DefinitionStages.WithRestorePointInTime, DefinitionStages.WithSourceDatabaseId, DefinitionStages.WithStorageContainerSasToken, DefinitionStages.WithStorageContainerUri, DefinitionStages.WithTags { } } /** * The template for a ManagedDatabase update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, UpdateStages.WithCatalogCollation, UpdateStages.WithCollation, UpdateStages.WithCreateMode, UpdateStages.WithRestorePointInTime, UpdateStages.WithSourceDatabaseId, UpdateStages.WithStorageContainerSasToken, UpdateStages.WithStorageContainerUri, UpdateStages.WithTags { + interface Update extends Appliable, UpdateStages.WithCatalogCollation, UpdateStages.WithCollation, UpdateStages.WithCreateMode, UpdateStages.WithRecoverableDatabaseId, UpdateStages.WithRestorableDroppedDatabaseId, UpdateStages.WithRestorePointInTime, UpdateStages.WithSourceDatabaseId, UpdateStages.WithStorageContainerSasToken, UpdateStages.WithStorageContainerUri, UpdateStages.WithTags { } /** @@ -294,12 +328,36 @@ interface WithCollation { interface WithCreateMode { /** * Specifies createMode. - * @param createMode Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * @param createMode Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery' * @return the next update stage */ Update withCreateMode(ManagedDatabaseCreateMode createMode); } + /** + * The stage of the manageddatabase update allowing to specify RecoverableDatabaseId. + */ + interface WithRecoverableDatabaseId { + /** + * Specifies recoverableDatabaseId. + * @param recoverableDatabaseId The resource identifier of the recoverable database associated with create operation of this database + * @return the next update stage + */ + Update withRecoverableDatabaseId(String recoverableDatabaseId); + } + + /** + * The stage of the manageddatabase update allowing to specify RestorableDroppedDatabaseId. + */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies restorableDroppedDatabaseId. + * @param restorableDroppedDatabaseId The restorable dropped database resource id to restore when creating this database + * @return the next update stage + */ + Update withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + /** * The stage of the manageddatabase update allowing to specify RestorePointInTime. */ diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseCreateMode.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseCreateMode.java index 401fce50ffa2..f54d0ace4220 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseCreateMode.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseCreateMode.java @@ -25,6 +25,9 @@ public final class ManagedDatabaseCreateMode extends ExpandableStringEnum, HasInner { + /** + * Gets a managed database's security alert 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 databaseName The name of the managed database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @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); + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicy.java new file mode 100644 index 000000000000..12884a222ed9 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseSecurityAlertPolicy.java @@ -0,0 +1,287 @@ +/** + * 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.ManagedDatabaseSecurityAlertPolicyInner; +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; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing ManagedDatabaseSecurityAlertPolicy. + */ +public interface ManagedDatabaseSecurityAlertPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationTime value. + */ + DateTime creationTime(); + + /** + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the state value. + */ + SecurityAlertPolicyState state(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ManagedDatabaseSecurityAlertPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedDatabaseSecurityAlertPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedDatabaseSecurityAlertPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal + * @param managedInstanceName The name of the managed instance + * @param databaseName The name of the managed database for which the security alert policy is defined + * @return the next definition stage + */ + WithState withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'New', 'Enabled', 'Disabled' + * @return the next definition stage + */ + WithCreate withState(SecurityAlertPolicyState state); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action + * @return the next definition stage + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators + * @return the next definition stage + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent + * @return the next definition stage + */ + WithCreate withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs + * @return the next definition stage + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage account + * @return the next definition stage + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + * @param storageEndpoint Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs + * @return the next definition stage + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + + /** + * 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, DefinitionStages.WithDisabledAlerts, DefinitionStages.WithEmailAccountAdmins, DefinitionStages.WithEmailAddresses, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageEndpoint { + } + } + /** + * The template for a ManagedDatabaseSecurityAlertPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDisabledAlerts, UpdateStages.WithEmailAccountAdmins, UpdateStages.WithEmailAddresses, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageEndpoint { + } + + /** + * Grouping of ManagedDatabaseSecurityAlertPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action + * @return the next update stage + */ + Update withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators + * @return the next update stage + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent + * @return the next update stage + */ + Update withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs + * @return the next update stage + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage account + * @return the next update stage + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the manageddatabasesecurityalertpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + * @param storageEndpoint Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs + * @return the next update stage + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseStatus.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseStatus.java index 6c1711fbaa13..e6d092993e91 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseStatus.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedDatabaseStatus.java @@ -31,6 +31,9 @@ public final class ManagedDatabaseStatus extends ExpandableStringEnum listByInstanceAsync(final String resourceGroupName, final String managedInstanceName); /** - * Deletes the managed database. + * Deletes a managed database. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param managedInstanceName The name of the managed instance. 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/ManagedServerSecurityAlertPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicies.java new file mode 100644 index 000000000000..6e512daa8892 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicies.java @@ -0,0 +1,45 @@ +/** + * 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.ManagedServerSecurityAlertPolicy; + +/** + * Type representing ManagedServerSecurityAlertPolicies. + */ +public interface ManagedServerSecurityAlertPolicies { + /** + * Begins definition for a new SecurityAlertPolicy resource. + * @param name resource name. + * @return the first stage of the new SecurityAlertPolicy definition. + */ + ManagedServerSecurityAlertPolicy.DefinitionStages.Blank defineSecurityAlertPolicy(String name); + + /** + * Get a managed server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String managedInstanceName); + + /** + * Get the managed server's threat detection policies. + * + * @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/ManagedServerSecurityAlertPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicy.java new file mode 100644 index 000000000000..fafb3fd720f2 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ManagedServerSecurityAlertPolicy.java @@ -0,0 +1,286 @@ +/** + * 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.ManagedServerSecurityAlertPolicyInner; +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; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing ManagedServerSecurityAlertPolicy. + */ +public interface ManagedServerSecurityAlertPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationTime value. + */ + DateTime creationTime(); + + /** + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * @return the state value. + */ + SecurityAlertPolicyState state(); + + /** + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ManagedServerSecurityAlertPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithManagedInstance, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedServerSecurityAlertPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedServerSecurityAlertPolicy definition. + */ + interface Blank extends WithManagedInstance { + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify ManagedInstance. + */ + interface WithManagedInstance { + /** + * Specifies resourceGroupName, managedInstanceName. + * @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 + * @return the next definition stage + */ + WithState withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'New', 'Enabled', 'Disabled' + * @return the next definition stage + */ + WithCreate withState(SecurityAlertPolicyState state); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action + * @return the next definition stage + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators + * @return the next definition stage + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent + * @return the next definition stage + */ + WithCreate withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs + * @return the next definition stage + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage account + * @return the next definition stage + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the managedserversecurityalertpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + * @param storageEndpoint Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs + * @return the next definition stage + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + + /** + * 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, DefinitionStages.WithDisabledAlerts, DefinitionStages.WithEmailAccountAdmins, DefinitionStages.WithEmailAddresses, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageEndpoint { + } + } + /** + * The template for a ManagedServerSecurityAlertPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDisabledAlerts, UpdateStages.WithEmailAccountAdmins, UpdateStages.WithEmailAddresses, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageEndpoint { + } + + /** + * Grouping of ManagedServerSecurityAlertPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action + * @return the next update stage + */ + Update withDisabledAlerts(List disabledAlerts); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators + * @return the next update stage + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent + * @return the next update stage + */ + Update withEmailAddresses(List emailAddresses); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs + * @return the next update stage + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage account + * @return the next update stage + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the managedserversecurityalertpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + * @param storageEndpoint Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs + * @return the next update stage + */ + Update withStorageEndpoint(String storageEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RecommendedSensitivityLabels.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RecommendedSensitivityLabels.java new file mode 100644 index 000000000000..8781026c7a22 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/RecommendedSensitivityLabels.java @@ -0,0 +1,30 @@ +/** + * 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.implementation.RecommendedSensitivityLabelsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RecommendedSensitivityLabels. + */ +public interface RecommendedSensitivityLabels extends HasInner { + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, 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/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..92c0e2d721d7 --- /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,118 @@ +/** + * 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.WithRetentionDays, 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. + * @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 restorableDroppedDatabaseId parameter value + * @return the next definition stage + */ + WithRetentionDays withExistingRestorableDroppedDatabasis(String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId); + } + + /** + * The stage of the restorabledroppeddatabasismanagedinstancemanagedbackupshorttermretentionpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported + * @return the next definition stage + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * 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, UpdateStages.WithRetentionDays { + } + + /** + * Grouping of RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the restorabledroppeddatabasismanagedinstancemanagedbackupshorttermretentionpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported + * @return the next update stage + */ + Update withRetentionDays(Integer retentionDays); + } + + } +} 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/SensitivityLabel.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabel.java new file mode 100644 index 000000000000..39f1024e1557 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabel.java @@ -0,0 +1,213 @@ +/** + * 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.SensitivityLabelInner; +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 SensitivityLabel. + */ +public interface SensitivityLabel extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the informationType value. + */ + String informationType(); + + /** + * @return the informationTypeId value. + */ + String informationTypeId(); + + /** + * @return the isDisabled value. + */ + Boolean isDisabled(); + + /** + * @return the labelId value. + */ + String labelId(); + + /** + * @return the labelName value. + */ + String labelName(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SensitivityLabel definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithColumn, DefinitionStages.WithCreate { + } + + /** + * Grouping of SensitivityLabel definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SensitivityLabel definition. + */ + interface Blank extends WithColumn { + } + + /** + * The stage of the sensitivitylabel definition allowing to specify Column. + */ + interface WithColumn { + /** + * Specifies resourceGroupName, serverName, databaseName, schemaName, tableName, columnName. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal + * @param serverName The name of the server + * @param databaseName The name of the database + * @param schemaName The name of the schema + * @param tableName The name of the table + * @param columnName The name of the column + * @return the next definition stage + */ + WithCreate withExistingColumn(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName); + } + + /** + * The stage of the sensitivitylabel definition allowing to specify InformationType. + */ + interface WithInformationType { + /** + * Specifies informationType. + * @param informationType The information type + * @return the next definition stage + */ + WithCreate withInformationType(String informationType); + } + + /** + * The stage of the sensitivitylabel definition allowing to specify InformationTypeId. + */ + interface WithInformationTypeId { + /** + * Specifies informationTypeId. + * @param informationTypeId The information type ID + * @return the next definition stage + */ + WithCreate withInformationTypeId(String informationTypeId); + } + + /** + * The stage of the sensitivitylabel definition allowing to specify LabelId. + */ + interface WithLabelId { + /** + * Specifies labelId. + * @param labelId The label ID + * @return the next definition stage + */ + WithCreate withLabelId(String labelId); + } + + /** + * The stage of the sensitivitylabel definition allowing to specify LabelName. + */ + interface WithLabelName { + /** + * Specifies labelName. + * @param labelName The label name + * @return the next definition stage + */ + WithCreate withLabelName(String labelName); + } + + /** + * 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, DefinitionStages.WithInformationType, DefinitionStages.WithInformationTypeId, DefinitionStages.WithLabelId, DefinitionStages.WithLabelName { + } + } + /** + * The template for a SensitivityLabel update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithInformationType, UpdateStages.WithInformationTypeId, UpdateStages.WithLabelId, UpdateStages.WithLabelName { + } + + /** + * Grouping of SensitivityLabel update stages. + */ + interface UpdateStages { + /** + * The stage of the sensitivitylabel update allowing to specify InformationType. + */ + interface WithInformationType { + /** + * Specifies informationType. + * @param informationType The information type + * @return the next update stage + */ + Update withInformationType(String informationType); + } + + /** + * The stage of the sensitivitylabel update allowing to specify InformationTypeId. + */ + interface WithInformationTypeId { + /** + * Specifies informationTypeId. + * @param informationTypeId The information type ID + * @return the next update stage + */ + Update withInformationTypeId(String informationTypeId); + } + + /** + * The stage of the sensitivitylabel update allowing to specify LabelId. + */ + interface WithLabelId { + /** + * Specifies labelId. + * @param labelId The label ID + * @return the next update stage + */ + Update withLabelId(String labelId); + } + + /** + * The stage of the sensitivitylabel update allowing to specify LabelName. + */ + interface WithLabelName { + /** + * Specifies labelName. + * @param labelName The label name + * @return the next update stage + */ + Update withLabelName(String labelName); + } + + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabelSource.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabelSource.java new file mode 100644 index 000000000000..436333e89dae --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabelSource.java @@ -0,0 +1,53 @@ +/** + * 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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SensitivityLabelSource. + */ +public enum SensitivityLabelSource { + /** Enum value current. */ + CURRENT("current"), + + /** Enum value recommended. */ + RECOMMENDED("recommended"); + + /** The actual serialized value for a SensitivityLabelSource instance. */ + private String value; + + SensitivityLabelSource(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SensitivityLabelSource instance. + * + * @param value the serialized value to parse. + * @return the parsed SensitivityLabelSource object, or null if unable to parse. + */ + @JsonCreator + public static SensitivityLabelSource fromString(String value) { + SensitivityLabelSource[] items = SensitivityLabelSource.values(); + for (SensitivityLabelSource item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabels.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabels.java new file mode 100644 index 000000000000..c22a0cc12b3c --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/SensitivityLabels.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.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SensitivityLabelsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisServerSensitivityLabel; + +/** + * Type representing SensitivityLabels. + */ +public interface SensitivityLabels extends SupportsCreating, HasInner { + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable enableRecommendationAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable disableRecommendationAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName); + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource); + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName); + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listCurrentByDatabaseAsync(final String resourceGroupName, final String serverName, 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/ServerSecurityAlertPolicies.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicies.java index f27795c42361..301726190861 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicies.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicies.java @@ -27,4 +27,14 @@ public interface ServerSecurityAlertPolicies extends SupportsCreating getAsync(String resourceGroupName, String serverName); + /** + * Get the server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(final String resourceGroupName, final String serverName); + } diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java index 7d819c8d9594..a8dceeb2adf8 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/ServerSecurityAlertPolicy.java @@ -18,11 +18,17 @@ import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.sql.v2017_03_01_preview.implementation.SqlManager; import java.util.List; +import org.joda.time.DateTime; /** * Type representing ServerSecurityAlertPolicy. */ public interface ServerSecurityAlertPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationTime value. + */ + DateTime creationTime(); + /** * @return the disabledAlerts value. */ @@ -108,7 +114,7 @@ interface WithServer { interface WithState { /** * Specifies state. - * @param state Specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled' + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'New', 'Enabled', 'Disabled' * @return the next definition stage */ WithCreate withState(SecurityAlertPolicyState state); diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java index 6e65b17864b3..023610ad1fa2 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java @@ -29,7 +29,7 @@ class DatabaseVulnerabilityAssessmentRuleBaselineImpl extends CreatableUpdatable super(name, new DatabaseVulnerabilityAssessmentRuleBaselineInner()); this.manager = manager; // Set resource name - this.baselineName = VulnerabilityAssessmentPolicyBaselineName.fromString(name); + this.baselineName = name; // } @@ -37,7 +37,7 @@ class DatabaseVulnerabilityAssessmentRuleBaselineImpl extends CreatableUpdatable super(inner.name(), inner); this.manager = manager; // Set resource name - this.baselineName = VulnerabilityAssessmentPolicyBaselineName.fromString(inner.name()); + this.baselineName = inner.name(); // set resource ancestor and positional variables this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java index 09c6ce15a1d1..468a1f0c9002 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java @@ -11,7 +11,6 @@ import com.microsoft.azure.arm.model.implementation.WrapperImpl; import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessmentRuleBaselines; -import com.microsoft.azure.management.sql.v2017_03_01_preview.VulnerabilityAssessmentPolicyBaselineName; import rx.Observable; import rx.functions.Func1; import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabaseVulnerabilityAssessmentRuleBaseline; @@ -47,7 +46,7 @@ private Observable getDatabase String serverName = IdParsingUtils.getValueFromIdByName(id, "servers"); String databaseName = IdParsingUtils.getValueFromIdByName(id, "databases"); String ruleId = IdParsingUtils.getValueFromIdByName(id, "rules"); - VulnerabilityAssessmentPolicyBaselineName baselineName = VulnerabilityAssessmentPolicyBaselineName.valueOf(IdParsingUtils.getValueFromIdByName(id, "baselines")); + String baselineName = VulnerabilityAssessmentPolicyBaselineName.valueOf(IdParsingUtils.getValueFromIdByName(id, "baselines")); DatabaseVulnerabilityAssessmentRuleBaselinesInner client = this.inner(); return client.getAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName); } 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..45af884ced1d --- /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,112 @@ +/** + * 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; + private Integer cretentionDays; + private Integer uretentionDays; + + 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(); + // set resource ancestor and positional variables + 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, this.cretentionDays) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedBackupShortTermRetentionPolicies(); + return client.updateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.uretentionDays) + .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; + } + + @Override + public DatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl withRetentionDays(Integer retentionDays) { + if (isInCreateMode()) { + this.cretentionDays = retentionDays; + } else { + this.uretentionDays = retentionDays; + } + 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/DatabasisServerSensitivityLabelImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelImpl.java new file mode 100644 index 000000000000..e2c221572a2d --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelImpl.java @@ -0,0 +1,70 @@ +/** + * 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.DatabasisServerSensitivityLabel; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class DatabasisServerSensitivityLabelImpl extends WrapperImpl implements DatabasisServerSensitivityLabel { + private final SqlManager manager; + + DatabasisServerSensitivityLabelImpl(SensitivityLabelInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String informationType() { + return this.inner().informationType(); + } + + @Override + public String informationTypeId() { + return this.inner().informationTypeId(); + } + + @Override + public Boolean isDisabled() { + return this.inner().isDisabled(); + } + + @Override + public String labelId() { + return this.inner().labelId(); + } + + @Override + public String labelName() { + return this.inner().labelName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @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/DatabasisServerSensitivityLabelModelImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelModelImpl.java new file mode 100644 index 000000000000..6757d22ea454 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasisServerSensitivityLabelModelImpl.java @@ -0,0 +1,70 @@ +/** + * 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.DatabasisServerSensitivityLabelModel; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class DatabasisServerSensitivityLabelModelImpl extends WrapperImpl implements DatabasisServerSensitivityLabelModel { + private final SqlManager manager; + + DatabasisServerSensitivityLabelModelImpl(SensitivityLabelInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String informationType() { + return this.inner().informationType(); + } + + @Override + public String informationTypeId() { + return this.inner().informationTypeId(); + } + + @Override + public Boolean isDisabled() { + return this.inner().isDisabled(); + } + + @Override + public String labelId() { + return this.inner().labelId(); + } + + @Override + public String labelName() { + return this.inner().labelName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @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/JobAgentServerJobExecutionImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentServerJobExecutionImpl.java index 4e0e2e0cdc69..e6525639104e 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentServerJobExecutionImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentServerJobExecutionImpl.java @@ -29,7 +29,7 @@ class JobAgentServerJobExecutionImpl extends CreatableUpdatableImpl getDelegate(Response re } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. @@ -1128,7 +1128,7 @@ public JobExecutionInner createOrUpdate(String resourceGroupName, String serverN } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. @@ -1144,7 +1144,7 @@ public ServiceFuture createOrUpdateAsync(String resourceGroup } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. @@ -1164,7 +1164,7 @@ public JobExecutionInner call(ServiceResponse response) { } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. @@ -1201,7 +1201,7 @@ public Observable> createOrUpdateWithServiceR } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. @@ -1218,7 +1218,7 @@ public JobExecutionInner beginCreateOrUpdate(String resourceGroupName, String se } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. @@ -1234,7 +1234,7 @@ public ServiceFuture beginCreateOrUpdateAsync(String resource } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. @@ -1254,7 +1254,7 @@ public JobExecutionInner call(ServiceResponse response) { } /** - * Creates or updatess a job execution. + * Creates or updates a job execution. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepExecutionsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepExecutionsImpl.java index 7c63052aaa15..8719fbbd0eb9 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepExecutionsImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepExecutionsImpl.java @@ -16,8 +16,6 @@ import com.microsoft.azure.management.sql.v2017_03_01_preview.ExecutionJobJobAgentServerJobExecution; import com.microsoft.azure.Page; -import java.util.UUID; - class JobStepExecutionsImpl extends WrapperImpl implements JobStepExecutions { private final SqlManager manager; @@ -39,7 +37,7 @@ private Observable getJobExecutionInnerUsingJobStepExecutions String serverName = IdParsingUtils.getValueFromIdByName(id, "servers"); String jobAgentName = IdParsingUtils.getValueFromIdByName(id, "jobAgents"); String jobName = IdParsingUtils.getValueFromIdByName(id, "jobs"); - UUID jobExecutionId = UUID.fromString(IdParsingUtils.getValueFromIdByName(id, "executions")); + String jobExecutionId = UUID.fromString(IdParsingUtils.getValueFromIdByName(id, "executions")); String stepName = IdParsingUtils.getValueFromIdByName(id, "steps"); JobStepExecutionsInner client = this.inner(); return client.getAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName); diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepImpl.java index 4c57c31d99fb..324af6f0ef57 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepImpl.java @@ -67,7 +67,7 @@ public Observable updateResourceAsync() { @Override protected Observable getInnerAsync() { JobStepsInner client = this.manager().inner().jobSteps(); - return client.getAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.stepName); + return client.getByVersionAsync(this.resourceGroupName, this.serverName, this.jobAgentName, this.jobName, this.stepName); } @Override diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupImpl.java index 868999b12a5b..53f2b600d2e6 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupImpl.java @@ -15,6 +15,7 @@ class LongTermRetentionBackupImpl extends IndexableRefreshableWrapperImpl implements LongTermRetentionBackup { private final SqlManager manager; + private String resourceGroupName; private String locationName; private String longTermRetentionServerName; private String longTermRetentionDatabaseName; @@ -24,6 +25,7 @@ class LongTermRetentionBackupImpl extends IndexableRefreshableWrapperImpl getInnerAsync() { LongTermRetentionBackupsInner client = this.manager().inner().longTermRetentionBackups(); - return client.getAsync(this.locationName, this.longTermRetentionServerName, this.longTermRetentionDatabaseName, this.backupName); + return client.getByResourceGroupAsync(this.resourceGroupName, this.locationName, this.longTermRetentionServerName, this.longTermRetentionDatabaseName, this.backupName); } diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsImpl.java index b005c4aec91b..7bf157f4cfd0 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsImpl.java @@ -33,6 +33,78 @@ private LongTermRetentionBackupImpl wrapModel(LongTermRetentionBackupInner inner return new LongTermRetentionBackupImpl(inner, manager()); } + @Override + public Observable listByResourceGroupLocationAsync(final String resourceGroupName, final String locationName) { + LongTermRetentionBackupsInner client = this.inner(); + return client.listByResourceGroupLocationAsync(resourceGroupName, locationName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { + return new LongTermRetentionBackupImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupServerAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName) { + LongTermRetentionBackupsInner client = this.inner(); + return client.listByResourceGroupServerAsync(resourceGroupName, locationName, longTermRetentionServerName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { + return new LongTermRetentionBackupImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + LongTermRetentionBackupsInner client = this.inner(); + return client.getAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .map(new Func1() { + @Override + public LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { + return new LongTermRetentionBackupImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + LongTermRetentionBackupsInner client = this.inner(); + return client.deleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toCompletable(); + } + + @Override + public Observable listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + LongTermRetentionBackupsInner client = this.inner(); + return client.listByDatabaseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { + return new LongTermRetentionBackupImpl(inner, manager()); + } + }); + } + @Override public Observable listByLocationAsync(final String locationName) { LongTermRetentionBackupsInner client = this.inner(); @@ -70,9 +142,9 @@ public LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { } @Override - public Observable listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + public Observable listByResourceGroupDatabaseAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { LongTermRetentionBackupsInner client = this.inner(); - return client.listByDatabaseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName) + return client.listByResourceGroupDatabaseAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName) .flatMapIterable(new Func1, Iterable>() { @Override public Iterable call(Page page) { @@ -88,9 +160,9 @@ public LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { } @Override - public Observable getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + public Observable getByResourceGroupAsync(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { LongTermRetentionBackupsInner client = this.inner(); - return client.getAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + return client.getByResourceGroupAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) .map(new Func1() { @Override public LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { @@ -100,9 +172,9 @@ public LongTermRetentionBackup call(LongTermRetentionBackupInner inner) { } @Override - public Completable deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + public Completable deleteByResourceGroupAsync(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { LongTermRetentionBackupsInner client = this.inner(); - return client.deleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toCompletable(); + return client.deleteByResourceGroupAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toCompletable(); } } 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..777798a3c7f7 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 @@ -59,6 +59,30 @@ public LongTermRetentionBackupsInner(Retrofit retrofit, SqlManagementClientImpl * used by Retrofit to perform actually REST calls. */ interface LongTermRetentionBackupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackups getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @Path("backupName") String backupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackups deleteByResourceGroup" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}", method = "DELETE", hasBody = true) + Observable> deleteByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @Path("backupName") String backupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackups beginDeleteByResourceGroup" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}", method = "DELETE", hasBody = true) + Observable> beginDeleteByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @Path("backupName") String backupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackups listByResourceGroupDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups") + Observable> listByResourceGroupDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") LongTermRetentionDatabaseState databaseState, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackups listByResourceGroupLocation" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups") + Observable> listByResourceGroupLocation(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") LongTermRetentionDatabaseState databaseState, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackups listByResourceGroupServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups") + Observable> listByResourceGroupServer(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") LongTermRetentionDatabaseState databaseState, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackups get" }) @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}") Observable> get(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, @Path("backupName") String backupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -83,6 +107,18 @@ interface LongTermRetentionBackupsService { @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups") Observable> listByServer(@Path("locationName") String locationName, @Path("longTermRetentionServerName") String longTermRetentionServerName, @Path("subscriptionId") String subscriptionId, @Query("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, @Query("databaseState") LongTermRetentionDatabaseState databaseState, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackups listByResourceGroupDatabaseNext" }) + @GET + Observable> listByResourceGroupDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackups listByResourceGroupLocationNext" }) + @GET + Observable> listByResourceGroupLocationNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackups listByResourceGroupServerNext" }) + @GET + Observable> listByResourceGroupServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.LongTermRetentionBackups listByDatabaseNext" }) @GET Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -100,46 +136,49 @@ interface LongTermRetentionBackupsService { /** * Gets a long term retention backup. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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 * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the LongTermRetentionBackupInner object if successful. */ - public LongTermRetentionBackupInner get(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { - return getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().single().body(); + public LongTermRetentionBackupInner getByResourceGroup(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().single().body(); } /** * Gets a long term retention backup. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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 * @return the {@link ServiceFuture} object */ - public ServiceFuture getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); } /** * Gets a long term retention backup. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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 */ - public Observable getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { - return getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1, LongTermRetentionBackupInner>() { + public Observable getByResourceGroupAsync(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1, LongTermRetentionBackupInner>() { @Override public LongTermRetentionBackupInner call(ServiceResponse response) { return response.body(); @@ -150,14 +189,18 @@ public LongTermRetentionBackupInner call(ServiceResponse> getWithServiceResponseAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } if (locationName == null) { throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); } @@ -176,12 +219,12 @@ public Observable> getWithServiceR if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - return service.get(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + return service.getByResourceGroup(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, 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); + ServiceResponse clientResponse = getByResourceGroupDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -190,7 +233,7 @@ public Observable> call(Response getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) @@ -200,45 +243,48 @@ private ServiceResponse getDelegate(Response deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + public ServiceFuture deleteByResourceGroupAsync(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); } /** * Deletes a long term retention backup. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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 */ - public Observable deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { - return deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1, Void>() { + public Observable deleteByResourceGroupAsync(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return deleteByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { return response.body(); @@ -249,14 +295,18 @@ public Void call(ServiceResponse response) { /** * Deletes a long term retention backup. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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 */ - public Observable> deleteWithServiceResponseAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + public Observable> deleteByResourceGroupWithServiceResponseAsync(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } if (locationName == null) { throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); } @@ -275,52 +325,55 @@ public Observable> deleteWithServiceResponseAsync(String l if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - Observable> observable = service.delete(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + Observable> observable = service.deleteByResourceGroup(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** * Deletes a long term retention backup. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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 * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ - public void beginDelete(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { - beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().single().body(); + public void beginDeleteByResourceGroup(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + beginDeleteByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().single().body(); } /** * Deletes a long term retention backup. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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 * @return the {@link ServiceFuture} object */ - public ServiceFuture beginDeleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + public ServiceFuture beginDeleteByResourceGroupAsync(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); } /** * Deletes a long term retention backup. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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. */ - public Observable beginDeleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { - return beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1, Void>() { + public Observable beginDeleteByResourceGroupAsync(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return beginDeleteByResourceGroupWithServiceResponseAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { return response.body(); @@ -331,14 +384,18 @@ public Void call(ServiceResponse response) { /** * Deletes a long term retention backup. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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. */ - public Observable> beginDeleteWithServiceResponseAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + public Observable> beginDeleteByResourceGroupWithServiceResponseAsync(String resourceGroupName, String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } if (locationName == null) { throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); } @@ -357,12 +414,12 @@ public Observable> beginDeleteWithServiceResponseAsync(Str if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - return service.beginDelete(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + return service.beginDeleteByResourceGroup(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, 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 = beginDeleteDelegate(response); + ServiceResponse clientResponse = beginDeleteByResourceGroupDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -371,7 +428,7 @@ public Observable> call(Response response) { }); } - private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse beginDeleteByResourceGroupDelegate(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()) @@ -382,20 +439,21 @@ private ServiceResponse beginDeleteDelegate(Response respons /** * Lists all long term retention backups for a 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 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 * @return the PagedList<LongTermRetentionBackupInner> object if successful. */ - public PagedList listByDatabase(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { - ServiceResponse> response = listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).toBlocking().single(); + public PagedList listByResourceGroupDatabase(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + ServiceResponse> response = listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName).toBlocking().single(); return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + return listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } @@ -403,20 +461,21 @@ public Page nextPage(String nextPageLink) { /** * Lists all long term retention backups for a 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 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 */ - public ServiceFuture> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final ListOperationCallback serviceCallback) { + public ServiceFuture> listByResourceGroupDatabaseAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName), + listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName), new Func1>>>() { @Override public Observable>> call(String nextPageLink) { - return listByDatabaseNextSinglePageAsync(nextPageLink); + return listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink); } }, serviceCallback); @@ -425,14 +484,15 @@ public Observable>> call(Stri /** * Lists all long term retention backups for a 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 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 */ - public Observable> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { - return listByDatabaseWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName) + public Observable> listByResourceGroupDatabaseAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + return listByResourceGroupDatabaseWithServiceResponseAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName) .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -444,14 +504,15 @@ public Page call(ServiceResponse>> listByDatabaseWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { - return listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName) + public Observable>> listByResourceGroupDatabaseWithServiceResponseAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + return listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName) .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { @@ -459,7 +520,7 @@ public Observable>> call(Serv if (nextPageLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listByResourceGroupDatabaseNextWithServiceResponseAsync(nextPageLink)); } }); } @@ -467,13 +528,17 @@ public Observable>> call(Serv /** * Lists all long term retention backups for a 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 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. */ - public Observable>> listByDatabaseSinglePageAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + public Observable>> listByResourceGroupDatabaseSinglePageAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } if (locationName == null) { throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); } @@ -491,12 +556,12 @@ public Observable>> listByDat } final Boolean onlyLatestPerDatabase = null; final LongTermRetentionDatabaseState databaseState = null; - return service.listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + return service.listByResourceGroupDatabase(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByDatabaseDelegate(response); + ServiceResponse> result = listByResourceGroupDatabaseDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -508,9 +573,10 @@ public Observable>> call(Resp /** * Lists all long term retention backups for a 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 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 @@ -518,12 +584,12 @@ public Observable>> call(Resp * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList<LongTermRetentionBackupInner> object if successful. */ - public PagedList listByDatabase(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { - ServiceResponse> response = listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + public PagedList listByResourceGroupDatabase(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + ServiceResponse> response = listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState).toBlocking().single(); return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + return listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } @@ -531,22 +597,23 @@ public Page nextPage(String nextPageLink) { /** * Lists all long term retention backups for a 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 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. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState, final ListOperationCallback serviceCallback) { + public ServiceFuture> listByResourceGroupDatabaseAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState), + listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState), new Func1>>>() { @Override public Observable>> call(String nextPageLink) { - return listByDatabaseNextSinglePageAsync(nextPageLink); + return listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink); } }, serviceCallback); @@ -555,16 +622,17 @@ public Observable>> call(Stri /** * Lists all long term retention backups for a 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 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 * @return the observable to the PagedList<LongTermRetentionBackupInner> object */ - public Observable> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { - return listByDatabaseWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState) + public Observable> listByResourceGroupDatabaseAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByResourceGroupDatabaseWithServiceResponseAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState) .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -576,16 +644,17 @@ public Page call(ServiceResponse>> listByDatabaseWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { - return listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState) + public Observable>> listByResourceGroupDatabaseWithServiceResponseAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByResourceGroupDatabaseSinglePageAsync(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState) .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { @@ -593,7 +662,7 @@ public Observable>> call(Serv if (nextPageLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listByResourceGroupDatabaseNextWithServiceResponseAsync(nextPageLink)); } }); } @@ -601,15 +670,19 @@ public Observable>> call(Serv /** * Lists all long term retention backups for a database. * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. ServiceResponse> * @param locationName The 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 * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listByDatabaseSinglePageAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + public Observable>> listByResourceGroupDatabaseSinglePageAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } if (locationName == null) { throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); } @@ -625,12 +698,12 @@ public Observable>> listByDat if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - return service.listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + return service.listByResourceGroupDatabase(resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByDatabaseDelegate(response); + ServiceResponse> result = listByResourceGroupDatabaseDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -639,7 +712,7 @@ public Observable>> call(Resp }); } - private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse> listByResourceGroupDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) @@ -649,18 +722,19 @@ private ServiceResponse> listByDatabaseDe /** * Lists the long term retention backups for a given location. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The location of the database * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList<LongTermRetentionBackupInner> object if successful. */ - public PagedList listByLocation(final String locationName) { - ServiceResponse> response = listByLocationSinglePageAsync(locationName).toBlocking().single(); + public PagedList listByResourceGroupLocation(final String resourceGroupName, final String locationName) { + ServiceResponse> response = listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName).toBlocking().single(); return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + return listByResourceGroupLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } @@ -668,18 +742,19 @@ public Page nextPage(String nextPageLink) { /** * Lists the long term retention backups for a given location. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The location of the database * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listByLocationAsync(final String locationName, final ListOperationCallback serviceCallback) { + public ServiceFuture> listByResourceGroupLocationAsync(final String resourceGroupName, final String locationName, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listByLocationSinglePageAsync(locationName), + listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName), new Func1>>>() { @Override public Observable>> call(String nextPageLink) { - return listByLocationNextSinglePageAsync(nextPageLink); + return listByResourceGroupLocationNextSinglePageAsync(nextPageLink); } }, serviceCallback); @@ -688,12 +763,13 @@ public Observable>> call(Stri /** * Lists the long term retention backups for a given location. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The location of the database * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<LongTermRetentionBackupInner> object */ - public Observable> listByLocationAsync(final String locationName) { - return listByLocationWithServiceResponseAsync(locationName) + public Observable> listByResourceGroupLocationAsync(final String resourceGroupName, final String locationName) { + return listByResourceGroupLocationWithServiceResponseAsync(resourceGroupName, locationName) .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -705,12 +781,13 @@ public Page call(ServiceResponse>> listByLocationWithServiceResponseAsync(final String locationName) { - return listByLocationSinglePageAsync(locationName) + public Observable>> listByResourceGroupLocationWithServiceResponseAsync(final String resourceGroupName, final String locationName) { + return listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName) .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { @@ -718,7 +795,7 @@ public Observable>> call(Serv if (nextPageLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listByLocationNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listByResourceGroupLocationNextWithServiceResponseAsync(nextPageLink)); } }); } @@ -726,11 +803,15 @@ public Observable>> call(Serv /** * Lists the long term retention backups for a given location. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The location of the database * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listByLocationSinglePageAsync(final String locationName) { + public Observable>> listByResourceGroupLocationSinglePageAsync(final String resourceGroupName, final String locationName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } if (locationName == null) { throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); } @@ -742,12 +823,12 @@ public Observable>> listByLoc } final Boolean onlyLatestPerDatabase = null; final LongTermRetentionDatabaseState databaseState = null; - return service.listByLocation(locationName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + return service.listByResourceGroupLocation(resourceGroupName, locationName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByLocationDelegate(response); + ServiceResponse> result = listByResourceGroupLocationDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -759,6 +840,7 @@ public Observable>> call(Resp /** * Lists the long term retention backups for a given location. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The location of the database * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' @@ -767,12 +849,12 @@ public Observable>> call(Resp * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList<LongTermRetentionBackupInner> object if successful. */ - public PagedList listByLocation(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { - ServiceResponse> response = listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + public PagedList listByResourceGroupLocation(final String resourceGroupName, final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + ServiceResponse> response = listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState).toBlocking().single(); return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + return listByResourceGroupLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } @@ -780,6 +862,7 @@ public Page nextPage(String nextPageLink) { /** * Lists the long term retention backups for a given location. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The location of the database * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' @@ -787,13 +870,13 @@ public Page nextPage(String nextPageLink) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listByLocationAsync(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState, final ListOperationCallback serviceCallback) { + public ServiceFuture> listByResourceGroupLocationAsync(final String resourceGroupName, final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState), + listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState), new Func1>>>() { @Override public Observable>> call(String nextPageLink) { - return listByLocationNextSinglePageAsync(nextPageLink); + return listByResourceGroupLocationNextSinglePageAsync(nextPageLink); } }, serviceCallback); @@ -802,14 +885,15 @@ public Observable>> call(Stri /** * Lists the long term retention backups for a given location. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The location of the database * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<LongTermRetentionBackupInner> object */ - public Observable> listByLocationAsync(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { - return listByLocationWithServiceResponseAsync(locationName, onlyLatestPerDatabase, databaseState) + public Observable> listByResourceGroupLocationAsync(final String resourceGroupName, final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByResourceGroupLocationWithServiceResponseAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState) .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -821,14 +905,15 @@ public Page call(ServiceResponse>> listByLocationWithServiceResponseAsync(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { - return listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState) + public Observable>> listByResourceGroupLocationWithServiceResponseAsync(final String resourceGroupName, final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByResourceGroupLocationSinglePageAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState) .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { @@ -836,7 +921,7 @@ public Observable>> call(Serv if (nextPageLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listByLocationNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listByResourceGroupLocationNextWithServiceResponseAsync(nextPageLink)); } }); } @@ -844,13 +929,17 @@ public Observable>> call(Serv /** * Lists the long term retention backups for a given location. * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. ServiceResponse> * @param locationName The location of the database ServiceResponse> * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. ServiceResponse> * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listByLocationSinglePageAsync(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + public Observable>> listByResourceGroupLocationSinglePageAsync(final String resourceGroupName, final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } if (locationName == null) { throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); } @@ -860,12 +949,12 @@ public Observable>> listByLoc if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - return service.listByLocation(locationName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + return service.listByResourceGroupLocation(resourceGroupName, locationName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByLocationDelegate(response); + ServiceResponse> result = listByResourceGroupLocationDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -874,7 +963,7 @@ public Observable>> call(Resp }); } - private ServiceResponse> listByLocationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse> listByResourceGroupLocationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) @@ -884,19 +973,20 @@ private ServiceResponse> listByLocationDe /** * Lists the long term retention backups for a given server. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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 * @return the PagedList<LongTermRetentionBackupInner> object if successful. */ - public PagedList listByServer(final String locationName, final String longTermRetentionServerName) { - ServiceResponse> response = listByServerSinglePageAsync(locationName, longTermRetentionServerName).toBlocking().single(); + public PagedList listByResourceGroupServer(final String resourceGroupName, final String locationName, final String longTermRetentionServerName) { + ServiceResponse> response = listByResourceGroupServerSinglePageAsync(resourceGroupName, locationName, longTermRetentionServerName).toBlocking().single(); return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + return listByResourceGroupServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } @@ -904,19 +994,20 @@ public Page nextPage(String nextPageLink) { /** * Lists the long term retention backups for a given server. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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 */ - public ServiceFuture> listByServerAsync(final String locationName, final String longTermRetentionServerName, final ListOperationCallback serviceCallback) { + public ServiceFuture> listByResourceGroupServerAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listByServerSinglePageAsync(locationName, longTermRetentionServerName), + listByResourceGroupServerSinglePageAsync(resourceGroupName, locationName, longTermRetentionServerName), new Func1>>>() { @Override public Observable>> call(String nextPageLink) { - return listByServerNextSinglePageAsync(nextPageLink); + return listByResourceGroupServerNextSinglePageAsync(nextPageLink); } }, serviceCallback); @@ -925,13 +1016,14 @@ public Observable>> call(Stri /** * Lists the long term retention backups for a given server. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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 */ - public Observable> listByServerAsync(final String locationName, final String longTermRetentionServerName) { - return listByServerWithServiceResponseAsync(locationName, longTermRetentionServerName) + public Observable> listByResourceGroupServerAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName) { + return listByResourceGroupServerWithServiceResponseAsync(resourceGroupName, locationName, longTermRetentionServerName) .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -943,13 +1035,14 @@ public Page call(ServiceResponse>> listByServerWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName) { - return listByServerSinglePageAsync(locationName, longTermRetentionServerName) + public Observable>> listByResourceGroupServerWithServiceResponseAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName) { + return listByResourceGroupServerSinglePageAsync(resourceGroupName, locationName, longTermRetentionServerName) .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { @@ -957,7 +1050,7 @@ public Observable>> call(Serv if (nextPageLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listByResourceGroupServerNextWithServiceResponseAsync(nextPageLink)); } }); } @@ -965,12 +1058,16 @@ public Observable>> call(Serv /** * Lists the long term retention backups for a given server. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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. */ - public Observable>> listByServerSinglePageAsync(final String locationName, final String longTermRetentionServerName) { + public Observable>> listByResourceGroupServerSinglePageAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } if (locationName == null) { throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); } @@ -985,12 +1082,12 @@ public Observable>> listBySer } final Boolean onlyLatestPerDatabase = null; final LongTermRetentionDatabaseState databaseState = null; - return service.listByServer(locationName, longTermRetentionServerName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + return service.listByResourceGroupServer(resourceGroupName, locationName, longTermRetentionServerName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByServerDelegate(response); + ServiceResponse> result = listByResourceGroupServerDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1002,8 +1099,9 @@ public Observable>> call(Resp /** * Lists the long term retention backups for a given server. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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 @@ -1011,12 +1109,12 @@ public Observable>> call(Resp * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList<LongTermRetentionBackupInner> object if successful. */ - public PagedList listByServer(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { - ServiceResponse> response = listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + public PagedList listByResourceGroupServer(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + ServiceResponse> response = listByResourceGroupServerSinglePageAsync(resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState).toBlocking().single(); return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + return listByResourceGroupServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } @@ -1024,21 +1122,22 @@ public Page nextPage(String nextPageLink) { /** * Lists the long term retention backups for a given server. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listByServerAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState, final ListOperationCallback serviceCallback) { + public ServiceFuture> listByResourceGroupServerAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState), + listByResourceGroupServerSinglePageAsync(resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState), new Func1>>>() { @Override public Observable>> call(String nextPageLink) { - return listByServerNextSinglePageAsync(nextPageLink); + return listByResourceGroupServerNextSinglePageAsync(nextPageLink); } }, serviceCallback); @@ -1047,15 +1146,16 @@ public Observable>> call(Stri /** * Lists the long term retention backups for a given server. * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param locationName The 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 * @return the observable to the PagedList<LongTermRetentionBackupInner> object */ - public Observable> listByServerAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { - return listByServerWithServiceResponseAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) + public Observable> listByResourceGroupServerAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByResourceGroupServerWithServiceResponseAsync(resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -1067,15 +1167,16 @@ public Page call(ServiceResponse>> listByServerWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { - return listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) + public Observable>> listByResourceGroupServerWithServiceResponseAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByResourceGroupServerSinglePageAsync(resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { @@ -1083,7 +1184,7 @@ public Observable>> call(Serv if (nextPageLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listByResourceGroupServerNextWithServiceResponseAsync(nextPageLink)); } }); } @@ -1091,14 +1192,18 @@ public Observable>> call(Serv /** * Lists the long term retention backups for a given server. * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. ServiceResponse> * @param locationName The 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 * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listByServerSinglePageAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + public Observable>> listByResourceGroupServerSinglePageAsync(final String resourceGroupName, final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } if (locationName == null) { throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); } @@ -1111,12 +1216,12 @@ public Observable>> listBySer if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - return service.listByServer(locationName, longTermRetentionServerName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + return service.listByResourceGroupServer(resourceGroupName, locationName, longTermRetentionServerName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByServerDelegate(response); + ServiceResponse> result = listByResourceGroupServerDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1125,7 +1230,1375 @@ public Observable>> call(Resp }); } - private ServiceResponse> listByServerDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse> listByResourceGroupServerDelegate(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 long term retention backup. + * + * @param locationName The location of the database. + * @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 + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LongTermRetentionBackupInner object if successful. + */ + public LongTermRetentionBackupInner get(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().single().body(); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The 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 + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The 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 + */ + public Observable getAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return getWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1, LongTermRetentionBackupInner>() { + @Override + public LongTermRetentionBackupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The 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 + */ + public Observable> getWithServiceResponseAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName is required and cannot be null."); + } + if (backupName == null) { + throw new IllegalArgumentException("Parameter backupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, 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); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @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 + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().last().body(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + */ + public Observable deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + */ + public Observable> deleteWithServiceResponseAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName is required and cannot be null."); + } + if (backupName == null) { + throw new IllegalArgumentException("Parameter backupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().single().body(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName), serviceCallback); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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. + */ + public Observable beginDeleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + return beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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. + */ + public Observable> beginDeleteWithServiceResponseAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName is required and cannot be null."); + } + if (backupName == null) { + throw new IllegalArgumentException("Parameter backupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, 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 = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByDatabase(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + ServiceResponse> response = listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + */ + public ServiceFuture> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + */ + public Observable> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + return listByDatabaseWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + return listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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. + */ + public Observable>> listByDatabaseSinglePageAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Boolean onlyLatestPerDatabase = null; + final LongTermRetentionDatabaseState databaseState = null; + return service.listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByDatabase(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + ServiceResponse> response = listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByDatabaseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByDatabaseWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByDatabaseSinglePageAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, onlyLatestPerDatabase, databaseState) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + ServiceResponse> * @param locationName The location of the database + ServiceResponse> * @param longTermRetentionServerName The 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 + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String locationName, final String longTermRetentionServerName, final String longTermRetentionDatabaseName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (longTermRetentionDatabaseName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionDatabaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByLocation(final String locationName) { + ServiceResponse> response = listByLocationSinglePageAsync(locationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByLocationAsync(final String locationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationSinglePageAsync(locationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByLocationAsync(final String locationName) { + return listByLocationWithServiceResponseAsync(locationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String locationName) { + return listByLocationSinglePageAsync(locationName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(final String locationName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Boolean onlyLatestPerDatabase = null; + final LongTermRetentionDatabaseState databaseState = null; + return service.listByLocation(locationName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByLocation(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + ServiceResponse> response = listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByLocationAsync(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByLocationAsync(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByLocationWithServiceResponseAsync(locationName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param locationName The location of the database + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given location. + * + ServiceResponse> * @param locationName The location of the database + ServiceResponse> * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + ServiceResponse> * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(final String locationName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByLocation(locationName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByServer(final String locationName, final String longTermRetentionServerName) { + ServiceResponse> response = listByServerSinglePageAsync(locationName, longTermRetentionServerName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + */ + public ServiceFuture> listByServerAsync(final String locationName, final String longTermRetentionServerName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(locationName, longTermRetentionServerName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The name of the server + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByServerAsync(final String locationName, final String longTermRetentionServerName) { + return listByServerWithServiceResponseAsync(locationName, longTermRetentionServerName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The name of the server + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName) { + return listByServerSinglePageAsync(locationName, longTermRetentionServerName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The name of the server + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String locationName, final String longTermRetentionServerName) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Boolean onlyLatestPerDatabase = null; + final LongTermRetentionDatabaseState databaseState = null; + return service.listByServer(locationName, longTermRetentionServerName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByServer(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + ServiceResponse> response = listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByServerAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByServerAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByServerWithServiceResponseAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database + * @param longTermRetentionServerName The 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 + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + return listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + ServiceResponse> * @param locationName The location of the database + ServiceResponse> * @param longTermRetentionServerName The 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 + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (longTermRetentionServerName == null) { + throw new IllegalArgumentException("Parameter longTermRetentionServerName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByServer(locationName, longTermRetentionServerName, this.client.subscriptionId(), onlyLatestPerDatabase, databaseState, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServerDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all long term retention backups for a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByResourceGroupDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all long term retention backups for a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all long term retention backups for a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByResourceGroupDatabaseNextAsync(final String nextPageLink) { + return listByResourceGroupDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByResourceGroupDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupDatabaseNextSinglePageAsync(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(listByResourceGroupDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all long term retention backups for a database. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupDatabaseNextSinglePageAsync(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.listByResourceGroupDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByResourceGroupLocationNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupLocationNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupLocationNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupLocationNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByResourceGroupLocationNextAsync(final String nextPageLink) { + return listByResourceGroupLocationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByResourceGroupLocationNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupLocationNextSinglePageAsync(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(listByResourceGroupLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given location. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupLocationNextSinglePageAsync(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.listByResourceGroupLocationNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupLocationNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupLocationNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LongTermRetentionBackupInner> object if successful. + */ + public PagedList listByResourceGroupServerNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupServerNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the long term retention backups for a given server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupServerNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupServerNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable> listByResourceGroupServerNextAsync(final String nextPageLink) { + return listByResourceGroupServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LongTermRetentionBackupInner> object + */ + public Observable>> listByResourceGroupServerNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupServerNextSinglePageAsync(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(listByResourceGroupServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the long term retention backups for a given server. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LongTermRetentionBackupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupServerNextSinglePageAsync(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.listByResourceGroupServerNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupServerNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupServerNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) 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/ManagedDatabaseImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseImpl.java index c94888814d2e..1ccab4d6b2ec 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseImpl.java @@ -146,6 +146,16 @@ public String name() { return this.inner().name(); } + @Override + public String recoverableDatabaseId() { + return this.inner().recoverableDatabaseId(); + } + + @Override + public String restorableDroppedDatabaseId() { + return this.inner().restorableDroppedDatabaseId(); + } + @Override public DateTime restorePointInTime() { return this.inner().restorePointInTime(); @@ -224,6 +234,26 @@ public ManagedDatabaseImpl withCreateMode(ManagedDatabaseCreateMode createMode) return this; } + @Override + public ManagedDatabaseImpl withRecoverableDatabaseId(String recoverableDatabaseId) { + if (isInCreateMode()) { + this.inner().withRecoverableDatabaseId(recoverableDatabaseId); + } else { + this.updateParameter.withRecoverableDatabaseId(recoverableDatabaseId); + } + return this; + } + + @Override + public ManagedDatabaseImpl withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + if (isInCreateMode()) { + this.inner().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + } else { + this.updateParameter.withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + } + return this; + } + @Override public ManagedDatabaseImpl withRestorePointInTime(DateTime restorePointInTime) { if (isInCreateMode()) { diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseInner.java index 9f704415711c..d02e6a1de06e 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseInner.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseInner.java @@ -28,8 +28,8 @@ public class ManagedDatabaseInner extends Resource { private String collation; /** - * Status for the database. Possible values include: 'Online', 'Offline', - * 'Shutdown', 'Creating', 'Inaccessible'. + * Status of the database. Possible values include: 'Online', 'Offline', + * 'Shutdown', 'Creating', 'Inaccessible', 'Updating'. */ @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) private ManagedDatabaseStatus status; @@ -73,8 +73,11 @@ public class ManagedDatabaseInner extends Resource { * SourceDatabaseName, SourceManagedInstanceName and PointInTime must be * specified. RestoreExternalBackup: Create a database by restoring from * external backup files. Collation, StorageContainerUri and - * StorageContainerSasToken must be specified. Possible values include: - * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + * StorageContainerSasToken must be specified. Recovery: Creates a database + * by restoring a geo-replicated backup. RecoverableDatabaseId must be + * specified as the recoverable database resource ID to restore. Possible + * values include: 'Default', 'RestoreExternalBackup', + * 'PointInTimeRestore', 'Recovery'. */ @JsonProperty(value = "properties.createMode") private ManagedDatabaseCreateMode createMode; @@ -94,6 +97,13 @@ public class ManagedDatabaseInner extends Resource { @JsonProperty(value = "properties.sourceDatabaseId") private String sourceDatabaseId; + /** + * The restorable dropped database resource id to restore when creating + * this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + /** * Conditional. If createMode is RestoreExternalBackup, this value is * required. Specifies the storage container sas token. @@ -108,6 +118,13 @@ public class ManagedDatabaseInner extends Resource { @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) private String failoverGroupId; + /** + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + /** * Get collation of the managed database. * @@ -129,7 +146,7 @@ public ManagedDatabaseInner withCollation(String collation) { } /** - * Get status for the database. Possible values include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible'. + * Get status of the database. Possible values include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Updating'. * * @return the status value */ @@ -205,7 +222,7 @@ public ManagedDatabaseInner withCatalogCollation(CatalogCollationType catalogCol } /** - * Get managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + * Get managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery'. * * @return the createMode value */ @@ -214,7 +231,7 @@ public ManagedDatabaseCreateMode createMode() { } /** - * Set managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + * Set managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery'. * * @param createMode the createMode value to set * @return the ManagedDatabaseInner object itself. @@ -264,6 +281,26 @@ public ManagedDatabaseInner withSourceDatabaseId(String sourceDatabaseId) { return this; } + /** + * Get the restorable dropped database resource id to restore when creating this database. + * + * @return the restorableDroppedDatabaseId value + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the restorable dropped database resource id to restore when creating this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + /** * Get conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. * @@ -293,4 +330,24 @@ public String failoverGroupId() { return this.failoverGroupId; } + /** + * Get the resource identifier of the recoverable database associated with create operation of this database. + * + * @return the recoverableDatabaseId value + */ + public String recoverableDatabaseId() { + return this.recoverableDatabaseId; + } + + /** + * Set the resource identifier of the recoverable database associated with create operation of this database. + * + * @param recoverableDatabaseId the recoverableDatabaseId value to set + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + 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/ManagedDatabaseSecurityAlertPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.java new file mode 100644 index 000000000000..909f6becf04f --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.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.ManagedDatabaseSecurityAlertPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicy; + +class ManagedDatabaseSecurityAlertPoliciesImpl extends WrapperImpl implements ManagedDatabaseSecurityAlertPolicies { + private final SqlManager manager; + + ManagedDatabaseSecurityAlertPoliciesImpl(SqlManager manager) { + super(manager.inner().managedDatabaseSecurityAlertPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl define(String name) { + return wrapModel(name); + } + + private ManagedDatabaseSecurityAlertPolicyImpl wrapModel(ManagedDatabaseSecurityAlertPolicyInner inner) { + return new ManagedDatabaseSecurityAlertPolicyImpl(inner, manager()); + } + + private ManagedDatabaseSecurityAlertPolicyImpl wrapModel(String name) { + return new ManagedDatabaseSecurityAlertPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ManagedDatabaseSecurityAlertPoliciesInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedDatabaseSecurityAlertPolicy call(ManagedDatabaseSecurityAlertPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedDatabaseSecurityAlertPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName, databaseName) + .map(new Func1() { + @Override + public ManagedDatabaseSecurityAlertPolicy call(ManagedDatabaseSecurityAlertPolicyInner 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/ManagedDatabaseSecurityAlertPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesInner.java new file mode 100644 index 000000000000..f18737d42a4b --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPoliciesInner.java @@ -0,0 +1,520 @@ +/** + * 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 com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.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 ManagedDatabaseSecurityAlertPolicies. + */ +public class ManagedDatabaseSecurityAlertPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedDatabaseSecurityAlertPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseSecurityAlertPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedDatabaseSecurityAlertPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedDatabaseSecurityAlertPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedDatabaseSecurityAlertPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedDatabaseSecurityAlertPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @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.ManagedDatabaseSecurityAlertPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseSecurityAlertPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicies listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a managed database's security alert 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 databaseName The name of the managed database for which the security alert policy is defined. + * @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 ManagedDatabaseSecurityAlertPolicyInner object if successful. + */ + public ManagedDatabaseSecurityAlertPolicyInner get(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a managed database's security alert 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 databaseName The name of the managed database for which the security alert policy is defined. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String managedInstanceName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName), serviceCallback); + } + + /** + * Gets a managed database's security alert 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 databaseName The name of the managed database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseSecurityAlertPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName).map(new Func1, ManagedDatabaseSecurityAlertPolicyInner>() { + @Override + public ManagedDatabaseSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed database's security alert 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 databaseName The name of the managed database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseSecurityAlertPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String securityAlertPolicyName = "default"; + return service.get(resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, 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); + } + + /** + * Creates or updates a database's security alert 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 databaseName The name of the managed database for which the security alert policy is defined. + * @param parameters The database security alert policy. + * @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 ManagedDatabaseSecurityAlertPolicyInner object if successful. + */ + public ManagedDatabaseSecurityAlertPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database's security alert 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 databaseName The name of the managed database for which the security alert policy is defined. + * @param parameters The database security alert policy. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database's security alert 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 databaseName The name of the managed database for which the security alert policy is defined. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseSecurityAlertPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedDatabaseSecurityAlertPolicyInner>() { + @Override + public ManagedDatabaseSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's security alert 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 databaseName The name of the managed database for which the security alert policy is defined. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedDatabaseSecurityAlertPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseSecurityAlertPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String securityAlertPolicyName = "default"; + return service.createOrUpdate(resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @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<ManagedDatabaseSecurityAlertPolicyInner> object if successful. + */ + public PagedList listByDatabase(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + ServiceResponse> response = listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedDatabaseSecurityAlertPolicyInner> object + */ + public Observable> listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedDatabaseSecurityAlertPolicyInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + return listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of managed database's security alert policies. + * + 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 databaseName The name of the managed database for which the security alert policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedDatabaseSecurityAlertPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByDatabase(resourceGroupName, managedInstanceName, databaseName, 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 = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @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<ManagedDatabaseSecurityAlertPolicyInner> object if successful. + */ + public PagedList listByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @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<ManagedDatabaseSecurityAlertPolicyInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @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<ManagedDatabaseSecurityAlertPolicyInner> object + */ + public Observable>> listByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of managed database's security alert policies. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedDatabaseSecurityAlertPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java new file mode 100644 index 000000000000..23a4e802955b --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java @@ -0,0 +1,180 @@ +/** + * 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.ManagedDatabaseSecurityAlertPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SecurityAlertPolicyState; +import java.util.List; +import org.joda.time.DateTime; + +class ManagedDatabaseSecurityAlertPolicyImpl extends CreatableUpdatableImpl implements ManagedDatabaseSecurityAlertPolicy, ManagedDatabaseSecurityAlertPolicy.Definition, ManagedDatabaseSecurityAlertPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + private String databaseName; + + ManagedDatabaseSecurityAlertPolicyImpl(String name, SqlManager manager) { + super(name, new ManagedDatabaseSecurityAlertPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + ManagedDatabaseSecurityAlertPolicyImpl(ManagedDatabaseSecurityAlertPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // set resource ancestor and positional variables + 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() { + ManagedDatabaseSecurityAlertPoliciesInner client = this.manager().inner().managedDatabaseSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedDatabaseSecurityAlertPoliciesInner client = this.manager().inner().managedDatabaseSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedDatabaseSecurityAlertPoliciesInner client = this.manager().inner().managedDatabaseSecurityAlertPolicies(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime creationTime() { + return this.inner().creationTime(); + } + + @Override + public List disabledAlerts() { + return this.inner().disabledAlerts(); + } + + @Override + public Boolean emailAccountAdmins() { + return this.inner().emailAccountAdmins(); + } + + @Override + public List emailAddresses() { + return this.inner().emailAddresses(); + } + + @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 SecurityAlertPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public String storageEndpoint() { + return this.inner().storageEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withExistingDatabasis(String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.inner().withDisabledAlerts(disabledAlerts); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.inner().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.inner().withEmailAddresses(emailAddresses); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ManagedDatabaseSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + 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/ManagedDatabaseSecurityAlertPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyInner.java new file mode 100644 index 000000000000..00ae08954262 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabaseSecurityAlertPolicyInner.java @@ -0,0 +1,227 @@ +/** + * 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.SecurityAlertPolicyState; +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A managed database security alert policy. + */ +@JsonFlatten +public class ManagedDatabaseSecurityAlertPolicyInner extends ProxyResource { + /** + * Specifies the state of the policy, whether it is enabled or disabled or + * a policy has not been applied yet on the specific database. Possible + * values include: 'New', 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private SecurityAlertPolicyState state; + + /** + * Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, + * Data_Exfiltration, Unsafe_Action. + */ + @JsonProperty(value = "properties.disabledAlerts") + private List disabledAlerts; + + /** + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "properties.emailAddresses") + private List emailAddresses; + + /** + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "properties.emailAccountAdmins") + private Boolean emailAccountAdmins; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the Threat Detection audit storage + * account. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationTime; + + /** + * Get specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @return the state value + */ + public SecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withState(SecurityAlertPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @return the disabledAlerts value + */ + public List disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @param disabledAlerts the disabledAlerts value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value + */ + public List emailAddresses() { + return this.emailAddresses; + } + + /** + * Set specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withEmailAddresses(List emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value + */ + public Boolean emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.emailAccountAdmins = emailAccountAdmins; + return this; + } + + /** + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the Threat Detection audit storage account. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the Threat Detection audit storage account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies the UTC creation time of the policy. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java index 978f15b2b56c..db23e9b7f3ba 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java @@ -688,7 +688,7 @@ private ServiceResponse beginCreateOrUpdateDelegate(Respon } /** - * Deletes the managed database. + * Deletes a managed database. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param managedInstanceName The name of the managed instance. @@ -702,7 +702,7 @@ public void delete(String resourceGroupName, String managedInstanceName, String } /** - * Deletes the managed database. + * Deletes a managed database. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param managedInstanceName The name of the managed instance. @@ -716,7 +716,7 @@ public ServiceFuture deleteAsync(String resourceGroupName, String managedI } /** - * Deletes the managed database. + * Deletes a managed database. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param managedInstanceName The name of the managed instance. @@ -734,7 +734,7 @@ public Void call(ServiceResponse response) { } /** - * Deletes the managed database. + * Deletes a managed database. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param managedInstanceName The name of the managed instance. @@ -763,7 +763,7 @@ public Observable> deleteWithServiceResponseAsync(String r } /** - * Deletes the managed database. + * Deletes a managed database. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param managedInstanceName The name of the managed instance. @@ -777,7 +777,7 @@ public void beginDelete(String resourceGroupName, String managedInstanceName, St } /** - * Deletes the managed database. + * Deletes a managed database. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param managedInstanceName The name of the managed instance. @@ -791,7 +791,7 @@ public ServiceFuture beginDeleteAsync(String resourceGroupName, String man } /** - * Deletes the managed database. + * Deletes a managed database. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param managedInstanceName The name of the managed instance. @@ -809,7 +809,7 @@ public Void call(ServiceResponse response) { } /** - * Deletes the managed database. + * Deletes a managed database. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param managedInstanceName The name of the managed instance. 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/ManagedServerSecurityAlertPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesImpl.java new file mode 100644 index 000000000000..81992c52c9cc --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesImpl.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. + * 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.ManagedServerSecurityAlertPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedServerSecurityAlertPolicy; +import com.microsoft.azure.Page; + +class ManagedServerSecurityAlertPoliciesImpl extends WrapperImpl implements ManagedServerSecurityAlertPolicies { + private final SqlManager manager; + + ManagedServerSecurityAlertPoliciesImpl(SqlManager manager) { + super(manager.inner().managedServerSecurityAlertPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl defineSecurityAlertPolicy(String name) { + return wrapSecurityAlertPolicyModel(name); + } + + private ManagedServerSecurityAlertPolicyImpl wrapSecurityAlertPolicyModel(String name) { + return new ManagedServerSecurityAlertPolicyImpl(name, this.manager()); + } + + private ManagedServerSecurityAlertPolicyImpl wrapManagedServerSecurityAlertPolicyModel(ManagedServerSecurityAlertPolicyInner inner) { + return new ManagedServerSecurityAlertPolicyImpl(inner, manager()); + } + + private Observable getManagedServerSecurityAlertPolicyInnerUsingManagedServerSecurityAlertPoliciesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String managedInstanceName = IdParsingUtils.getValueFromIdByName(id, "managedInstances"); + ManagedServerSecurityAlertPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName); + } + + @Override + public Observable getAsync(String resourceGroupName, String managedInstanceName) { + ManagedServerSecurityAlertPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, managedInstanceName) + .map(new Func1() { + @Override + public ManagedServerSecurityAlertPolicy call(ManagedServerSecurityAlertPolicyInner inner) { + return wrapManagedServerSecurityAlertPolicyModel(inner); + } + }); + } + + @Override + public Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { + ManagedServerSecurityAlertPoliciesInner 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 ManagedServerSecurityAlertPolicy call(ManagedServerSecurityAlertPolicyInner inner) { + return wrapManagedServerSecurityAlertPolicyModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesInner.java new file mode 100644 index 000000000000..0382e0c34a81 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPoliciesInner.java @@ -0,0 +1,580 @@ +/** + * 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 com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.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 ManagedServerSecurityAlertPolicies. + */ +public class ManagedServerSecurityAlertPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedServerSecurityAlertPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedServerSecurityAlertPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedServerSecurityAlertPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedServerSecurityAlertPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedServerSecurityAlertPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedServerSecurityAlertPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedServerSecurityAlertPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @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.ManagedServerSecurityAlertPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body ManagedServerSecurityAlertPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedServerSecurityAlertPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body ManagedServerSecurityAlertPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedServerSecurityAlertPolicies listByInstance" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies") + 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.ManagedServerSecurityAlertPolicies listByInstanceNext" }) + @GET + Observable> listByInstanceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get a managed server's threat detection 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. + * @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 ManagedServerSecurityAlertPolicyInner object if successful. + */ + public ManagedServerSecurityAlertPolicyInner get(String resourceGroupName, String managedInstanceName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body(); + } + + /** + * Get a managed server's threat detection 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 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, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Get a managed server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedServerSecurityAlertPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String managedInstanceName) { + return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, ManagedServerSecurityAlertPolicyInner>() { + @Override + public ManagedServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get a managed server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedServerSecurityAlertPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String securityAlertPolicyName = "Default"; + return service.get(resourceGroupName, managedInstanceName, securityAlertPolicyName, 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); + } + + /** + * Creates or updates a threat detection 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 parameters The managed server security alert policy. + * @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 ManagedServerSecurityAlertPolicyInner object if successful. + */ + public ManagedServerSecurityAlertPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a threat detection 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 parameters The managed server security alert policy. + * @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, ManagedServerSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates or updates a threat detection 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 parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedServerSecurityAlertPolicyInner>() { + @Override + public ManagedServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a threat detection 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 parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String securityAlertPolicyName = "Default"; + Observable> observable = service.createOrUpdate(resourceGroupName, managedInstanceName, securityAlertPolicyName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a threat detection 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 parameters The managed server security alert policy. + * @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 ManagedServerSecurityAlertPolicyInner object if successful. + */ + public ManagedServerSecurityAlertPolicyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a threat detection 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 parameters The managed server security alert policy. + * @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, ManagedServerSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates or updates a threat detection 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 parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedServerSecurityAlertPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedServerSecurityAlertPolicyInner>() { + @Override + public ManagedServerSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a threat detection 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 parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedServerSecurityAlertPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedServerSecurityAlertPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String securityAlertPolicyName = "Default"; + return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, securityAlertPolicyName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get the managed server's threat detection policies. + * + * @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<ManagedServerSecurityAlertPolicyInner> 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(); + } + }; + } + + /** + * Get the managed server's threat detection policies. + * + * @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); + } + + /** + * Get the managed server's threat detection policies. + * + * @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<ManagedServerSecurityAlertPolicyInner> 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(); + } + }); + } + + /** + * Get the managed server's threat detection policies. + * + * @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<ManagedServerSecurityAlertPolicyInner> 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)); + } + }); + } + + /** + * Get the managed server's threat detection policies. + * + 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<ManagedServerSecurityAlertPolicyInner> 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); + } + + /** + * Get the managed server's threat detection policies. + * + * @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<ManagedServerSecurityAlertPolicyInner> 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(); + } + }; + } + + /** + * Get the managed server's threat detection policies. + * + * @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); + } + + /** + * Get the managed server's threat detection policies. + * + * @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<ManagedServerSecurityAlertPolicyInner> object + */ + public Observable> listByInstanceNextAsync(final String nextPageLink) { + return listByInstanceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the managed server's threat detection policies. + * + * @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<ManagedServerSecurityAlertPolicyInner> 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)); + } + }); + } + + /** + * Get the managed server's threat detection policies. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedServerSecurityAlertPolicyInner> 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/ManagedServerSecurityAlertPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyImpl.java new file mode 100644 index 000000000000..58aa87677cfd --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyImpl.java @@ -0,0 +1,177 @@ +/** + * 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.ManagedServerSecurityAlertPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SecurityAlertPolicyState; +import java.util.List; +import org.joda.time.DateTime; + +class ManagedServerSecurityAlertPolicyImpl extends CreatableUpdatableImpl implements ManagedServerSecurityAlertPolicy, ManagedServerSecurityAlertPolicy.Definition, ManagedServerSecurityAlertPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String managedInstanceName; + + ManagedServerSecurityAlertPolicyImpl(String name, SqlManager manager) { + super(name, new ManagedServerSecurityAlertPolicyInner()); + this.manager = manager; + // Set resource name + this.managedInstanceName = name; + // + } + + ManagedServerSecurityAlertPolicyImpl(ManagedServerSecurityAlertPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.managedInstanceName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.managedInstanceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedInstances"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagedServerSecurityAlertPoliciesInner client = this.manager().inner().managedServerSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedServerSecurityAlertPoliciesInner client = this.manager().inner().managedServerSecurityAlertPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.managedInstanceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedServerSecurityAlertPoliciesInner client = this.manager().inner().managedServerSecurityAlertPolicies(); + return client.getAsync(this.resourceGroupName, this.managedInstanceName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime creationTime() { + return this.inner().creationTime(); + } + + @Override + public List disabledAlerts() { + return this.inner().disabledAlerts(); + } + + @Override + public Boolean emailAccountAdmins() { + return this.inner().emailAccountAdmins(); + } + + @Override + public List emailAddresses() { + return this.inner().emailAddresses(); + } + + @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 SecurityAlertPolicyState state() { + return this.inner().state(); + } + + @Override + public String storageAccountAccessKey() { + return this.inner().storageAccountAccessKey(); + } + + @Override + public String storageEndpoint() { + return this.inner().storageEndpoint(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withExistingManagedInstance(String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.inner().withDisabledAlerts(disabledAlerts); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.inner().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.inner().withEmailAddresses(emailAddresses); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public ManagedServerSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + 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/ManagedServerSecurityAlertPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyInner.java new file mode 100644 index 000000000000..9ab378c25922 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedServerSecurityAlertPolicyInner.java @@ -0,0 +1,227 @@ +/** + * 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.SecurityAlertPolicyState; +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A managed server security alert policy. + */ +@JsonFlatten +public class ManagedServerSecurityAlertPolicyInner extends ProxyResource { + /** + * Specifies the state of the policy, whether it is enabled or disabled or + * a policy has not been applied yet on the specific database. Possible + * values include: 'New', 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private SecurityAlertPolicyState state; + + /** + * Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, + * Data_Exfiltration, Unsafe_Action. + */ + @JsonProperty(value = "properties.disabledAlerts") + private List disabledAlerts; + + /** + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "properties.emailAddresses") + private List emailAddresses; + + /** + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "properties.emailAccountAdmins") + private Boolean emailAccountAdmins; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the Threat Detection audit storage + * account. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /** + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationTime; + + /** + * Get specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @return the state value + */ + public SecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withState(SecurityAlertPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @return the disabledAlerts value + */ + public List disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + * + * @param disabledAlerts the disabledAlerts value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value + */ + public List emailAddresses() { + return this.emailAddresses; + } + + /** + * Set specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withEmailAddresses(List emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value + */ + public Boolean emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.emailAccountAdmins = emailAccountAdmins; + return this; + } + + /** + * Get specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the Threat Detection audit storage account. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the Threat Detection audit storage account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies the UTC creation time of the policy. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsImpl.java new file mode 100644 index 000000000000..8bbe2a989a9a --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsImpl.java @@ -0,0 +1,53 @@ +/** + * 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.RecommendedSensitivityLabels; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisServerSensitivityLabelModel; + +class RecommendedSensitivityLabelsImpl extends WrapperImpl implements RecommendedSensitivityLabels { + private final SqlManager manager; + + RecommendedSensitivityLabelsImpl(SqlManager manager) { + super(manager.inner().recommendedSensitivityLabels()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private DatabasisServerSensitivityLabelModelImpl wrapModel(SensitivityLabelInner inner) { + return new DatabasisServerSensitivityLabelModelImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + RecommendedSensitivityLabelsInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DatabasisServerSensitivityLabelModel call(SensitivityLabelInner 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/RecommendedSensitivityLabelsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsInner.java new file mode 100644 index 000000000000..4bb7bd6f597b --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/RecommendedSensitivityLabelsInner.java @@ -0,0 +1,453 @@ +/** + * 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.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 RecommendedSensitivityLabels. + */ +public class RecommendedSensitivityLabelsInner { + /** The Retrofit service to perform REST calls. */ + private RecommendedSensitivityLabelsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RecommendedSensitivityLabelsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RecommendedSensitivityLabelsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RecommendedSensitivityLabelsService.class); + this.client = client; + } + + /** + * The interface defining all the services for RecommendedSensitivityLabels to be + * used by Retrofit to perform actually REST calls. + */ + interface RecommendedSensitivityLabelsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.RecommendedSensitivityLabels listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("includeDisabledRecommendations") Boolean includeDisabledRecommendations, @Query("$skipToken") String skipToken, @Query("$filter") String filter, @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.RecommendedSensitivityLabels listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SensitivityLabelInner> object if successful. + */ + public PagedList listByDatabase(final String resourceGroupName, final String serverName, final String databaseName) { + ServiceResponse> response = listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + return listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Boolean includeDisabledRecommendations = null; + final String skipToken = null; + final String filter = null; + return service.listByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), includeDisabledRecommendations, skipToken, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken the String value + * @param filter An OData filter expression that filters elements in the collection. + * @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<SensitivityLabelInner> object if successful. + */ + public PagedList listByDatabase(final String resourceGroupName, final String serverName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter) { + ServiceResponse> response = listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken the String value + * @param filter An OData filter expression that filters elements in the collection. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken the String value + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param skipToken the String value + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter) { + return listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, includeDisabledRecommendations, skipToken, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + ServiceResponse> * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + ServiceResponse> * @param skipToken the String value + ServiceResponse> * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final Boolean includeDisabledRecommendations, final String skipToken, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), includeDisabledRecommendations, skipToken, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SensitivityLabelInner> object if successful. + */ + public PagedList listByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} 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..dc0a4fa31aff --- /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,112 @@ +/** + * 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; + private Integer cretentionDays; + private Integer uretentionDays; + + 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(); + // set resource ancestor and positional variables + 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, this.cretentionDays) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesInner client = this.manager().inner().managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies(); + return client.updateAsync(this.resourceGroupName, this.managedInstanceName, this.restorableDroppedDatabaseId, this.uretentionDays) + .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; + } + + @Override + public RestorableDroppedDatabasisManagedInstanceManagedBackupShortTermRetentionPolicyImpl withRetentionDays(Integer retentionDays) { + if (isInCreateMode()) { + this.cretentionDays = retentionDays; + } else { + this.uretentionDays = retentionDays; + } + 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..5b85693595a6 --- /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,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.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; + // set resource ancestor and positional variables + 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/SensitivityLabelImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelImpl.java new file mode 100644 index 000000000000..582530d11cc0 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelImpl.java @@ -0,0 +1,153 @@ +/** + * 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.SensitivityLabel; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class SensitivityLabelImpl extends CreatableUpdatableImpl implements SensitivityLabel, SensitivityLabel.Definition, SensitivityLabel.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String schemaName; + private String tableName; + private String columnName; + + SensitivityLabelImpl(String name, SqlManager manager) { + super(name, new SensitivityLabelInner()); + this.manager = manager; + // Set resource name + this.columnName = name; + // + } + + SensitivityLabelImpl(SensitivityLabelInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.columnName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.schemaName = IdParsingUtils.getValueFromIdByName(inner.id(), "schemas"); + this.tableName = IdParsingUtils.getValueFromIdByName(inner.id(), "tables"); + this.columnName = IdParsingUtils.getValueFromIdByName(inner.id(), "columns"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SensitivityLabelsInner client = this.manager().inner().sensitivityLabels(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.schemaName, this.tableName, this.columnName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SensitivityLabelsInner client = this.manager().inner().sensitivityLabels(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.schemaName, this.tableName, this.columnName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SensitivityLabelsInner client = this.manager().inner().sensitivityLabels(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.schemaName, this.tableName, this.columnName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String informationType() { + return this.inner().informationType(); + } + + @Override + public String informationTypeId() { + return this.inner().informationTypeId(); + } + + @Override + public Boolean isDisabled() { + return this.inner().isDisabled(); + } + + @Override + public String labelId() { + return this.inner().labelId(); + } + + @Override + public String labelName() { + return this.inner().labelName(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SensitivityLabelImpl withExistingColumn(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.schemaName = schemaName; + this.tableName = tableName; + this.columnName = columnName; + return this; + } + + @Override + public SensitivityLabelImpl withInformationType(String informationType) { + this.inner().withInformationType(informationType); + return this; + } + + @Override + public SensitivityLabelImpl withInformationTypeId(String informationTypeId) { + this.inner().withInformationTypeId(informationTypeId); + return this; + } + + @Override + public SensitivityLabelImpl withLabelId(String labelId) { + this.inner().withLabelId(labelId); + return this; + } + + @Override + public SensitivityLabelImpl withLabelName(String labelName) { + this.inner().withLabelName(labelName); + 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/SensitivityLabelInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelInner.java new file mode 100644 index 000000000000..521015f7fb24 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelInner.java @@ -0,0 +1,141 @@ +/** + * 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.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A sensitivity label. + */ +@JsonFlatten +public class SensitivityLabelInner extends ProxyResource { + /** + * The label name. + */ + @JsonProperty(value = "properties.labelName") + private String labelName; + + /** + * The label ID. + */ + @JsonProperty(value = "properties.labelId") + private String labelId; + + /** + * The information type. + */ + @JsonProperty(value = "properties.informationType") + private String informationType; + + /** + * The information type ID. + */ + @JsonProperty(value = "properties.informationTypeId") + private String informationTypeId; + + /** + * Is sensitivity recommendation disabled. Applicable for recommended + * sensitivity label only. Specifies whether the sensitivity recommendation + * on this column is disabled (dismissed) or not. + */ + @JsonProperty(value = "properties.isDisabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDisabled; + + /** + * Get the label name. + * + * @return the labelName value + */ + public String labelName() { + return this.labelName; + } + + /** + * Set the label name. + * + * @param labelName the labelName value to set + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withLabelName(String labelName) { + this.labelName = labelName; + return this; + } + + /** + * Get the label ID. + * + * @return the labelId value + */ + public String labelId() { + return this.labelId; + } + + /** + * Set the label ID. + * + * @param labelId the labelId value to set + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withLabelId(String labelId) { + this.labelId = labelId; + return this; + } + + /** + * Get the information type. + * + * @return the informationType value + */ + public String informationType() { + return this.informationType; + } + + /** + * Set the information type. + * + * @param informationType the informationType value to set + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withInformationType(String informationType) { + this.informationType = informationType; + return this; + } + + /** + * Get the information type ID. + * + * @return the informationTypeId value + */ + public String informationTypeId() { + return this.informationTypeId; + } + + /** + * Set the information type ID. + * + * @param informationTypeId the informationTypeId value to set + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withInformationTypeId(String informationTypeId) { + this.informationTypeId = informationTypeId; + return this; + } + + /** + * Get is sensitivity recommendation disabled. Applicable for recommended sensitivity label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. + * + * @return the isDisabled value + */ + public Boolean isDisabled() { + return this.isDisabled; + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsImpl.java new file mode 100644 index 000000000000..ccc8de3f6f69 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsImpl.java @@ -0,0 +1,98 @@ +/** + * 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.SensitivityLabels; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabel; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_03_01_preview.DatabasisServerSensitivityLabel; + +class SensitivityLabelsImpl extends WrapperImpl implements SensitivityLabels { + private final SqlManager manager; + + SensitivityLabelsImpl(SqlManager manager) { + super(manager.inner().sensitivityLabels()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public SensitivityLabelImpl define(String name) { + return wrapModel(name); + } + + private SensitivityLabelImpl wrapModel(SensitivityLabelInner inner) { + return new SensitivityLabelImpl(inner, manager()); + } + + private SensitivityLabelImpl wrapModel(String name) { + return new SensitivityLabelImpl(name, this.manager()); + } + + @Override + public Completable enableRecommendationAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + SensitivityLabelsInner client = this.inner(); + return client.enableRecommendationAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).toCompletable(); + } + + @Override + public Completable disableRecommendationAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + SensitivityLabelsInner client = this.inner(); + return client.disableRecommendationAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).toCompletable(); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + SensitivityLabelsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource) + .map(new Func1() { + @Override + public SensitivityLabel call(SensitivityLabelInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + SensitivityLabelsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).toCompletable(); + } + + private DatabasisServerSensitivityLabelImpl wrapDatabasisServerSensitivityLabelModel(SensitivityLabelInner inner) { + return new DatabasisServerSensitivityLabelImpl(inner, manager()); + } + + @Override + public Observable listCurrentByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + SensitivityLabelsInner client = this.inner(); + return client.listCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DatabasisServerSensitivityLabel call(SensitivityLabelInner inner) { + return wrapDatabasisServerSensitivityLabelModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsInner.java new file mode 100644 index 000000000000..e3b212635a16 --- /dev/null +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/SensitivityLabelsInner.java @@ -0,0 +1,1055 @@ +/** + * 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.management.sql.v2017_03_01_preview.SensitivityLabelSource; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in SensitivityLabels. + */ +public class SensitivityLabelsInner { + /** The Retrofit service to perform REST calls. */ + private SensitivityLabelsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of SensitivityLabelsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SensitivityLabelsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(SensitivityLabelsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SensitivityLabels to be + * used by Retrofit to perform actually REST calls. + */ + interface SensitivityLabelsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabels listCurrentByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels") + Observable> listCurrentByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @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.SensitivityLabels enableRecommendation" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable") + Observable> enableRecommendation(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("schemaName") String schemaName, @Path("tableName") String tableName, @Path("columnName") String columnName, @Path("sensitivityLabelSource") String sensitivityLabelSource, @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.SensitivityLabels disableRecommendation" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable") + Observable> disableRecommendation(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("schemaName") String schemaName, @Path("tableName") String tableName, @Path("columnName") String columnName, @Path("sensitivityLabelSource") String sensitivityLabelSource, @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.SensitivityLabels get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("schemaName") String schemaName, @Path("tableName") String tableName, @Path("columnName") String columnName, @Path("sensitivityLabelSource") SensitivityLabelSource sensitivityLabelSource, @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.SensitivityLabels createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("schemaName") String schemaName, @Path("tableName") String tableName, @Path("columnName") String columnName, @Path("sensitivityLabelSource") String sensitivityLabelSource, @Path("subscriptionId") String subscriptionId, @Body SensitivityLabelInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabels delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("schemaName") String schemaName, @Path("tableName") String tableName, @Path("columnName") String columnName, @Path("sensitivityLabelSource") String sensitivityLabelSource, @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.SensitivityLabels listCurrentByDatabaseNext" }) + @GET + Observable> listCurrentByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SensitivityLabelInner> object if successful. + */ + public PagedList listCurrentByDatabase(final String resourceGroupName, final String serverName, final String databaseName) { + ServiceResponse> response = listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listCurrentByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listCurrentByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + return listCurrentByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listCurrentByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + return listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName) + .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(listCurrentByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listCurrentByDatabaseSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listCurrentByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listCurrentByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @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<SensitivityLabelInner> object if successful. + */ + public PagedList listCurrentByDatabase(final String resourceGroupName, final String serverName, final String databaseName, final String filter) { + ServiceResponse> response = listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @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> listCurrentByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listCurrentByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String filter) { + return listCurrentByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listCurrentByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String filter) { + return listCurrentByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter) + .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(listCurrentByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + ServiceResponse> * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listCurrentByDatabaseSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listCurrentByDatabase(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listCurrentByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listCurrentByDatabaseDelegate(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); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enableRecommendation(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + enableRecommendationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).toBlocking().single().body(); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 enableRecommendationAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(enableRecommendationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName), serviceCallback); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable enableRecommendationAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + return enableRecommendationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> enableRecommendationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (schemaName == null) { + throw new IllegalArgumentException("Parameter schemaName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (columnName == null) { + throw new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "recommended"; + return service.enableRecommendation(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, 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 = enableRecommendationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse enableRecommendationDelegate(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); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void disableRecommendation(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + disableRecommendationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).toBlocking().single().body(); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @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 disableRecommendationAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(disableRecommendationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName), serviceCallback); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable disableRecommendationAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + return disableRecommendationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> disableRecommendationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (schemaName == null) { + throw new IllegalArgumentException("Parameter schemaName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (columnName == null) { + throw new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "recommended"; + return service.disableRecommendation(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, 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 = disableRecommendationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse disableRecommendationDelegate(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 the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @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 SensitivityLabelInner object if successful. + */ + public SensitivityLabelInner get(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource).toBlocking().single().body(); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource), serviceCallback); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SensitivityLabelInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource).map(new Func1, SensitivityLabelInner>() { + @Override + public SensitivityLabelInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. Possible values include: 'current', 'recommended' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SensitivityLabelInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelSource sensitivityLabelSource) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (schemaName == null) { + throw new IllegalArgumentException("Parameter schemaName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (columnName == null) { + throw new IllegalArgumentException("Parameter columnName is required and cannot be null."); + } + if (sensitivityLabelSource == null) { + throw new IllegalArgumentException("Parameter sensitivityLabelSource 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, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, 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); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @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 SensitivityLabelInner object if successful. + */ + public SensitivityLabelInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters), serviceCallback); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SensitivityLabelInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters).map(new Func1, SensitivityLabelInner>() { + @Override + public SensitivityLabelInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SensitivityLabelInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, SensitivityLabelInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (schemaName == null) { + throw new IllegalArgumentException("Parameter schemaName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (columnName == null) { + throw new IllegalArgumentException("Parameter columnName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + final String sensitivityLabelSource = "current"; + return service.createOrUpdate(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).toBlocking().single().body(); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName), serviceCallback); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName, String columnName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (schemaName == null) { + throw new IllegalArgumentException("Parameter schemaName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (columnName == null) { + throw new IllegalArgumentException("Parameter columnName 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 sensitivityLabelSource = "current"; + return service.delete(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource, 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 = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(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 the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SensitivityLabelInner> object if successful. + */ + public PagedList listCurrentByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listCurrentByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listCurrentByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listCurrentByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable> listCurrentByDatabaseNextAsync(final String nextPageLink) { + return listCurrentByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SensitivityLabelInner> object + */ + public Observable>> listCurrentByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listCurrentByDatabaseNextSinglePageAsync(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(listCurrentByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the sensitivity labels of a given database. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SensitivityLabelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listCurrentByDatabaseNextSinglePageAsync(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.listCurrentByDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listCurrentByDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listCurrentByDatabaseNextDelegate(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/ServerSecurityAlertPoliciesImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesImpl.java index c6ade364ecd0..59d243f70704 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesImpl.java @@ -13,6 +13,7 @@ import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerSecurityAlertPolicies; import rx.Observable; import rx.functions.Func1; +import com.microsoft.azure.Page; import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerSecurityAlertPolicy; class ServerSecurityAlertPoliciesImpl extends WrapperImpl implements ServerSecurityAlertPolicies { @@ -40,6 +41,24 @@ private ServerSecurityAlertPolicyImpl wrapModel(String name) { return new ServerSecurityAlertPolicyImpl(name, this.manager()); } + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + ServerSecurityAlertPoliciesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ServerSecurityAlertPolicy call(ServerSecurityAlertPolicyInner inner) { + return wrapModel(inner); + } + }); + } + @Override public Observable getAsync(String resourceGroupName, String serverName) { ServerSecurityAlertPoliciesInner client = this.inner(); diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesInner.java index def77e2a49bb..99f15e68d758 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesInner.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPoliciesInner.java @@ -10,12 +10,17 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator; import java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; @@ -24,6 +29,7 @@ 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; @@ -66,6 +72,14 @@ interface ServerSecurityAlertPoliciesService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Path("subscriptionId") String subscriptionId, @Body ServerSecurityAlertPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_03_01_preview.ServerSecurityAlertPolicies listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies") + Observable> listByServer(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @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.ServerSecurityAlertPolicies listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -329,4 +343,238 @@ private ServiceResponse beginCreateOrUpdateDeleg .build(response); } + /** + * Get the server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @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<ServerSecurityAlertPolicyInner> object if successful. + */ + public PagedList listByServer(final String resourceGroupName, final String serverName) { + ServiceResponse> response = listByServerSinglePageAsync(resourceGroupName, serverName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByServerAsync(final String resourceGroupName, final String serverName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(resourceGroupName, serverName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServerSecurityAlertPolicyInner> object + */ + public Observable> listByServerAsync(final String resourceGroupName, final String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the server's threat detection policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServerSecurityAlertPolicyInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String resourceGroupName, final String serverName) { + return listByServerSinglePageAsync(resourceGroupName, serverName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the server's threat detection policies. + * + 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServerSecurityAlertPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String resourceGroupName, final String serverName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (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.listByServer(resourceGroupName, serverName, 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 = listByServerDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServerDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get the server's threat detection policies. + * + * @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<ServerSecurityAlertPolicyInner> object if successful. + */ + public PagedList listByServerNext(final String nextPageLink) { + ServiceResponse> response = listByServerNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the server's threat detection policies. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByServerNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the server's threat detection policies. + * + * @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<ServerSecurityAlertPolicyInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the server's threat detection policies. + * + * @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<ServerSecurityAlertPolicyInner> object + */ + public Observable>> listByServerNextWithServiceResponseAsync(final String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the server's threat detection policies. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServerSecurityAlertPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByServerNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServerNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + } diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java index 483198adba66..0a158d1c8663 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyImpl.java @@ -13,6 +13,7 @@ import rx.Observable; import com.microsoft.azure.management.sql.v2017_03_01_preview.SecurityAlertPolicyState; import java.util.List; +import org.joda.time.DateTime; class ServerSecurityAlertPolicyImpl extends CreatableUpdatableImpl implements ServerSecurityAlertPolicy, ServerSecurityAlertPolicy.Definition, ServerSecurityAlertPolicy.Update { private final SqlManager manager; @@ -69,6 +70,11 @@ public boolean isInCreateMode() { } + @Override + public DateTime creationTime() { + return this.inner().creationTime(); + } + @Override public List disabledAlerts() { return this.inner().disabledAlerts(); diff --git a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java index 2441ffcb32c1..570608e864c5 100644 --- a/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java +++ b/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerSecurityAlertPolicyInner.java @@ -10,6 +10,7 @@ import com.microsoft.azure.management.sql.v2017_03_01_preview.SecurityAlertPolicyState; import java.util.List; +import org.joda.time.DateTime; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.ProxyResource; @@ -20,8 +21,9 @@ @JsonFlatten public class ServerSecurityAlertPolicyInner extends ProxyResource { /** - * Specifies the state of the policy, whether it is enabled or disabled. - * Possible values include: 'New', 'Enabled', 'Disabled'. + * Specifies the state of the policy, whether it is enabled or disabled or + * a policy has not been applied yet on the specific database. Possible + * values include: 'New', 'Enabled', 'Disabled'. */ @JsonProperty(value = "properties.state", required = true) private SecurityAlertPolicyState state; @@ -68,7 +70,13 @@ public class ServerSecurityAlertPolicyInner extends ProxyResource { private Integer retentionDays; /** - * Get specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled'. + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationTime; + + /** + * Get specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'New', 'Enabled', 'Disabled'. * * @return the state value */ @@ -77,7 +85,7 @@ public SecurityAlertPolicyState state() { } /** - * Set specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled'. + * Set specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'New', 'Enabled', 'Disabled'. * * @param state the state value to set * @return the ServerSecurityAlertPolicyInner object itself. @@ -207,4 +215,13 @@ public ServerSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { return this; } + /** + * Get specifies the UTC creation time of the policy. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + } 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 b0723cfc11d2..6f96d8c92ba7 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. */ @@ -470,6 +496,58 @@ public ServerSecurityAlertPoliciesInner serverSecurityAlertPolicies() { return this.serverSecurityAlertPolicies; } + /** + * The ManagedDatabaseSecurityAlertPoliciesInner object to access its operations. + */ + private ManagedDatabaseSecurityAlertPoliciesInner managedDatabaseSecurityAlertPolicies; + + /** + * Gets the ManagedDatabaseSecurityAlertPoliciesInner object to access its operations. + * @return the ManagedDatabaseSecurityAlertPoliciesInner object. + */ + public ManagedDatabaseSecurityAlertPoliciesInner managedDatabaseSecurityAlertPolicies() { + return this.managedDatabaseSecurityAlertPolicies; + } + + /** + * The ManagedServerSecurityAlertPoliciesInner object to access its operations. + */ + private ManagedServerSecurityAlertPoliciesInner managedServerSecurityAlertPolicies; + + /** + * Gets the ManagedServerSecurityAlertPoliciesInner object to access its operations. + * @return the ManagedServerSecurityAlertPoliciesInner object. + */ + public ManagedServerSecurityAlertPoliciesInner managedServerSecurityAlertPolicies() { + return this.managedServerSecurityAlertPolicies; + } + + /** + * The SensitivityLabelsInner object to access its operations. + */ + private SensitivityLabelsInner sensitivityLabels; + + /** + * Gets the SensitivityLabelsInner object to access its operations. + * @return the SensitivityLabelsInner object. + */ + public SensitivityLabelsInner sensitivityLabels() { + return this.sensitivityLabels; + } + + /** + * The RecommendedSensitivityLabelsInner object to access its operations. + */ + private RecommendedSensitivityLabelsInner recommendedSensitivityLabels; + + /** + * Gets the RecommendedSensitivityLabelsInner object to access its operations. + * @return the RecommendedSensitivityLabelsInner object. + */ + public RecommendedSensitivityLabelsInner recommendedSensitivityLabels() { + return this.recommendedSensitivityLabels; + } + /** * Initializes an instance of SqlManagementClient client. * @@ -527,10 +605,16 @@ 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); this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesInner(restClient().retrofit(), this); + this.managedDatabaseSecurityAlertPolicies = new ManagedDatabaseSecurityAlertPoliciesInner(restClient().retrofit(), this); + this.managedServerSecurityAlertPolicies = new ManagedServerSecurityAlertPoliciesInner(restClient().retrofit(), this); + this.sensitivityLabels = new SensitivityLabelsInner(restClient().retrofit(), this); + this.recommendedSensitivityLabels = new RecommendedSensitivityLabelsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(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 17ec28e13069..1986ddeb98fe 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,10 +38,16 @@ 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; import com.microsoft.azure.management.sql.v2017_03_01_preview.ServerSecurityAlertPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedDatabaseSecurityAlertPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.ManagedServerSecurityAlertPolicies; +import com.microsoft.azure.management.sql.v2017_03_01_preview.SensitivityLabels; +import com.microsoft.azure.management.sql.v2017_03_01_preview.RecommendedSensitivityLabels; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -71,10 +77,16 @@ public final class SqlManager extends ManagerCore