diff --git a/sql/resource-manager/v2014_04_01/pom.xml b/sql/resource-manager/v2014_04_01/pom.xml new file mode 100644 index 0000000000000..15ee9d56a144a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.sql.v2014_04_01 + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-sql + 1.0.0-beta + jar + Microsoft Azure SDK for Sql Management + This package contains Microsoft Sql Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AuthenticationType.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AuthenticationType.java new file mode 100644 index 0000000000000..4612cd8dbdcb3 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/AuthenticationType.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AuthenticationType. + */ +public enum AuthenticationType { + /** Enum value SQL. */ + SQL("SQL"), + + /** Enum value ADPassword. */ + ADPASSWORD("ADPassword"); + + /** The actual serialized value for a AuthenticationType instance. */ + private String value; + + AuthenticationType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AuthenticationType instance. + * + * @param value the serialized value to parse. + * @return the parsed AuthenticationType object, or null if unable to parse. + */ + @JsonCreator + public static AuthenticationType fromString(String value) { + AuthenticationType[] items = AuthenticationType.values(); + for (AuthenticationType 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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityReason.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityReason.java new file mode 100644 index 0000000000000..43ccfbe6df5d7 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityReason.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CheckNameAvailabilityReason. + */ +public enum CheckNameAvailabilityReason { + /** Enum value Invalid. */ + INVALID("Invalid"), + + /** Enum value AlreadyExists. */ + ALREADY_EXISTS("AlreadyExists"); + + /** The actual serialized value for a CheckNameAvailabilityReason instance. */ + private String value; + + CheckNameAvailabilityReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CheckNameAvailabilityReason instance. + * + * @param value the serialized value to parse. + * @return the parsed CheckNameAvailabilityReason object, or null if unable to parse. + */ + @JsonCreator + public static CheckNameAvailabilityReason fromString(String value) { + CheckNameAvailabilityReason[] items = CheckNameAvailabilityReason.values(); + for (CheckNameAvailabilityReason 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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityRequest.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..b47c0b0d7f75c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityRequest.java @@ -0,0 +1,78 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A request to check whether the specified name for a resource is available. + */ +public class CheckNameAvailabilityRequest { + /** + * The name whose availability is to be checked. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The type of resource that is used as the scope of the availability + * check. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Creates an instance of CheckNameAvailabilityRequest class. + * @param name the name whose availability is to be checked. + */ + public CheckNameAvailabilityRequest() { + type = "Microsoft.Sql/servers"; + } + + /** + * Get the name whose availability is to be checked. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name whose availability is to be checked. + * + * @param name the name value to set + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type of resource that is used as the scope of the availability check. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of resource that is used as the scope of the availability check. + * + * @param type the type value to set + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityResponse.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityResponse.java new file mode 100644 index 0000000000000..46f0b0f742334 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CheckNameAvailabilityResponse.java @@ -0,0 +1,40 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.CheckNameAvailabilityResponseInner; + +/** + * Type representing CheckNameAvailabilityResponse. + */ +public interface CheckNameAvailabilityResponse extends HasInner, HasManager { + /** + * @return the available value. + */ + Boolean available(); + + /** + * @return the message value. + */ + String message(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CreateMode.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CreateMode.java new file mode 100644 index 0000000000000..3228ed0aeb77e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/CreateMode.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CreateMode. + */ +public final class CreateMode extends ExpandableStringEnum { + /** Static value Copy for CreateMode. */ + public static final CreateMode COPY = fromString("Copy"); + + /** Static value Default for CreateMode. */ + public static final CreateMode DEFAULT = fromString("Default"); + + /** Static value NonReadableSecondary for CreateMode. */ + public static final CreateMode NON_READABLE_SECONDARY = fromString("NonReadableSecondary"); + + /** Static value OnlineSecondary for CreateMode. */ + public static final CreateMode ONLINE_SECONDARY = fromString("OnlineSecondary"); + + /** Static value PointInTimeRestore for CreateMode. */ + public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** Static value Recovery for CreateMode. */ + public static final CreateMode RECOVERY = fromString("Recovery"); + + /** Static value Restore for CreateMode. */ + public static final CreateMode RESTORE = fromString("Restore"); + + /** Static value RestoreLongTermRetentionBackup for CreateMode. */ + public static final CreateMode RESTORE_LONG_TERM_RETENTION_BACKUP = fromString("RestoreLongTermRetentionBackup"); + + /** + * Creates or finds a CreateMode from its string representation. + * @param name a name to look for + * @return the corresponding CreateMode + */ + @JsonCreator + public static CreateMode fromString(String name) { + return fromString(name, CreateMode.class); + } + + /** + * @return known CreateMode values + */ + public static Collection values() { + return values(CreateMode.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Database.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Database.java new file mode 100644 index 0000000000000..cbc104d416e0d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Database.java @@ -0,0 +1,546 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabaseInner; +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.v2014_04_01.implementation.SqlManager; +import java.util.Map; +import org.joda.time.DateTime; +import java.util.UUID; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServiceTierAdvisorInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.TransparentDataEncryptionInner; + +/** + * Type representing Database. + */ +public interface Database extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the collation value. + */ + String collation(); + + /** + * @return the containmentState value. + */ + Long containmentState(); + + /** + * @return the createMode value. + */ + CreateMode createMode(); + + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the currentServiceObjectiveId value. + */ + UUID currentServiceObjectiveId(); + + /** + * @return the databaseId value. + */ + UUID databaseId(); + + /** + * @return the defaultSecondaryLocation value. + */ + String defaultSecondaryLocation(); + + /** + * @return the earliestRestoreDate value. + */ + DateTime earliestRestoreDate(); + + /** + * @return the edition value. + */ + DatabaseEdition edition(); + + /** + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * @return the failoverGroupId value. + */ + String failoverGroupId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the maxSizeBytes value. + */ + String maxSizeBytes(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the readScale value. + */ + ReadScale readScale(); + + /** + * @return the recommendedIndex value. + */ + List recommendedIndex(); + + /** + * @return the recoveryServicesRecoveryPointResourceId value. + */ + String recoveryServicesRecoveryPointResourceId(); + + /** + * @return the requestedServiceObjectiveId value. + */ + UUID requestedServiceObjectiveId(); + + /** + * @return the requestedServiceObjectiveName value. + */ + ServiceObjectiveName requestedServiceObjectiveName(); + + /** + * @return the restorePointInTime value. + */ + DateTime restorePointInTime(); + + /** + * @return the sampleName value. + */ + SampleName sampleName(); + + /** + * @return the serviceLevelObjective value. + */ + ServiceObjectiveName serviceLevelObjective(); + + /** + * @return the serviceTierAdvisors value. + */ + List serviceTierAdvisors(); + + /** + * @return the sourceDatabaseDeletionDate value. + */ + DateTime sourceDatabaseDeletionDate(); + + /** + * @return the sourceDatabaseId value. + */ + String sourceDatabaseId(); + + /** + * @return the status value. + */ + String status(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the transparentDataEncryption value. + */ + List transparentDataEncryption(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * The entirety of the Database definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of Database definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Database definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the database definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithLocation withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the database definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the database definition allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + WithCreate withCollation(String collation); + } + + /** + * The stage of the database definition allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + WithCreate withCreateMode(CreateMode createMode); + } + + /** + * The stage of the database definition allowing to specify Edition. + */ + interface WithEdition { + /** + * Specifies edition. + */ + WithCreate withEdition(DatabaseEdition edition); + } + + /** + * The stage of the database definition allowing to specify ElasticPoolName. + */ + interface WithElasticPoolName { + /** + * Specifies elasticPoolName. + */ + WithCreate withElasticPoolName(String elasticPoolName); + } + + /** + * The stage of the database definition allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + WithCreate withMaxSizeBytes(String maxSizeBytes); + } + + /** + * The stage of the database definition allowing to specify ReadScale. + */ + interface WithReadScale { + /** + * Specifies readScale. + */ + WithCreate withReadScale(ReadScale readScale); + } + + /** + * The stage of the database definition allowing to specify RecoveryServicesRecoveryPointResourceId. + */ + interface WithRecoveryServicesRecoveryPointResourceId { + /** + * Specifies recoveryServicesRecoveryPointResourceId. + */ + WithCreate withRecoveryServicesRecoveryPointResourceId(String recoveryServicesRecoveryPointResourceId); + } + + /** + * The stage of the database definition allowing to specify RequestedServiceObjectiveId. + */ + interface WithRequestedServiceObjectiveId { + /** + * Specifies requestedServiceObjectiveId. + */ + WithCreate withRequestedServiceObjectiveId(UUID requestedServiceObjectiveId); + } + + /** + * The stage of the database definition allowing to specify RequestedServiceObjectiveName. + */ + interface WithRequestedServiceObjectiveName { + /** + * Specifies requestedServiceObjectiveName. + */ + WithCreate withRequestedServiceObjectiveName(ServiceObjectiveName requestedServiceObjectiveName); + } + + /** + * The stage of the database definition allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + WithCreate withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the database definition allowing to specify SampleName. + */ + interface WithSampleName { + /** + * Specifies sampleName. + */ + WithCreate withSampleName(SampleName sampleName); + } + + /** + * The stage of the database definition allowing to specify SourceDatabaseDeletionDate. + */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies sourceDatabaseDeletionDate. + */ + WithCreate withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate); + } + + /** + * The stage of the database definition allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + WithCreate withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the database definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the database definition allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + + /** + * 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.WithCollation, DefinitionStages.WithCreateMode, DefinitionStages.WithEdition, DefinitionStages.WithElasticPoolName, DefinitionStages.WithMaxSizeBytes, DefinitionStages.WithReadScale, DefinitionStages.WithRecoveryServicesRecoveryPointResourceId, DefinitionStages.WithRequestedServiceObjectiveId, DefinitionStages.WithRequestedServiceObjectiveName, DefinitionStages.WithRestorePointInTime, DefinitionStages.WithSampleName, DefinitionStages.WithSourceDatabaseDeletionDate, DefinitionStages.WithSourceDatabaseId, DefinitionStages.WithTags, DefinitionStages.WithZoneRedundant { + } + } + /** + * The template for a Database update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCollation, UpdateStages.WithCreateMode, UpdateStages.WithEdition, UpdateStages.WithElasticPoolName, UpdateStages.WithMaxSizeBytes, UpdateStages.WithReadScale, UpdateStages.WithRecoveryServicesRecoveryPointResourceId, UpdateStages.WithRequestedServiceObjectiveId, UpdateStages.WithRequestedServiceObjectiveName, UpdateStages.WithRestorePointInTime, UpdateStages.WithSampleName, UpdateStages.WithSourceDatabaseDeletionDate, UpdateStages.WithSourceDatabaseId, UpdateStages.WithTags, UpdateStages.WithZoneRedundant { + } + + /** + * Grouping of Database update stages. + */ + interface UpdateStages { + /** + * The stage of the database update allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + Update withCollation(String collation); + } + + /** + * The stage of the database update allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + Update withCreateMode(CreateMode createMode); + } + + /** + * The stage of the database update allowing to specify Edition. + */ + interface WithEdition { + /** + * Specifies edition. + */ + Update withEdition(DatabaseEdition edition); + } + + /** + * The stage of the database update allowing to specify ElasticPoolName. + */ + interface WithElasticPoolName { + /** + * Specifies elasticPoolName. + */ + Update withElasticPoolName(String elasticPoolName); + } + + /** + * The stage of the database update allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + Update withMaxSizeBytes(String maxSizeBytes); + } + + /** + * The stage of the database update allowing to specify ReadScale. + */ + interface WithReadScale { + /** + * Specifies readScale. + */ + Update withReadScale(ReadScale readScale); + } + + /** + * The stage of the database update allowing to specify RecoveryServicesRecoveryPointResourceId. + */ + interface WithRecoveryServicesRecoveryPointResourceId { + /** + * Specifies recoveryServicesRecoveryPointResourceId. + */ + Update withRecoveryServicesRecoveryPointResourceId(String recoveryServicesRecoveryPointResourceId); + } + + /** + * The stage of the database update allowing to specify RequestedServiceObjectiveId. + */ + interface WithRequestedServiceObjectiveId { + /** + * Specifies requestedServiceObjectiveId. + */ + Update withRequestedServiceObjectiveId(UUID requestedServiceObjectiveId); + } + + /** + * The stage of the database update allowing to specify RequestedServiceObjectiveName. + */ + interface WithRequestedServiceObjectiveName { + /** + * Specifies requestedServiceObjectiveName. + */ + Update withRequestedServiceObjectiveName(ServiceObjectiveName requestedServiceObjectiveName); + } + + /** + * The stage of the database update allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + Update withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the database update allowing to specify SampleName. + */ + interface WithSampleName { + /** + * Specifies sampleName. + */ + Update withSampleName(SampleName sampleName); + } + + /** + * The stage of the database update allowing to specify SourceDatabaseDeletionDate. + */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies sourceDatabaseDeletionDate. + */ + Update withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate); + } + + /** + * The stage of the database update allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + Update withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the database update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + /** + * The stage of the database update allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseEdition.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseEdition.java new file mode 100644 index 0000000000000..63a8ddfef7e6c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseEdition.java @@ -0,0 +1,68 @@ +/** + * 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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseEdition. + */ +public final class DatabaseEdition extends ExpandableStringEnum { + /** Static value Web for DatabaseEdition. */ + public static final DatabaseEdition WEB = fromString("Web"); + + /** Static value Business for DatabaseEdition. */ + public static final DatabaseEdition BUSINESS = fromString("Business"); + + /** Static value Basic for DatabaseEdition. */ + public static final DatabaseEdition BASIC = fromString("Basic"); + + /** Static value Standard for DatabaseEdition. */ + public static final DatabaseEdition STANDARD = fromString("Standard"); + + /** Static value Premium for DatabaseEdition. */ + public static final DatabaseEdition PREMIUM = fromString("Premium"); + + /** Static value PremiumRS for DatabaseEdition. */ + public static final DatabaseEdition PREMIUM_RS = fromString("PremiumRS"); + + /** Static value Free for DatabaseEdition. */ + public static final DatabaseEdition FREE = fromString("Free"); + + /** Static value Stretch for DatabaseEdition. */ + public static final DatabaseEdition STRETCH = fromString("Stretch"); + + /** Static value DataWarehouse for DatabaseEdition. */ + public static final DatabaseEdition DATA_WAREHOUSE = fromString("DataWarehouse"); + + /** Static value System for DatabaseEdition. */ + public static final DatabaseEdition SYSTEM = fromString("System"); + + /** Static value System2 for DatabaseEdition. */ + public static final DatabaseEdition SYSTEM2 = fromString("System2"); + + /** + * Creates or finds a DatabaseEdition from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseEdition + */ + @JsonCreator + public static DatabaseEdition fromString(String name) { + return fromString(name, DatabaseEdition.class); + } + + /** + * @return known DatabaseEdition values + */ + public static Collection values() { + return values(DatabaseEdition.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseSecurityAlertPolicy.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseSecurityAlertPolicy.java new file mode 100644 index 0000000000000..219419e26a666 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseSecurityAlertPolicy.java @@ -0,0 +1,305 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabaseSecurityAlertPolicyInner; +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.v2014_04_01.implementation.SqlManager; + +/** + * Type representing DatabaseSecurityAlertPolicy. + */ +public interface DatabaseSecurityAlertPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the disabledAlerts value. + */ + String disabledAlerts(); + + /** + * @return the emailAccountAdmins value. + */ + SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins(); + + /** + * @return the emailAddresses value. + */ + String emailAddresses(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @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(); + + /** + * @return the useServerDefault value. + */ + SecurityAlertPolicyUseServerDefault useServerDefault(); + + /** + * The entirety of the DatabaseSecurityAlertPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithState, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseSecurityAlertPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseSecurityAlertPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithState withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify State. + */ + interface WithState { + /** + * Specifies state. + */ + WithCreate withState(SecurityAlertPolicyState state); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + WithCreate withDisabledAlerts(String disabledAlerts); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + WithCreate withEmailAccountAdmins(SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + WithCreate withEmailAddresses(String emailAddresses); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + + /** + * The stage of the databasesecurityalertpolicy definition allowing to specify UseServerDefault. + */ + interface WithUseServerDefault { + /** + * Specifies useServerDefault. + */ + WithCreate withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault); + } + + /** + * 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.WithLocation, DefinitionStages.WithRetentionDays, DefinitionStages.WithStorageAccountAccessKey, DefinitionStages.WithStorageEndpoint, DefinitionStages.WithUseServerDefault { + } + } + /** + * The template for a DatabaseSecurityAlertPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDisabledAlerts, UpdateStages.WithEmailAccountAdmins, UpdateStages.WithEmailAddresses, UpdateStages.WithLocation, UpdateStages.WithRetentionDays, UpdateStages.WithStorageAccountAccessKey, UpdateStages.WithStorageEndpoint, UpdateStages.WithUseServerDefault { + } + + /** + * Grouping of DatabaseSecurityAlertPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the databasesecurityalertpolicy update allowing to specify DisabledAlerts. + */ + interface WithDisabledAlerts { + /** + * Specifies disabledAlerts. + */ + Update withDisabledAlerts(String disabledAlerts); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify EmailAccountAdmins. + */ + interface WithEmailAccountAdmins { + /** + * Specifies emailAccountAdmins. + */ + Update withEmailAccountAdmins(SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify EmailAddresses. + */ + interface WithEmailAddresses { + /** + * Specifies emailAddresses. + */ + Update withEmailAddresses(String emailAddresses); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + Update withLocation(String location); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify RetentionDays. + */ + interface WithRetentionDays { + /** + * Specifies retentionDays. + */ + Update withRetentionDays(Integer retentionDays); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify StorageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies storageAccountAccessKey. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify StorageEndpoint. + */ + interface WithStorageEndpoint { + /** + * Specifies storageEndpoint. + */ + Update withStorageEndpoint(String storageEndpoint); + } + + /** + * The stage of the databasesecurityalertpolicy update allowing to specify UseServerDefault. + */ + interface WithUseServerDefault { + /** + * Specifies useServerDefault. + */ + Update withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseThreatDetectionPolicies.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseThreatDetectionPolicies.java new file mode 100644 index 0000000000000..a1094193ed710 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseThreatDetectionPolicies.java @@ -0,0 +1,31 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabaseThreatDetectionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseThreatDetectionPolicies. + */ +public interface DatabaseThreatDetectionPolicies extends SupportsCreating, HasInner { + /** + * Gets a database'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 serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUpdate.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUpdate.java new file mode 100644 index 0000000000000..2600459243381 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/DatabaseUpdate.java @@ -0,0 +1,726 @@ +/** + * 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.v2014_04_01; + +import java.util.Map; +import org.joda.time.DateTime; +import java.util.UUID; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServiceTierAdvisorInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.TransparentDataEncryptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database update. + */ +@JsonFlatten +public class DatabaseUpdate extends ProxyResource { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The collation of the database. If createMode is not Default, this value + * is ignored. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The containment state of the database. + */ + @JsonProperty(value = "properties.containmentState", access = JsonProperty.Access.WRITE_ONLY) + private Long containmentState; + + /** + * The current service level objective ID of the database. This is the ID + * of the service level objective that is currently active. + */ + @JsonProperty(value = "properties.currentServiceObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID currentServiceObjectiveId; + + /** + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /** + * This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * OnlineSecondary/NonReadableSecondary: creates a database as a (readable + * or nonreadable) secondary replica of an existing database. + * sourceDatabaseId must be specified as the resource ID of the existing + * primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, NonReadableSecondary, OnlineSecondary and + * RestoreLongTermRetentionBackup are not supported for DataWarehouse + * edition. Possible values include: 'Copy', 'Default', + * 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', + * 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup'. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /** + * Conditional. If createMode is Copy, NonReadableSecondary, + * OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this + * value is required. Specifies the resource ID of the source database. If + * createMode is NonReadableSecondary or OnlineSecondary, the name of the + * source database must be the same as the new database being created. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * Conditional. If createMode is Restore and sourceDatabaseId is the + * deleted database's original resource id when it existed (as opposed to + * its current restorable dropped database id), then this value is + * required. Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private DateTime sourceDatabaseDeletionDate; + + /** + * Conditional. If createMode is PointInTimeRestore, this value is + * required. If createMode is Restore, this value is optional. Specifies + * the point in time (ISO8601 format) of the source database that will be + * restored to create the new database. Must be greater than or equal to + * the source database's earliestRestoreDate value. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Conditional. If createMode is RestoreLongTermRetentionBackup, then this + * value is required. Specifies the resource ID of the recovery point to + * restore from. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointResourceId") + private String recoveryServicesRecoveryPointResourceId; + + /** + * The edition of the database. The DatabaseEditions enumeration contains + * all the valid editions. If createMode is NonReadableSecondary or + * OnlineSecondary, this value is ignored. To see possible values, query + * the capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation." or use the + * Azure CLI command `az sql db list-editions -l westus --query [].name`. + * Possible values include: 'Web', 'Business', 'Basic', 'Standard', + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2'. + */ + @JsonProperty(value = "properties.edition") + private DatabaseEdition edition; + + /** + * The max size of the database expressed in bytes. If createMode is not + * Default, this value is ignored. To see possible values, query the + * capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation.". + */ + @JsonProperty(value = "properties.maxSizeBytes") + private String maxSizeBytes; + + /** + * The configured service level objective ID of the database. This is the + * service level objective that is in the process of being applied to the + * database. Once successfully updated, it will match the value of + * currentServiceObjectiveId property. If requestedServiceObjectiveId and + * requestedServiceObjectiveName are both updated, the value of + * requestedServiceObjectiveId overrides the value of + * requestedServiceObjectiveName. To see possible values, query the + * capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation." or use the + * Azure CLI command `az sql db list-editions --location <location> + * --query [].supportedServiceLevelObjectives[].name` . + */ + @JsonProperty(value = "properties.requestedServiceObjectiveId") + private UUID requestedServiceObjectiveId; + + /** + * The name of the configured service level objective of the database. This + * is the service level objective that is in the process of being applied + * to the database. Once successfully updated, it will match the value of + * serviceLevelObjective property. To see possible values, query the + * capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation." or use the + * Azure CLI command `az sql db list-editions --location <location> + * --query [].supportedServiceLevelObjectives[].name`. Possible values + * include: 'System', 'System0', 'System1', 'System2', 'System3', + * 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', + * 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', + * 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', + * 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', + * 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', + * 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', + * 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', + * 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "properties.requestedServiceObjectiveName") + private ServiceObjectiveName requestedServiceObjectiveName; + + /** + * The current service level objective of the database. Possible values + * include: 'System', 'System0', 'System1', 'System2', 'System3', + * 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', + * 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', + * 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', + * 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', + * 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', + * 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', + * 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', + * 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "properties.serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private ServiceObjectiveName serviceLevelObjective; + + /** + * The status of the database. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The name of the elastic pool the database is in. If elasticPoolName and + * requestedServiceObjectiveName are both updated, the value of + * requestedServiceObjectiveName is ignored. Not supported for + * DataWarehouse edition. + */ + @JsonProperty(value = "properties.elasticPoolName") + private String elasticPoolName; + + /** + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * The list of service tier advisors for this database. Expanded property. + */ + @JsonProperty(value = "properties.serviceTierAdvisors", access = JsonProperty.Access.WRITE_ONLY) + private List serviceTierAdvisors; + + /** + * The transparent data encryption info for this database. + */ + @JsonProperty(value = "properties.transparentDataEncryption", access = JsonProperty.Access.WRITE_ONLY) + private List transparentDataEncryption; + + /** + * The recommended indices for this database. + */ + @JsonProperty(value = "properties.recommendedIndex", access = JsonProperty.Access.WRITE_ONLY) + private List recommendedIndex; + + /** + * The resource identifier of the failover group containing this database. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * Conditional. If the database is a geo-secondary, readScale indicates + * whether read-only connections are allowed to this database or not. Not + * supported for DataWarehouse edition. Possible values include: 'Enabled', + * 'Disabled'. + */ + @JsonProperty(value = "properties.readScale") + private ReadScale readScale; + + /** + * Indicates the name of the sample schema to apply when creating this + * database. If createMode is not Default, this value is ignored. Not + * supported for DataWarehouse edition. Possible values include: + * 'AdventureWorksLT'. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /** + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the collation of the database. If createMode is not Default, this value is ignored. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation of the database. If createMode is not Default, this value is ignored. + * + * @param collation the collation value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the containment state of the database. + * + * @return the containmentState value + */ + public Long containmentState() { + return this.containmentState; + } + + /** + * Get the current service level objective ID of the database. This is the ID of the service level objective that is currently active. + * + * @return the currentServiceObjectiveId value + */ + public UUID currentServiceObjectiveId() { + return this.currentServiceObjectiveId; + } + + /** + * Get the ID of the database. + * + * @return the databaseId value + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get this records the earliest start date and time that restore is available for this database (ISO8601 format). + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + OnlineSecondary/NonReadableSecondary: creates a database as a (readable or nonreadable) secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, NonReadableSecondary, OnlineSecondary and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Copy', 'Default', 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup'. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + OnlineSecondary/NonReadableSecondary: creates a database as a (readable or nonreadable) secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, NonReadableSecondary, OnlineSecondary and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Copy', 'Default', 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup'. + * + * @param createMode the createMode value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get conditional. If createMode is Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this value is required. Specifies the resource ID of the source database. If createMode is NonReadableSecondary or OnlineSecondary, the name of the source database must be the same as the new database being created. + * + * @return the sourceDatabaseId value + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set conditional. If createMode is Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this value is required. Specifies the resource ID of the source database. If createMode is NonReadableSecondary or OnlineSecondary, the name of the source database must be the same as the new database being created. + * + * @param sourceDatabaseId the sourceDatabaseId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get conditional. If createMode is Restore and sourceDatabaseId is the deleted database's original resource id when it existed (as opposed to its current restorable dropped database id), then this value is required. Specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value + */ + public DateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set conditional. If createMode is Restore and sourceDatabaseId is the deleted database's original resource id when it existed (as opposed to its current restorable dropped database id), then this value is required. Specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get conditional. If createMode is PointInTimeRestore, this value is required. If createMode is Restore, this value is optional. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. Must be greater than or equal to the source database's earliestRestoreDate value. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set conditional. If createMode is PointInTimeRestore, this value is required. If createMode is Restore, this value is optional. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. Must be greater than or equal to the source database's earliestRestoreDate value. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. + * + * @return the recoveryServicesRecoveryPointResourceId value + */ + public String recoveryServicesRecoveryPointResourceId() { + return this.recoveryServicesRecoveryPointResourceId; + } + + /** + * Set conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. + * + * @param recoveryServicesRecoveryPointResourceId the recoveryServicesRecoveryPointResourceId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRecoveryServicesRecoveryPointResourceId(String recoveryServicesRecoveryPointResourceId) { + this.recoveryServicesRecoveryPointResourceId = recoveryServicesRecoveryPointResourceId; + return this; + } + + /** + * Get the edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions -l westus --query [].name`. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * + * @return the edition value + */ + public DatabaseEdition edition() { + return this.edition; + } + + /** + * Set the edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions -l westus --query [].name`. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * + * @param edition the edition value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withEdition(DatabaseEdition edition) { + this.edition = edition; + return this; + } + + /** + * Get the max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation.". + * + * @return the maxSizeBytes value + */ + public String maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation.". + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withMaxSizeBytes(String maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name` . + * + * @return the requestedServiceObjectiveId value + */ + public UUID requestedServiceObjectiveId() { + return this.requestedServiceObjectiveId; + } + + /** + * Set the configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name` . + * + * @param requestedServiceObjectiveId the requestedServiceObjectiveId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRequestedServiceObjectiveId(UUID requestedServiceObjectiveId) { + this.requestedServiceObjectiveId = requestedServiceObjectiveId; + return this; + } + + /** + * Get the name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name`. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @return the requestedServiceObjectiveName value + */ + public ServiceObjectiveName requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Set the name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name`. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @param requestedServiceObjectiveName the requestedServiceObjectiveName value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRequestedServiceObjectiveName(ServiceObjectiveName requestedServiceObjectiveName) { + this.requestedServiceObjectiveName = requestedServiceObjectiveName; + return this; + } + + /** + * Get the current service level objective of the database. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @return the serviceLevelObjective value + */ + public ServiceObjectiveName serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the status of the database. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Set the name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. + * + * @param elasticPoolName the elasticPoolName value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withElasticPoolName(String elasticPoolName) { + this.elasticPoolName = elasticPoolName; + return this; + } + + /** + * Get the default secondary region for this database. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the list of service tier advisors for this database. Expanded property. + * + * @return the serviceTierAdvisors value + */ + public List serviceTierAdvisors() { + return this.serviceTierAdvisors; + } + + /** + * Get the transparent data encryption info for this database. + * + * @return the transparentDataEncryption value + */ + public List transparentDataEncryption() { + return this.transparentDataEncryption; + } + + /** + * Get the recommended indices for this database. + * + * @return the recommendedIndex value + */ + public List recommendedIndex() { + return this.recommendedIndex; + } + + /** + * Get the resource identifier of the failover group containing this database. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. Possible values include: 'Enabled', 'Disabled'. + * + * @return the readScale value + */ + public ReadScale readScale() { + return this.readScale; + } + + /** + * Set conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. Possible values include: 'Enabled', 'Disabled'. + * + * @param readScale the readScale value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withReadScale(ReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get indicates the name of the sample schema to apply when creating this database. If createMode is not Default, this value is ignored. Not supported for DataWarehouse edition. Possible values include: 'AdventureWorksLT'. + * + * @return the sampleName value + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set indicates the name of the sample schema to apply when creating this database. If createMode is not Default, this value is ignored. Not supported for DataWarehouse edition. Possible values include: 'AdventureWorksLT'. + * + * @param sampleName the sampleName value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.java new file mode 100644 index 0000000000000..422206f42f8e1 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Databases.java @@ -0,0 +1,151 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.DatabasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Databases. + */ +public interface Databases extends SupportsCreating, HasInner { + /** + * Begins definition for a new Extension resource. + * @param name resource name. + * @return the first stage of the new Extension definition. + */ + ImportExportResponse.DefinitionStages.Blank defineExtension(String name); + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable pauseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable resumeAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database inside of an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, String databaseName); + + /** + * Returns a list of databases in an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Gets a database inside of a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName); + + /** + * Returns a list of databases inside a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName); + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 to be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters); + + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the database to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Returns a list of databases in a 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(String resourceGroupName, String serverName); + + /** + * Deletes 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 serverName The name of the server. + * @param databaseName The name of the database to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPool.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPool.java new file mode 100644 index 0000000000000..3d1ce6a7f16dd --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPool.java @@ -0,0 +1,292 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ElasticPoolInner; +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.v2014_04_01.implementation.SqlManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ElasticPool. + */ +public interface ElasticPool extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the databaseDtuMax value. + */ + Integer databaseDtuMax(); + + /** + * @return the databaseDtuMin value. + */ + Integer databaseDtuMin(); + + /** + * @return the dtu value. + */ + Integer dtu(); + + /** + * @return the edition value. + */ + ElasticPoolEdition edition(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the state value. + */ + ElasticPoolState state(); + + /** + * @return the storageMB value. + */ + Integer storageMB(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * The entirety of the ElasticPool definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of ElasticPool definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ElasticPool definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the elasticpool definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithLocation withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the elasticpool definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the elasticpool definition allowing to specify DatabaseDtuMax. + */ + interface WithDatabaseDtuMax { + /** + * Specifies databaseDtuMax. + */ + WithCreate withDatabaseDtuMax(Integer databaseDtuMax); + } + + /** + * The stage of the elasticpool definition allowing to specify DatabaseDtuMin. + */ + interface WithDatabaseDtuMin { + /** + * Specifies databaseDtuMin. + */ + WithCreate withDatabaseDtuMin(Integer databaseDtuMin); + } + + /** + * The stage of the elasticpool definition allowing to specify Dtu. + */ + interface WithDtu { + /** + * Specifies dtu. + */ + WithCreate withDtu(Integer dtu); + } + + /** + * The stage of the elasticpool definition allowing to specify Edition. + */ + interface WithEdition { + /** + * Specifies edition. + */ + WithCreate withEdition(ElasticPoolEdition edition); + } + + /** + * The stage of the elasticpool definition allowing to specify StorageMB. + */ + interface WithStorageMB { + /** + * Specifies storageMB. + */ + WithCreate withStorageMB(Integer storageMB); + } + + /** + * The stage of the elasticpool definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the elasticpool definition allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + + /** + * 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.WithDatabaseDtuMax, DefinitionStages.WithDatabaseDtuMin, DefinitionStages.WithDtu, DefinitionStages.WithEdition, DefinitionStages.WithStorageMB, DefinitionStages.WithTags, DefinitionStages.WithZoneRedundant { + } + } + /** + * The template for a ElasticPool update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDatabaseDtuMax, UpdateStages.WithDatabaseDtuMin, UpdateStages.WithDtu, UpdateStages.WithEdition, UpdateStages.WithStorageMB, UpdateStages.WithTags, UpdateStages.WithZoneRedundant { + } + + /** + * Grouping of ElasticPool update stages. + */ + interface UpdateStages { + /** + * The stage of the elasticpool update allowing to specify DatabaseDtuMax. + */ + interface WithDatabaseDtuMax { + /** + * Specifies databaseDtuMax. + */ + Update withDatabaseDtuMax(Integer databaseDtuMax); + } + + /** + * The stage of the elasticpool update allowing to specify DatabaseDtuMin. + */ + interface WithDatabaseDtuMin { + /** + * Specifies databaseDtuMin. + */ + Update withDatabaseDtuMin(Integer databaseDtuMin); + } + + /** + * The stage of the elasticpool update allowing to specify Dtu. + */ + interface WithDtu { + /** + * Specifies dtu. + */ + Update withDtu(Integer dtu); + } + + /** + * The stage of the elasticpool update allowing to specify Edition. + */ + interface WithEdition { + /** + * Specifies edition. + */ + Update withEdition(ElasticPoolEdition edition); + } + + /** + * The stage of the elasticpool update allowing to specify StorageMB. + */ + interface WithStorageMB { + /** + * Specifies storageMB. + */ + Update withStorageMB(Integer storageMB); + } + + /** + * The stage of the elasticpool update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + /** + * The stage of the elasticpool update allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolActivities.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolActivities.java new file mode 100644 index 0000000000000..28970d3a05d32 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolActivities.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ElasticPoolActivitiesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElasticPoolActivities. + */ +public interface ElasticPoolActivities extends HasInner { + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool for which to get the current activity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolActivity.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolActivity.java new file mode 100644 index 0000000000000..310b97986c586 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolActivity.java @@ -0,0 +1,142 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ElasticPoolActivityInner; +import org.joda.time.DateTime; +import java.util.UUID; + +/** + * Type representing ElasticPoolActivity. + */ +public interface ElasticPoolActivity extends HasInner, HasManager { + /** + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the operationId value. + */ + UUID operationId(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the requestedDatabaseDtuCap value. + */ + Integer requestedDatabaseDtuCap(); + + /** + * @return the requestedDatabaseDtuGuarantee value. + */ + Integer requestedDatabaseDtuGuarantee(); + + /** + * @return the requestedDatabaseDtuMax value. + */ + Integer requestedDatabaseDtuMax(); + + /** + * @return the requestedDatabaseDtuMin value. + */ + Integer requestedDatabaseDtuMin(); + + /** + * @return the requestedDtu value. + */ + Integer requestedDtu(); + + /** + * @return the requestedDtuGuarantee value. + */ + Integer requestedDtuGuarantee(); + + /** + * @return the requestedElasticPoolName value. + */ + String requestedElasticPoolName(); + + /** + * @return the requestedStorageLimitInGB value. + */ + Long requestedStorageLimitInGB(); + + /** + * @return the requestedStorageLimitInMB value. + */ + Integer requestedStorageLimitInMB(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDatabaseActivities.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDatabaseActivities.java new file mode 100644 index 0000000000000..8ddbf8097bcd3 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDatabaseActivities.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ElasticPoolDatabaseActivitiesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElasticPoolDatabaseActivities. + */ +public interface ElasticPoolDatabaseActivities extends HasInner { + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDatabaseActivity.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDatabaseActivity.java new file mode 100644 index 0000000000000..e5d68d036bc0a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolDatabaseActivity.java @@ -0,0 +1,117 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ElasticPoolDatabaseActivityInner; +import org.joda.time.DateTime; +import java.util.UUID; + +/** + * Type representing ElasticPoolDatabaseActivity. + */ +public interface ElasticPoolDatabaseActivity extends HasInner, HasManager { + /** + * @return the currentElasticPoolName value. + */ + String currentElasticPoolName(); + + /** + * @return the currentServiceObjective value. + */ + String currentServiceObjective(); + + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the operationId value. + */ + UUID operationId(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the requestedElasticPoolName value. + */ + String requestedElasticPoolName(); + + /** + * @return the requestedServiceObjective value. + */ + String requestedServiceObjective(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEdition.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEdition.java new file mode 100644 index 0000000000000..842f33fc97867 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolEdition.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ElasticPoolEdition. + */ +public final class ElasticPoolEdition extends ExpandableStringEnum { + /** Static value Basic for ElasticPoolEdition. */ + public static final ElasticPoolEdition BASIC = fromString("Basic"); + + /** Static value Standard for ElasticPoolEdition. */ + public static final ElasticPoolEdition STANDARD = fromString("Standard"); + + /** Static value Premium for ElasticPoolEdition. */ + public static final ElasticPoolEdition PREMIUM = fromString("Premium"); + + /** + * Creates or finds a ElasticPoolEdition from its string representation. + * @param name a name to look for + * @return the corresponding ElasticPoolEdition + */ + @JsonCreator + public static ElasticPoolEdition fromString(String name) { + return fromString(name, ElasticPoolEdition.class); + } + + /** + * @return known ElasticPoolEdition values + */ + public static Collection values() { + return values(ElasticPoolEdition.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolState.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolState.java new file mode 100644 index 0000000000000..554a6fb93402e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolState.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ElasticPoolState. + */ +public final class ElasticPoolState extends ExpandableStringEnum { + /** Static value Creating for ElasticPoolState. */ + public static final ElasticPoolState CREATING = fromString("Creating"); + + /** Static value Ready for ElasticPoolState. */ + public static final ElasticPoolState READY = fromString("Ready"); + + /** Static value Disabled for ElasticPoolState. */ + public static final ElasticPoolState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a ElasticPoolState from its string representation. + * @param name a name to look for + * @return the corresponding ElasticPoolState + */ + @JsonCreator + public static ElasticPoolState fromString(String name) { + return fromString(name, ElasticPoolState.class); + } + + /** + * @return known ElasticPoolState values + */ + public static Collection values() { + return values(ElasticPoolState.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolUpdate.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolUpdate.java new file mode 100644 index 0000000000000..ecefd193f0ecc --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPoolUpdate.java @@ -0,0 +1,238 @@ +/** + * 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.v2014_04_01; + +import java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents an elastic pool update. + */ +@JsonFlatten +public class ElasticPoolUpdate extends ProxyResource { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The creation date of the elastic pool (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The state of the elastic pool. Possible values include: 'Creating', + * 'Ready', 'Disabled'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ElasticPoolState state; + + /** + * The edition of the elastic pool. Possible values include: 'Basic', + * 'Standard', 'Premium'. + */ + @JsonProperty(value = "properties.edition") + private ElasticPoolEdition edition; + + /** + * The total shared DTU for the database elastic pool. + */ + @JsonProperty(value = "properties.dtu") + private Integer dtu; + + /** + * The maximum DTU any one database can consume. + */ + @JsonProperty(value = "properties.databaseDtuMax") + private Integer databaseDtuMax; + + /** + * The minimum DTU all databases are guaranteed. + */ + @JsonProperty(value = "properties.databaseDtuMin") + private Integer databaseDtuMin; + + /** + * Gets storage limit for the database elastic pool in MB. + */ + @JsonProperty(value = "properties.storageMB") + private Integer storageMB; + + /** + * Whether or not this database elastic pool is zone redundant, which means + * the replicas of this database will be spread across multiple + * availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the creation date of the elastic pool (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the state of the elastic pool. Possible values include: 'Creating', 'Ready', 'Disabled'. + * + * @return the state value + */ + public ElasticPoolState state() { + return this.state; + } + + /** + * Get the edition of the elastic pool. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @return the edition value + */ + public ElasticPoolEdition edition() { + return this.edition; + } + + /** + * Set the edition of the elastic pool. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @param edition the edition value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withEdition(ElasticPoolEdition edition) { + this.edition = edition; + return this; + } + + /** + * Get the total shared DTU for the database elastic pool. + * + * @return the dtu value + */ + public Integer dtu() { + return this.dtu; + } + + /** + * Set the total shared DTU for the database elastic pool. + * + * @param dtu the dtu value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withDtu(Integer dtu) { + this.dtu = dtu; + return this; + } + + /** + * Get the maximum DTU any one database can consume. + * + * @return the databaseDtuMax value + */ + public Integer databaseDtuMax() { + return this.databaseDtuMax; + } + + /** + * Set the maximum DTU any one database can consume. + * + * @param databaseDtuMax the databaseDtuMax value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withDatabaseDtuMax(Integer databaseDtuMax) { + this.databaseDtuMax = databaseDtuMax; + return this; + } + + /** + * Get the minimum DTU all databases are guaranteed. + * + * @return the databaseDtuMin value + */ + public Integer databaseDtuMin() { + return this.databaseDtuMin; + } + + /** + * Set the minimum DTU all databases are guaranteed. + * + * @param databaseDtuMin the databaseDtuMin value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withDatabaseDtuMin(Integer databaseDtuMin) { + this.databaseDtuMin = databaseDtuMin; + return this; + } + + /** + * Get gets storage limit for the database elastic pool in MB. + * + * @return the storageMB value + */ + public Integer storageMB() { + return this.storageMB; + } + + /** + * Set gets storage limit for the database elastic pool in MB. + * + * @param storageMB the storageMB value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withStorageMB(Integer storageMB) { + this.storageMB = storageMB; + return this; + } + + /** + * Get whether or not this database elastic pool is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database elastic pool is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPools.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPools.java new file mode 100644 index 0000000000000..31fb76a3a1b0a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ElasticPools.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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ElasticPoolsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElasticPools. + */ +public interface ElasticPools extends SupportsCreating, HasInner { + /** + * Gets an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Returns a list of elastic pools in a 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByServerAsync(String resourceGroupName, String serverName); + + /** + * Deletes the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ExportRequest.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ExportRequest.java new file mode 100644 index 0000000000000..38754c437f199 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ExportRequest.java @@ -0,0 +1,175 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Export database parameters. + */ +public class ExportRequest { + /** + * The type of the storage key to use. Possible values include: + * 'StorageAccessKey', 'SharedAccessKey'. + */ + @JsonProperty(value = "storageKeyType", required = true) + private StorageKeyType storageKeyType; + + /** + * The storage key to use. If storage key type is SharedAccessKey, it must + * be preceded with a "?.". + */ + @JsonProperty(value = "storageKey", required = true) + private String storageKey; + + /** + * The storage uri to use. + */ + @JsonProperty(value = "storageUri", required = true) + private String storageUri; + + /** + * The name of the SQL administrator. + */ + @JsonProperty(value = "administratorLogin", required = true) + private String administratorLogin; + + /** + * The password of the SQL administrator. + */ + @JsonProperty(value = "administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /** + * The authentication type. Possible values include: 'SQL', 'ADPassword'. + */ + @JsonProperty(value = "authenticationType") + private AuthenticationType authenticationType; + + /** + * Get the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * + * @return the storageKeyType value + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * + * @param storageKeyType the storageKeyType value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * + * @return the storageKey value + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * + * @param storageKey the storageKey value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storage uri to use. + * + * @return the storageUri value + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storage uri to use. + * + * @param storageUri the storageUri value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get the name of the SQL administrator. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the name of the SQL administrator. + * + * @param administratorLogin the administratorLogin value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the password of the SQL administrator. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the password of the SQL administrator. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the authentication type. Possible values include: 'SQL', 'ADPassword'. + * + * @return the authenticationType value + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication type. Possible values include: 'SQL', 'ADPassword'. + * + * @param authenticationType the authenticationType value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/FirewallRule.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/FirewallRule.java new file mode 100644 index 0000000000000..113a3fd162b70 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/FirewallRule.java @@ -0,0 +1,125 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.FirewallRuleInner; +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.v2014_04_01.implementation.SqlManager; + +/** + * Type representing FirewallRule. + */ +public interface FirewallRule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the endIpAddress value. + */ + String endIpAddress(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the startIpAddress value. + */ + String startIpAddress(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the FirewallRule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithEndIpAddress, DefinitionStages.WithStartIpAddress, DefinitionStages.WithCreate { + } + + /** + * Grouping of FirewallRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a FirewallRule definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the firewallrule definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithEndIpAddress withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the firewallrule definition allowing to specify EndIpAddress. + */ + interface WithEndIpAddress { + /** + * Specifies endIpAddress. + */ + WithStartIpAddress withEndIpAddress(String endIpAddress); + } + + /** + * The stage of the firewallrule definition allowing to specify StartIpAddress. + */ + interface WithStartIpAddress { + /** + * Specifies startIpAddress. + */ + WithCreate withStartIpAddress(String startIpAddress); + } + + /** + * 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 FirewallRule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of FirewallRule update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/FirewallRules.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/FirewallRules.java new file mode 100644 index 0000000000000..2d064a5027ace --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/FirewallRules.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.v2014_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.FirewallRulesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing FirewallRules. + */ +public interface FirewallRules extends SupportsCreating, HasInner { + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String firewallRuleName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportExportResponse.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportExportResponse.java new file mode 100644 index 0000000000000..3bfb29fdd51d3 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportExportResponse.java @@ -0,0 +1,250 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ImportExportResponseInner; +import com.microsoft.azure.arm.model.Indexable; +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.v2014_04_01.implementation.SqlManager; +import java.util.UUID; + +/** + * Type representing ImportExportResponse. + */ +public interface ImportExportResponse extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the blobUri value. + */ + String blobUri(); + + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastModifiedTime value. + */ + String lastModifiedTime(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the queuedTime value. + */ + String queuedTime(); + + /** + * @return the requestId value. + */ + UUID requestId(); + + /** + * @return the requestType value. + */ + String requestType(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the status value. + */ + String status(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ImportExportResponse definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithAdministratorLogin, DefinitionStages.WithAdministratorLoginPassword, DefinitionStages.WithOperationMode, DefinitionStages.WithStorageKey, DefinitionStages.WithStorageKeyType, DefinitionStages.WithStorageUri, DefinitionStages.WithCreate { + } + + /** + * Grouping of ImportExportResponse definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ImportExportResponse definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the importexportresponse definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithAdministratorLogin withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the importexportresponse definition allowing to specify AdministratorLogin. + */ + interface WithAdministratorLogin { + /** + * Specifies administratorLogin. + */ + WithAdministratorLoginPassword withAdministratorLogin(String administratorLogin); + } + + /** + * The stage of the importexportresponse definition allowing to specify AdministratorLoginPassword. + */ + interface WithAdministratorLoginPassword { + /** + * Specifies administratorLoginPassword. + */ + WithOperationMode withAdministratorLoginPassword(String administratorLoginPassword); + } + + /** + * The stage of the importexportresponse definition allowing to specify OperationMode. + */ + interface WithOperationMode { + /** + * Specifies operationMode. + */ + WithStorageKey withOperationMode(String operationMode); + } + + /** + * The stage of the importexportresponse definition allowing to specify StorageKey. + */ + interface WithStorageKey { + /** + * Specifies storageKey. + */ + WithStorageKeyType withStorageKey(String storageKey); + } + + /** + * The stage of the importexportresponse definition allowing to specify StorageKeyType. + */ + interface WithStorageKeyType { + /** + * Specifies storageKeyType. + */ + WithStorageUri withStorageKeyType(StorageKeyType storageKeyType); + } + + /** + * The stage of the importexportresponse definition allowing to specify StorageUri. + */ + interface WithStorageUri { + /** + * Specifies storageUri. + */ + WithCreate withStorageUri(String storageUri); + } + + /** + * The stage of the importexportresponse definition allowing to specify AuthenticationType. + */ + interface WithAuthenticationType { + /** + * Specifies authenticationType. + */ + WithCreate withAuthenticationType(AuthenticationType authenticationType); + } + + /** + * The stage of the importexportresponse definition allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + */ + WithCreate withName(String name); + } + + /** + * The stage of the importexportresponse definition allowing to specify Type. + */ + interface WithType { + /** + * Specifies type. + */ + WithCreate withType(String type); + } + + /** + * 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.WithAuthenticationType, DefinitionStages.WithName, DefinitionStages.WithType { + } + } + /** + * The template for a ImportExportResponse update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuthenticationType, UpdateStages.WithName, UpdateStages.WithType { + } + + /** + * Grouping of ImportExportResponse update stages. + */ + interface UpdateStages { + /** + * The stage of the importexportresponse update allowing to specify AuthenticationType. + */ + interface WithAuthenticationType { + /** + * Specifies authenticationType. + */ + Update withAuthenticationType(AuthenticationType authenticationType); + } + + /** + * The stage of the importexportresponse update allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + */ + Update withName(String name); + } + + /** + * The stage of the importexportresponse update allowing to specify Type. + */ + interface WithType { + /** + * Specifies type. + */ + Update withType(String type); + } + + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportExtensionRequest.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportExtensionRequest.java new file mode 100644 index 0000000000000..c3b0b7d5a3bee --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportExtensionRequest.java @@ -0,0 +1,267 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Import database parameters. + */ +@JsonFlatten +public class ImportExtensionRequest { + /** + * The name of the extension. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The type of the extension. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The type of the storage key to use. Possible values include: + * 'StorageAccessKey', 'SharedAccessKey'. + */ + @JsonProperty(value = "properties.storageKeyType", required = true) + private StorageKeyType storageKeyType; + + /** + * The storage key to use. If storage key type is SharedAccessKey, it must + * be preceded with a "?.". + */ + @JsonProperty(value = "properties.storageKey", required = true) + private String storageKey; + + /** + * The storage uri to use. + */ + @JsonProperty(value = "properties.storageUri", required = true) + private String storageUri; + + /** + * The name of the SQL administrator. + */ + @JsonProperty(value = "properties.administratorLogin", required = true) + private String administratorLogin; + + /** + * The password of the SQL administrator. + */ + @JsonProperty(value = "properties.administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /** + * The authentication type. Possible values include: 'SQL', 'ADPassword'. + */ + @JsonProperty(value = "properties.authenticationType") + private AuthenticationType authenticationType; + + /** + * The type of import operation being performed. This is always Import. + */ + @JsonProperty(value = "properties.operationMode", required = true) + private String operationMode; + + /** + * Creates an instance of ImportExtensionRequest class. + * @param storageKeyType the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * @param storageKey the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * @param storageUri the storage uri to use. + * @param administratorLogin the name of the SQL administrator. + * @param administratorLoginPassword the password of the SQL administrator. + */ + public ImportExtensionRequest() { + operationMode = "Import"; + } + + /** + * Get the name of the extension. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the extension. + * + * @param name the name value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type of the extension. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of the extension. + * + * @param type the type value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Get the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * + * @return the storageKeyType value + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey'. + * + * @param storageKeyType the storageKeyType value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * + * @return the storageKey value + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?.". + * + * @param storageKey the storageKey value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storage uri to use. + * + * @return the storageUri value + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storage uri to use. + * + * @param storageUri the storageUri value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get the name of the SQL administrator. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the name of the SQL administrator. + * + * @param administratorLogin the administratorLogin value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the password of the SQL administrator. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the password of the SQL administrator. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the authentication type. Possible values include: 'SQL', 'ADPassword'. + * + * @return the authenticationType value + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication type. Possible values include: 'SQL', 'ADPassword'. + * + * @param authenticationType the authenticationType value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the type of import operation being performed. This is always Import. + * + * @return the operationMode value + */ + public String operationMode() { + return this.operationMode; + } + + /** + * Set the type of import operation being performed. This is always Import. + * + * @param operationMode the operationMode value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withOperationMode(String operationMode) { + this.operationMode = operationMode; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportRequest.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportRequest.java new file mode 100644 index 0000000000000..f947a3473e506 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ImportRequest.java @@ -0,0 +1,132 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Import database parameters. + */ +public class ImportRequest extends ExportRequest { + /** + * The name of the database to import. + */ + @JsonProperty(value = "databaseName", required = true) + private String databaseName; + + /** + * The edition for the database being created. Possible values include: + * 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', + * 'Stretch', 'DataWarehouse', 'System', 'System2'. + */ + @JsonProperty(value = "edition", required = true) + private DatabaseEdition edition; + + /** + * The name of the service objective to assign to the database. Possible + * values include: 'System', 'System0', 'System1', 'System2', 'System3', + * 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', + * 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', + * 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', + * 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', + * 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', + * 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', + * 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', + * 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "serviceObjectiveName", required = true) + private ServiceObjectiveName serviceObjectiveName; + + /** + * The maximum size for the newly imported database. + */ + @JsonProperty(value = "maxSizeBytes", required = true) + private String maxSizeBytes; + + /** + * Get the name of the database to import. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the name of the database to import. + * + * @param databaseName the databaseName value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the edition for the database being created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * + * @return the edition value + */ + public DatabaseEdition edition() { + return this.edition; + } + + /** + * Set the edition for the database being created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * + * @param edition the edition value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withEdition(DatabaseEdition edition) { + this.edition = edition; + return this; + } + + /** + * Get the name of the service objective to assign to the database. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @return the serviceObjectiveName value + */ + public ServiceObjectiveName serviceObjectiveName() { + return this.serviceObjectiveName; + } + + /** + * Set the name of the service objective to assign to the database. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @param serviceObjectiveName the serviceObjectiveName value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withServiceObjectiveName(ServiceObjectiveName serviceObjectiveName) { + this.serviceObjectiveName = serviceObjectiveName; + return this; + } + + /** + * Get the maximum size for the newly imported database. + * + * @return the maxSizeBytes value + */ + public String maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maximum size for the newly imported database. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withMaxSizeBytes(String maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationImpact.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationImpact.java new file mode 100644 index 0000000000000..89a77c9d80176 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/OperationImpact.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The impact of an operation, both in absolute and relative terms. + */ +public class OperationImpact { + /** + * The name of the impact dimension. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The unit in which estimated impact to dimension is measured. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The absolute impact to dimension. + */ + @JsonProperty(value = "changeValueAbsolute", access = JsonProperty.Access.WRITE_ONLY) + private Double changeValueAbsolute; + + /** + * The relative impact to dimension (null if not applicable). + */ + @JsonProperty(value = "changeValueRelative", access = JsonProperty.Access.WRITE_ONLY) + private Double changeValueRelative; + + /** + * Get the name of the impact dimension. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the unit in which estimated impact to dimension is measured. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Get the absolute impact to dimension. + * + * @return the changeValueAbsolute value + */ + public Double changeValueAbsolute() { + return this.changeValueAbsolute; + } + + /** + * Get the relative impact to dimension (null if not applicable). + * + * @return the changeValueRelative value + */ + public Double changeValueRelative() { + return this.changeValueRelative; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReadScale.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReadScale.java new file mode 100644 index 0000000000000..9547b48f8d2e6 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReadScale.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ReadScale. + */ +public enum ReadScale { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a ReadScale instance. */ + private String value; + + ReadScale(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ReadScale instance. + * + * @param value the serialized value to parse. + * @return the parsed ReadScale object, or null if unable to parse. + */ + @JsonCreator + public static ReadScale fromString(String value) { + ReadScale[] items = ReadScale.values(); + for (ReadScale 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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPool.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPool.java new file mode 100644 index 0000000000000..18fedbd6be7c9 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPool.java @@ -0,0 +1,94 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.RecommendedElasticPoolInner; +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.v2014_04_01.implementation.SqlManager; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing RecommendedElasticPool. + */ +public interface RecommendedElasticPool extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the databaseDtuMax value. + */ + Double databaseDtuMax(); + + /** + * @return the databaseDtuMin value. + */ + Double databaseDtuMin(); + + /** + * @return the databaseEdition value. + */ + ElasticPoolEdition databaseEdition(); + + /** + * @return the databases value. + */ + List databases(); + + /** + * @return the dtu value. + */ + Double dtu(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxObservedDtu value. + */ + Double maxObservedDtu(); + + /** + * @return the maxObservedStorageMB value. + */ + Double maxObservedStorageMB(); + + /** + * @return the metrics value. + */ + List metrics(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the observationPeriodEnd value. + */ + DateTime observationPeriodEnd(); + + /** + * @return the observationPeriodStart value. + */ + DateTime observationPeriodStart(); + + /** + * @return the storageMB value. + */ + Double storageMB(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPoolMetric.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPoolMetric.java new file mode 100644 index 0000000000000..a0a76f2b36dba --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPoolMetric.java @@ -0,0 +1,36 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.RecommendedElasticPoolMetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing RecommendedElasticPoolMetric. + */ +public interface RecommendedElasticPoolMetric extends HasInner, HasManager { + /** + * @return the dateTimeProperty value. + */ + DateTime dateTimeProperty(); + + /** + * @return the dtu value. + */ + Double dtu(); + + /** + * @return the sizeGB value. + */ + Double sizeGB(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPools.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPools.java new file mode 100644 index 0000000000000..cc8cc11b6c8c2 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedElasticPools.java @@ -0,0 +1,52 @@ +/** + * 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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.RecommendedElasticPoolsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPoolMetric; + +/** + * Type representing RecommendedElasticPools. + */ +public interface RecommendedElasticPools extends HasInner { + /** + * Gets a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName); + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName); + + /** + * Returns recommented elastic pool metrics. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndex.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndex.java new file mode 100644 index 0000000000000..09698ba74e2f4 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndex.java @@ -0,0 +1,210 @@ +/** + * 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.v2014_04_01; + +import org.joda.time.DateTime; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database recommended index. + */ +@JsonFlatten +public class RecommendedIndex extends ProxyResource { + /** + * The proposed index action. You can create a missing index, drop an + * unused index, or rebuild an existing index to improve its performance. + * Possible values include: 'Create', 'Drop', 'Rebuild'. + */ + @JsonProperty(value = "properties.action", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedIndexAction action; + + /** + * The current recommendation state. Possible values include: 'Active', + * 'Pending', 'Executing', 'Verifying', 'Pending Revert', 'Reverting', + * 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedIndexState state; + + /** + * The UTC datetime showing when this resource was created (ISO8601 + * format). + */ + @JsonProperty(value = "properties.created", access = JsonProperty.Access.WRITE_ONLY) + private DateTime created; + + /** + * The UTC datetime of when was this resource last changed (ISO8601 + * format). + */ + @JsonProperty(value = "properties.lastModified", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastModified; + + /** + * The type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, CLUSTERED + * COLUMNSTORE). Possible values include: 'CLUSTERED', 'NONCLUSTERED', + * 'COLUMNSTORE', 'CLUSTERED COLUMNSTORE'. + */ + @JsonProperty(value = "properties.indexType", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedIndexType indexType; + + /** + * The schema where table to build index over resides. + */ + @JsonProperty(value = "properties.schema", access = JsonProperty.Access.WRITE_ONLY) + private String schema; + + /** + * The table on which to build index. + */ + @JsonProperty(value = "properties.table", access = JsonProperty.Access.WRITE_ONLY) + private String table; + + /** + * Columns over which to build index. + */ + @JsonProperty(value = "properties.columns", access = JsonProperty.Access.WRITE_ONLY) + private List columns; + + /** + * The list of column names to be included in the index. + */ + @JsonProperty(value = "properties.includedColumns", access = JsonProperty.Access.WRITE_ONLY) + private List includedColumns; + + /** + * The full build index script. + */ + @JsonProperty(value = "properties.indexScript", access = JsonProperty.Access.WRITE_ONLY) + private String indexScript; + + /** + * The estimated impact of doing recommended index action. + */ + @JsonProperty(value = "properties.estimatedImpact", access = JsonProperty.Access.WRITE_ONLY) + private List estimatedImpact; + + /** + * The values reported after index action is complete. + */ + @JsonProperty(value = "properties.reportedImpact", access = JsonProperty.Access.WRITE_ONLY) + private List reportedImpact; + + /** + * Get the proposed index action. You can create a missing index, drop an unused index, or rebuild an existing index to improve its performance. Possible values include: 'Create', 'Drop', 'Rebuild'. + * + * @return the action value + */ + public RecommendedIndexAction action() { + return this.action; + } + + /** + * Get the current recommendation state. Possible values include: 'Active', 'Pending', 'Executing', 'Verifying', 'Pending Revert', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success'. + * + * @return the state value + */ + public RecommendedIndexState state() { + return this.state; + } + + /** + * Get the UTC datetime showing when this resource was created (ISO8601 format). + * + * @return the created value + */ + public DateTime created() { + return this.created; + } + + /** + * Get the UTC datetime of when was this resource last changed (ISO8601 format). + * + * @return the lastModified value + */ + public DateTime lastModified() { + return this.lastModified; + } + + /** + * Get the type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, CLUSTERED COLUMNSTORE). Possible values include: 'CLUSTERED', 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTERED COLUMNSTORE'. + * + * @return the indexType value + */ + public RecommendedIndexType indexType() { + return this.indexType; + } + + /** + * Get the schema where table to build index over resides. + * + * @return the schema value + */ + public String schema() { + return this.schema; + } + + /** + * Get the table on which to build index. + * + * @return the table value + */ + public String table() { + return this.table; + } + + /** + * Get columns over which to build index. + * + * @return the columns value + */ + public List columns() { + return this.columns; + } + + /** + * Get the list of column names to be included in the index. + * + * @return the includedColumns value + */ + public List includedColumns() { + return this.includedColumns; + } + + /** + * Get the full build index script. + * + * @return the indexScript value + */ + public String indexScript() { + return this.indexScript; + } + + /** + * Get the estimated impact of doing recommended index action. + * + * @return the estimatedImpact value + */ + public List estimatedImpact() { + return this.estimatedImpact; + } + + /** + * Get the values reported after index action is complete. + * + * @return the reportedImpact value + */ + public List reportedImpact() { + return this.reportedImpact; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexAction.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexAction.java new file mode 100644 index 0000000000000..eb379d9810132 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexAction.java @@ -0,0 +1,56 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RecommendedIndexAction. + */ +public enum RecommendedIndexAction { + /** Enum value Create. */ + CREATE("Create"), + + /** Enum value Drop. */ + DROP("Drop"), + + /** Enum value Rebuild. */ + REBUILD("Rebuild"); + + /** The actual serialized value for a RecommendedIndexAction instance. */ + private String value; + + RecommendedIndexAction(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedIndexAction instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedIndexAction object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedIndexAction fromString(String value) { + RecommendedIndexAction[] items = RecommendedIndexAction.values(); + for (RecommendedIndexAction 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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexState.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexState.java new file mode 100644 index 0000000000000..202ced229428a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexState.java @@ -0,0 +1,80 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RecommendedIndexState. + */ +public enum RecommendedIndexState { + /** Enum value Active. */ + ACTIVE("Active"), + + /** Enum value Pending. */ + PENDING("Pending"), + + /** Enum value Executing. */ + EXECUTING("Executing"), + + /** Enum value Verifying. */ + VERIFYING("Verifying"), + + /** Enum value Pending Revert. */ + PENDING_REVERT("Pending Revert"), + + /** Enum value Reverting. */ + REVERTING("Reverting"), + + /** Enum value Reverted. */ + REVERTED("Reverted"), + + /** Enum value Ignored. */ + IGNORED("Ignored"), + + /** Enum value Expired. */ + EXPIRED("Expired"), + + /** Enum value Blocked. */ + BLOCKED("Blocked"), + + /** Enum value Success. */ + SUCCESS("Success"); + + /** The actual serialized value for a RecommendedIndexState instance. */ + private String value; + + RecommendedIndexState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedIndexState instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedIndexState object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedIndexState fromString(String value) { + RecommendedIndexState[] items = RecommendedIndexState.values(); + for (RecommendedIndexState 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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexType.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexType.java new file mode 100644 index 0000000000000..96c26210017f0 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/RecommendedIndexType.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RecommendedIndexType. + */ +public enum RecommendedIndexType { + /** Enum value CLUSTERED. */ + CLUSTERED("CLUSTERED"), + + /** Enum value NONCLUSTERED. */ + NONCLUSTERED("NONCLUSTERED"), + + /** Enum value COLUMNSTORE. */ + COLUMNSTORE("COLUMNSTORE"), + + /** Enum value CLUSTERED COLUMNSTORE. */ + CLUSTERED_COLUMNSTORE("CLUSTERED COLUMNSTORE"); + + /** The actual serialized value for a RecommendedIndexType instance. */ + private String value; + + RecommendedIndexType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedIndexType instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedIndexType object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedIndexType fromString(String value) { + RecommendedIndexType[] items = RecommendedIndexType.values(); + for (RecommendedIndexType 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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationLink.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationLink.java new file mode 100644 index 0000000000000..d94da2e11d759 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationLink.java @@ -0,0 +1,93 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ReplicationLinkInner; +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.v2014_04_01.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ReplicationLink. + */ +public interface ReplicationLink extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the isTerminationAllowed value. + */ + Boolean isTerminationAllowed(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partnerDatabase value. + */ + String partnerDatabase(); + + /** + * @return the partnerLocation value. + */ + String partnerLocation(); + + /** + * @return the partnerRole value. + */ + ReplicationRole partnerRole(); + + /** + * @return the partnerServer value. + */ + String partnerServer(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the replicationMode value. + */ + String replicationMode(); + + /** + * @return the replicationState value. + */ + ReplicationState replicationState(); + + /** + * @return the role value. + */ + ReplicationRole role(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationLinks.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationLinks.java new file mode 100644 index 0000000000000..2e025e123a389 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationLinks.java @@ -0,0 +1,79 @@ +/** + * 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.v2014_04_01; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ReplicationLinksInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReplicationLinks. + */ +public interface ReplicationLinks extends HasInner { + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable failoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable failoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 to get the link for. + * @param linkId The replication link ID to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 to retrieve links for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String linkId); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationRole.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationRole.java new file mode 100644 index 0000000000000..114bffe1c23bd --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationRole.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ReplicationRole. + */ +public enum ReplicationRole { + /** Enum value Primary. */ + PRIMARY("Primary"), + + /** Enum value Secondary. */ + SECONDARY("Secondary"), + + /** Enum value NonReadableSecondary. */ + NON_READABLE_SECONDARY("NonReadableSecondary"), + + /** Enum value Source. */ + SOURCE("Source"), + + /** Enum value Copy. */ + COPY("Copy"); + + /** The actual serialized value for a ReplicationRole instance. */ + private String value; + + ReplicationRole(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ReplicationRole instance. + * + * @param value the serialized value to parse. + * @return the parsed ReplicationRole object, or null if unable to parse. + */ + @JsonCreator + public static ReplicationRole fromString(String value) { + ReplicationRole[] items = ReplicationRole.values(); + for (ReplicationRole 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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationState.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationState.java new file mode 100644 index 0000000000000..0a31a15d4d9d6 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ReplicationState.java @@ -0,0 +1,47 @@ +/** + * 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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReplicationState. + */ +public final class ReplicationState extends ExpandableStringEnum { + /** Static value PENDING for ReplicationState. */ + public static final ReplicationState PENDING = fromString("PENDING"); + + /** Static value SEEDING for ReplicationState. */ + public static final ReplicationState SEEDING = fromString("SEEDING"); + + /** Static value CATCH_UP for ReplicationState. */ + public static final ReplicationState CATCH_UP = fromString("CATCH_UP"); + + /** Static value SUSPENDED for ReplicationState. */ + public static final ReplicationState SUSPENDED = fromString("SUSPENDED"); + + /** + * Creates or finds a ReplicationState from its string representation. + * @param name a name to look for + * @return the corresponding ReplicationState + */ + @JsonCreator + public static ReplicationState fromString(String name) { + return fromString(name, ReplicationState.class); + } + + /** + * @return known ReplicationState values + */ + public static Collection values() { + return values(ReplicationState.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SampleName.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SampleName.java new file mode 100644 index 0000000000000..0233430fdec2d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SampleName.java @@ -0,0 +1,38 @@ +/** + * 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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SampleName. + */ +public final class SampleName extends ExpandableStringEnum { + /** Static value AdventureWorksLT for SampleName. */ + public static final SampleName ADVENTURE_WORKS_LT = fromString("AdventureWorksLT"); + + /** + * Creates or finds a SampleName from its string representation. + * @param name a name to look for + * @return the corresponding SampleName + */ + @JsonCreator + public static SampleName fromString(String name) { + return fromString(name, SampleName.class); + } + + /** + * @return known SampleName values + */ + public static Collection values() { + return values(SampleName.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyEmailAccountAdmins.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyEmailAccountAdmins.java new file mode 100644 index 0000000000000..2ae0a9a487f18 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyEmailAccountAdmins.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SecurityAlertPolicyEmailAccountAdmins. + */ +public enum SecurityAlertPolicyEmailAccountAdmins { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SecurityAlertPolicyEmailAccountAdmins instance. */ + private String value; + + SecurityAlertPolicyEmailAccountAdmins(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityAlertPolicyEmailAccountAdmins instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityAlertPolicyEmailAccountAdmins object, or null if unable to parse. + */ + @JsonCreator + public static SecurityAlertPolicyEmailAccountAdmins fromString(String value) { + SecurityAlertPolicyEmailAccountAdmins[] items = SecurityAlertPolicyEmailAccountAdmins.values(); + for (SecurityAlertPolicyEmailAccountAdmins 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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyState.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyState.java new file mode 100644 index 0000000000000..60842f6333363 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyState.java @@ -0,0 +1,56 @@ +/** + * 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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SecurityAlertPolicyState. + */ +public enum SecurityAlertPolicyState { + /** Enum value New. */ + NEW("New"), + + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SecurityAlertPolicyState instance. */ + private String value; + + SecurityAlertPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityAlertPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityAlertPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static SecurityAlertPolicyState fromString(String value) { + SecurityAlertPolicyState[] items = SecurityAlertPolicyState.values(); + for (SecurityAlertPolicyState 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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyUseServerDefault.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyUseServerDefault.java new file mode 100644 index 0000000000000..7f45a8b34902e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SecurityAlertPolicyUseServerDefault.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SecurityAlertPolicyUseServerDefault. + */ +public enum SecurityAlertPolicyUseServerDefault { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SecurityAlertPolicyUseServerDefault instance. */ + private String value; + + SecurityAlertPolicyUseServerDefault(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityAlertPolicyUseServerDefault instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityAlertPolicyUseServerDefault object, or null if unable to parse. + */ + @JsonCreator + public static SecurityAlertPolicyUseServerDefault fromString(String value) { + SecurityAlertPolicyUseServerDefault[] items = SecurityAlertPolicyUseServerDefault.values(); + for (SecurityAlertPolicyUseServerDefault 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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Servers.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Servers.java new file mode 100644 index 0000000000000..e2d14f49ecc37 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/Servers.java @@ -0,0 +1,28 @@ +/** + * 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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Servers. + */ +public interface Servers extends HasInner { + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityAsync(String name); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectiveName.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectiveName.java new file mode 100644 index 0000000000000..5027a3f7a8bfa --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceObjectiveName.java @@ -0,0 +1,230 @@ +/** + * 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.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ServiceObjectiveName. + */ +public final class ServiceObjectiveName extends ExpandableStringEnum { + /** Static value System for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM = fromString("System"); + + /** Static value System0 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM0 = fromString("System0"); + + /** Static value System1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM1 = fromString("System1"); + + /** Static value System2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM2 = fromString("System2"); + + /** Static value System3 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM3 = fromString("System3"); + + /** Static value System4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM4 = fromString("System4"); + + /** Static value System2L for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM2L = fromString("System2L"); + + /** Static value System3L for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM3L = fromString("System3L"); + + /** Static value System4L for ServiceObjectiveName. */ + public static final ServiceObjectiveName SYSTEM4L = fromString("System4L"); + + /** Static value Free for ServiceObjectiveName. */ + public static final ServiceObjectiveName FREE = fromString("Free"); + + /** Static value Basic for ServiceObjectiveName. */ + public static final ServiceObjectiveName BASIC = fromString("Basic"); + + /** Static value S0 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S0 = fromString("S0"); + + /** Static value S1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S1 = fromString("S1"); + + /** Static value S2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S2 = fromString("S2"); + + /** Static value S3 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S3 = fromString("S3"); + + /** Static value S4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S4 = fromString("S4"); + + /** Static value S6 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S6 = fromString("S6"); + + /** Static value S7 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S7 = fromString("S7"); + + /** Static value S9 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S9 = fromString("S9"); + + /** Static value S12 for ServiceObjectiveName. */ + public static final ServiceObjectiveName S12 = fromString("S12"); + + /** Static value P1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P1 = fromString("P1"); + + /** Static value P2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P2 = fromString("P2"); + + /** Static value P3 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P3 = fromString("P3"); + + /** Static value P4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P4 = fromString("P4"); + + /** Static value P6 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P6 = fromString("P6"); + + /** Static value P11 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P11 = fromString("P11"); + + /** Static value P15 for ServiceObjectiveName. */ + public static final ServiceObjectiveName P15 = fromString("P15"); + + /** Static value PRS1 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS1 = fromString("PRS1"); + + /** Static value PRS2 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS2 = fromString("PRS2"); + + /** Static value PRS4 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS4 = fromString("PRS4"); + + /** Static value PRS6 for ServiceObjectiveName. */ + public static final ServiceObjectiveName PRS6 = fromString("PRS6"); + + /** Static value DW100 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW100 = fromString("DW100"); + + /** Static value DW200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW200 = fromString("DW200"); + + /** Static value DW300 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW300 = fromString("DW300"); + + /** Static value DW400 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW400 = fromString("DW400"); + + /** Static value DW500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW500 = fromString("DW500"); + + /** Static value DW600 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW600 = fromString("DW600"); + + /** Static value DW1000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1000 = fromString("DW1000"); + + /** Static value DW1200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1200 = fromString("DW1200"); + + /** Static value DW1000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1000C = fromString("DW1000c"); + + /** Static value DW1500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1500 = fromString("DW1500"); + + /** Static value DW1500c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW1500C = fromString("DW1500c"); + + /** Static value DW2000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW2000 = fromString("DW2000"); + + /** Static value DW2000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW2000C = fromString("DW2000c"); + + /** Static value DW3000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW3000 = fromString("DW3000"); + + /** Static value DW2500c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW2500C = fromString("DW2500c"); + + /** Static value DW3000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW3000C = fromString("DW3000c"); + + /** Static value DW6000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW6000 = fromString("DW6000"); + + /** Static value DW5000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW5000C = fromString("DW5000c"); + + /** Static value DW6000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW6000C = fromString("DW6000c"); + + /** Static value DW7500c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW7500C = fromString("DW7500c"); + + /** Static value DW10000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW10000C = fromString("DW10000c"); + + /** Static value DW15000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW15000C = fromString("DW15000c"); + + /** Static value DW30000c for ServiceObjectiveName. */ + public static final ServiceObjectiveName DW30000C = fromString("DW30000c"); + + /** Static value DS100 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS100 = fromString("DS100"); + + /** Static value DS200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS200 = fromString("DS200"); + + /** Static value DS300 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS300 = fromString("DS300"); + + /** Static value DS400 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS400 = fromString("DS400"); + + /** Static value DS500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS500 = fromString("DS500"); + + /** Static value DS600 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS600 = fromString("DS600"); + + /** Static value DS1000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS1000 = fromString("DS1000"); + + /** Static value DS1200 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS1200 = fromString("DS1200"); + + /** Static value DS1500 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS1500 = fromString("DS1500"); + + /** Static value DS2000 for ServiceObjectiveName. */ + public static final ServiceObjectiveName DS2000 = fromString("DS2000"); + + /** Static value ElasticPool for ServiceObjectiveName. */ + public static final ServiceObjectiveName ELASTIC_POOL = fromString("ElasticPool"); + + /** + * Creates or finds a ServiceObjectiveName from its string representation. + * @param name a name to look for + * @return the corresponding ServiceObjectiveName + */ + @JsonCreator + public static ServiceObjectiveName fromString(String name) { + return fromString(name, ServiceObjectiveName.class); + } + + /** + * @return known ServiceObjectiveName values + */ + public static Collection values() { + return values(ServiceObjectiveName.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceTierAdvisor.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceTierAdvisor.java new file mode 100644 index 0000000000000..1a212dfc36351 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceTierAdvisor.java @@ -0,0 +1,135 @@ +/** + * 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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServiceTierAdvisorInner; +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.v2014_04_01.implementation.SqlManager; +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing ServiceTierAdvisor. + */ +public interface ServiceTierAdvisor extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the activeTimeRatio value. + */ + Double activeTimeRatio(); + + /** + * @return the avgDtu value. + */ + Double avgDtu(); + + /** + * @return the confidence value. + */ + double confidence(); + + /** + * @return the currentServiceLevelObjective value. + */ + String currentServiceLevelObjective(); + + /** + * @return the currentServiceLevelObjectiveId value. + */ + UUID currentServiceLevelObjectiveId(); + + /** + * @return the databaseSizeBasedRecommendationServiceLevelObjective value. + */ + String databaseSizeBasedRecommendationServiceLevelObjective(); + + /** + * @return the databaseSizeBasedRecommendationServiceLevelObjectiveId value. + */ + UUID databaseSizeBasedRecommendationServiceLevelObjectiveId(); + + /** + * @return the disasterPlanBasedRecommendationServiceLevelObjective value. + */ + String disasterPlanBasedRecommendationServiceLevelObjective(); + + /** + * @return the disasterPlanBasedRecommendationServiceLevelObjectiveId value. + */ + UUID disasterPlanBasedRecommendationServiceLevelObjectiveId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxDtu value. + */ + Double maxDtu(); + + /** + * @return the maxSizeInGB value. + */ + Double maxSizeInGB(); + + /** + * @return the minDtu value. + */ + Double minDtu(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the observationPeriodEnd value. + */ + DateTime observationPeriodEnd(); + + /** + * @return the observationPeriodStart value. + */ + DateTime observationPeriodStart(); + + /** + * @return the overallRecommendationServiceLevelObjective value. + */ + String overallRecommendationServiceLevelObjective(); + + /** + * @return the overallRecommendationServiceLevelObjectiveId value. + */ + UUID overallRecommendationServiceLevelObjectiveId(); + + /** + * @return the serviceLevelObjectiveUsageMetrics value. + */ + List serviceLevelObjectiveUsageMetrics(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageBasedRecommendationServiceLevelObjective value. + */ + String usageBasedRecommendationServiceLevelObjective(); + + /** + * @return the usageBasedRecommendationServiceLevelObjectiveId value. + */ + UUID usageBasedRecommendationServiceLevelObjectiveId(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceTierAdvisors.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceTierAdvisors.java new file mode 100644 index 0000000000000..e3de82242f905 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/ServiceTierAdvisors.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.ServiceTierAdvisorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServiceTierAdvisors. + */ +public interface ServiceTierAdvisors extends HasInner { + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName); + + /** + * Returns service tier advisors for specified 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 database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SloUsageMetric.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SloUsageMetric.java new file mode 100644 index 0000000000000..148d3ddd64c72 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/SloUsageMetric.java @@ -0,0 +1,72 @@ +/** + * 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.v2014_04_01; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Slo Usage Metric. + */ +public class SloUsageMetric { + /** + * The serviceLevelObjective for SLO usage metric. Possible values include: + * 'System', 'System0', 'System1', 'System2', 'System3', 'System4', + * 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', + * 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', + * 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', + * 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', + * 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', + * 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', + * 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', + * 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private ServiceObjectiveName serviceLevelObjective; + + /** + * The serviceLevelObjectiveId for SLO usage metric. + */ + @JsonProperty(value = "serviceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID serviceLevelObjectiveId; + + /** + * Gets or sets inRangeTimeRatio for SLO usage metric. + */ + @JsonProperty(value = "inRangeTimeRatio", access = JsonProperty.Access.WRITE_ONLY) + private double inRangeTimeRatio; + + /** + * Get the serviceLevelObjective for SLO usage metric. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @return the serviceLevelObjective value + */ + public ServiceObjectiveName serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the serviceLevelObjectiveId for SLO usage metric. + * + * @return the serviceLevelObjectiveId value + */ + public UUID serviceLevelObjectiveId() { + return this.serviceLevelObjectiveId; + } + + /** + * Get gets or sets inRangeTimeRatio for SLO usage metric. + * + * @return the inRangeTimeRatio value + */ + public double inRangeTimeRatio() { + return this.inRangeTimeRatio; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/StorageKeyType.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/StorageKeyType.java new file mode 100644 index 0000000000000..c561f5ac0db5a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/StorageKeyType.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for StorageKeyType. + */ +public enum StorageKeyType { + /** Enum value StorageAccessKey. */ + STORAGE_ACCESS_KEY("StorageAccessKey"), + + /** Enum value SharedAccessKey. */ + SHARED_ACCESS_KEY("SharedAccessKey"); + + /** The actual serialized value for a StorageKeyType instance. */ + private String value; + + StorageKeyType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a StorageKeyType instance. + * + * @param value the serialized value to parse. + * @return the parsed StorageKeyType object, or null if unable to parse. + */ + @JsonCreator + public static StorageKeyType fromString(String value) { + StorageKeyType[] items = StorageKeyType.values(); + for (StorageKeyType 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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryption.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryption.java new file mode 100644 index 0000000000000..bd3f35a4e42fd --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryption.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.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.TransparentDataEncryptionInner; + +/** + * Type representing TransparentDataEncryption. + */ +public interface TransparentDataEncryption extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the status value. + */ + TransparentDataEncryptionStatus status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivities.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivities.java new file mode 100644 index 0000000000000..27cd841eb2c0a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivities.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.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.TransparentDataEncryptionActivitiesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing TransparentDataEncryptionActivities. + */ +public interface TransparentDataEncryptionActivities extends HasInner { + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 for which the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByConfigurationAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivity.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivity.java new file mode 100644 index 0000000000000..410a43f8549a7 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivity.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2014_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.TransparentDataEncryptionActivityInner; + +/** + * Type representing TransparentDataEncryptionActivity. + */ +public interface TransparentDataEncryptionActivity extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the percentComplete value. + */ + Double percentComplete(); + + /** + * @return the status value. + */ + TransparentDataEncryptionActivityStatus status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivityStatus.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivityStatus.java new file mode 100644 index 0000000000000..425685654c759 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionActivityStatus.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2014_04_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TransparentDataEncryptionActivityStatus. + */ +public final class TransparentDataEncryptionActivityStatus extends ExpandableStringEnum { + /** Static value Encrypting for TransparentDataEncryptionActivityStatus. */ + public static final TransparentDataEncryptionActivityStatus ENCRYPTING = fromString("Encrypting"); + + /** Static value Decrypting for TransparentDataEncryptionActivityStatus. */ + public static final TransparentDataEncryptionActivityStatus DECRYPTING = fromString("Decrypting"); + + /** + * Creates or finds a TransparentDataEncryptionActivityStatus from its string representation. + * @param name a name to look for + * @return the corresponding TransparentDataEncryptionActivityStatus + */ + @JsonCreator + public static TransparentDataEncryptionActivityStatus fromString(String name) { + return fromString(name, TransparentDataEncryptionActivityStatus.class); + } + + /** + * @return known TransparentDataEncryptionActivityStatus values + */ + public static Collection values() { + return values(TransparentDataEncryptionActivityStatus.class); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionStatus.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionStatus.java new file mode 100644 index 0000000000000..6720aabb6308b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptionStatus.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.v2014_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for TransparentDataEncryptionStatus. + */ +public enum TransparentDataEncryptionStatus { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a TransparentDataEncryptionStatus instance. */ + private String value; + + TransparentDataEncryptionStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TransparentDataEncryptionStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed TransparentDataEncryptionStatus object, or null if unable to parse. + */ + @JsonCreator + public static TransparentDataEncryptionStatus fromString(String value) { + TransparentDataEncryptionStatus[] items = TransparentDataEncryptionStatus.values(); + for (TransparentDataEncryptionStatus 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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptions.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptions.java new file mode 100644 index 0000000000000..0ca5573bdee8c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/TransparentDataEncryptions.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2014_04_01; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.implementation.TransparentDataEncryptionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing TransparentDataEncryptions. + */ +public interface TransparentDataEncryptions extends HasInner { + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 for which setting the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 for which the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CheckNameAvailabilityResponseImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 0000000000000..c25633610cf51 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CheckNameAvailabilityResponseImpl.java @@ -0,0 +1,47 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.CheckNameAvailabilityResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.CheckNameAvailabilityReason; + +class CheckNameAvailabilityResponseImpl extends WrapperImpl implements CheckNameAvailabilityResponse { + private final SqlManager manager; + CheckNameAvailabilityResponseImpl(CheckNameAvailabilityResponseInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Boolean available() { + return this.inner().available(); + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public CheckNameAvailabilityReason reason() { + return this.inner().reason(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CheckNameAvailabilityResponseInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CheckNameAvailabilityResponseInner.java new file mode 100644 index 0000000000000..f1f75cf97c261 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/CheckNameAvailabilityResponseInner.java @@ -0,0 +1,82 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.CheckNameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A response indicating whether the specified name for a resource is + * available. + */ +public class CheckNameAvailabilityResponseInner { + /** + * True if the name is available, otherwise false. + */ + @JsonProperty(value = "available", access = JsonProperty.Access.WRITE_ONLY) + private Boolean available; + + /** + * A message explaining why the name is unavailable. Will be null if the + * name is available. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The name whose availability was checked. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The reason code explaining why the name is unavailable. Will be null if + * the name is available. Possible values include: 'Invalid', + * 'AlreadyExists'. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private CheckNameAvailabilityReason reason; + + /** + * Get true if the name is available, otherwise false. + * + * @return the available value + */ + public Boolean available() { + return this.available; + } + + /** + * Get a message explaining why the name is unavailable. Will be null if the name is available. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the name whose availability was checked. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the reason code explaining why the name is unavailable. Will be null if the name is available. Possible values include: 'Invalid', 'AlreadyExists'. + * + * @return the reason value + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseImpl.java new file mode 100644 index 0000000000000..e86c1cac6c001 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseImpl.java @@ -0,0 +1,442 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.Database; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseUpdate; +import java.util.Map; +import org.joda.time.DateTime; +import java.util.UUID; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.CreateMode; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseEdition; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceObjectiveName; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedIndex; +import com.microsoft.azure.management.sql.v2014_04_01.ReadScale; +import com.microsoft.azure.management.sql.v2014_04_01.SampleName; +import java.util.ArrayList; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceTierAdvisor; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryption; +import rx.functions.Func1; + +class DatabaseImpl extends CreatableUpdatableImpl implements Database, Database.Definition, Database.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private DatabaseUpdate updateParameter; + + DatabaseImpl(String name, SqlManager manager) { + super(name, new DatabaseInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + this.updateParameter = new DatabaseUpdate(); + } + + DatabaseImpl(DatabaseInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + this.updateParameter = new DatabaseUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(new Func1() { + @Override + public DatabaseInner call(DatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.updateParameter) + .map(new Func1() { + @Override + public DatabaseInner call(DatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new DatabaseUpdate(); + } + + @Override + public String collation() { + return this.inner().collation(); + } + + @Override + public Long containmentState() { + return this.inner().containmentState(); + } + + @Override + public CreateMode createMode() { + return this.inner().createMode(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public UUID currentServiceObjectiveId() { + return this.inner().currentServiceObjectiveId(); + } + + @Override + public UUID databaseId() { + return this.inner().databaseId(); + } + + @Override + public String defaultSecondaryLocation() { + return this.inner().defaultSecondaryLocation(); + } + + @Override + public DateTime earliestRestoreDate() { + return this.inner().earliestRestoreDate(); + } + + @Override + public DatabaseEdition edition() { + return this.inner().edition(); + } + + @Override + public String elasticPoolName() { + return this.inner().elasticPoolName(); + } + + @Override + public String failoverGroupId() { + return this.inner().failoverGroupId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String maxSizeBytes() { + return this.inner().maxSizeBytes(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ReadScale readScale() { + return this.inner().readScale(); + } + + @Override + public List recommendedIndex() { + return this.inner().recommendedIndex(); + } + + @Override + public String recoveryServicesRecoveryPointResourceId() { + return this.inner().recoveryServicesRecoveryPointResourceId(); + } + + @Override + public UUID requestedServiceObjectiveId() { + return this.inner().requestedServiceObjectiveId(); + } + + @Override + public ServiceObjectiveName requestedServiceObjectiveName() { + return this.inner().requestedServiceObjectiveName(); + } + + @Override + public DateTime restorePointInTime() { + return this.inner().restorePointInTime(); + } + + @Override + public SampleName sampleName() { + return this.inner().sampleName(); + } + + @Override + public ServiceObjectiveName serviceLevelObjective() { + return this.inner().serviceLevelObjective(); + } + + @Override + public List serviceTierAdvisors() { + List lst = new ArrayList(); + if (this.inner().serviceTierAdvisors() != null) { + for (ServiceTierAdvisorInner inner : this.inner().serviceTierAdvisors()) { + lst.add( new ServiceTierAdvisorImpl(inner, manager())); + } + } + return lst; + } + + @Override + public DateTime sourceDatabaseDeletionDate() { + return this.inner().sourceDatabaseDeletionDate(); + } + + @Override + public String sourceDatabaseId() { + return this.inner().sourceDatabaseId(); + } + + @Override + public String status() { + return this.inner().status(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public List transparentDataEncryption() { + List lst = new ArrayList(); + if (this.inner().transparentDataEncryption() != null) { + for (TransparentDataEncryptionInner inner : this.inner().transparentDataEncryption()) { + lst.add( new TransparentDataEncryptionImpl(inner, manager())); + } + } + return lst; + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Boolean zoneRedundant() { + return this.inner().zoneRedundant(); + } + + @Override + public DatabaseImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public DatabaseImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public DatabaseImpl withCollation(String collation) { + if (isInCreateMode()) { + this.inner().withCollation(collation); + } else { + this.updateParameter.withCollation(collation); + } + return this; + } + + @Override + public DatabaseImpl withCreateMode(CreateMode createMode) { + if (isInCreateMode()) { + this.inner().withCreateMode(createMode); + } else { + this.updateParameter.withCreateMode(createMode); + } + return this; + } + + @Override + public DatabaseImpl withEdition(DatabaseEdition edition) { + if (isInCreateMode()) { + this.inner().withEdition(edition); + } else { + this.updateParameter.withEdition(edition); + } + return this; + } + + @Override + public DatabaseImpl withElasticPoolName(String elasticPoolName) { + if (isInCreateMode()) { + this.inner().withElasticPoolName(elasticPoolName); + } else { + this.updateParameter.withElasticPoolName(elasticPoolName); + } + return this; + } + + @Override + public DatabaseImpl withMaxSizeBytes(String maxSizeBytes) { + if (isInCreateMode()) { + this.inner().withMaxSizeBytes(maxSizeBytes); + } else { + this.updateParameter.withMaxSizeBytes(maxSizeBytes); + } + return this; + } + + @Override + public DatabaseImpl withReadScale(ReadScale readScale) { + if (isInCreateMode()) { + this.inner().withReadScale(readScale); + } else { + this.updateParameter.withReadScale(readScale); + } + return this; + } + + @Override + public DatabaseImpl withRecoveryServicesRecoveryPointResourceId(String recoveryServicesRecoveryPointResourceId) { + if (isInCreateMode()) { + this.inner().withRecoveryServicesRecoveryPointResourceId(recoveryServicesRecoveryPointResourceId); + } else { + this.updateParameter.withRecoveryServicesRecoveryPointResourceId(recoveryServicesRecoveryPointResourceId); + } + return this; + } + + @Override + public DatabaseImpl withRequestedServiceObjectiveId(UUID requestedServiceObjectiveId) { + if (isInCreateMode()) { + this.inner().withRequestedServiceObjectiveId(requestedServiceObjectiveId); + } else { + this.updateParameter.withRequestedServiceObjectiveId(requestedServiceObjectiveId); + } + return this; + } + + @Override + public DatabaseImpl withRequestedServiceObjectiveName(ServiceObjectiveName requestedServiceObjectiveName) { + if (isInCreateMode()) { + this.inner().withRequestedServiceObjectiveName(requestedServiceObjectiveName); + } else { + this.updateParameter.withRequestedServiceObjectiveName(requestedServiceObjectiveName); + } + return this; + } + + @Override + public DatabaseImpl withRestorePointInTime(DateTime restorePointInTime) { + if (isInCreateMode()) { + this.inner().withRestorePointInTime(restorePointInTime); + } else { + this.updateParameter.withRestorePointInTime(restorePointInTime); + } + return this; + } + + @Override + public DatabaseImpl withSampleName(SampleName sampleName) { + if (isInCreateMode()) { + this.inner().withSampleName(sampleName); + } else { + this.updateParameter.withSampleName(sampleName); + } + return this; + } + + @Override + public DatabaseImpl withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + if (isInCreateMode()) { + this.inner().withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + } else { + this.updateParameter.withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + } + return this; + } + + @Override + public DatabaseImpl withSourceDatabaseId(String sourceDatabaseId) { + if (isInCreateMode()) { + this.inner().withSourceDatabaseId(sourceDatabaseId); + } else { + this.updateParameter.withSourceDatabaseId(sourceDatabaseId); + } + return this; + } + + @Override + public DatabaseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public DatabaseImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.inner().withZoneRedundant(zoneRedundant); + } else { + this.updateParameter.withZoneRedundant(zoneRedundant); + } + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseInner.java new file mode 100644 index 0000000000000..5cc5b1b54d285 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseInner.java @@ -0,0 +1,719 @@ +/** + * 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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2014_04_01.CreateMode; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseEdition; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceObjectiveName; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedIndex; +import com.microsoft.azure.management.sql.v2014_04_01.ReadScale; +import com.microsoft.azure.management.sql.v2014_04_01.SampleName; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Represents a database. + */ +@JsonFlatten +public class DatabaseInner extends Resource { + /** + * Kind of database. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * The collation of the database. If createMode is not Default, this value + * is ignored. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The containment state of the database. + */ + @JsonProperty(value = "properties.containmentState", access = JsonProperty.Access.WRITE_ONLY) + private Long containmentState; + + /** + * The current service level objective ID of the database. This is the ID + * of the service level objective that is currently active. + */ + @JsonProperty(value = "properties.currentServiceObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID currentServiceObjectiveId; + + /** + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /** + * This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * OnlineSecondary/NonReadableSecondary: creates a database as a (readable + * or nonreadable) secondary replica of an existing database. + * sourceDatabaseId must be specified as the resource ID of the existing + * primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, NonReadableSecondary, OnlineSecondary and + * RestoreLongTermRetentionBackup are not supported for DataWarehouse + * edition. Possible values include: 'Copy', 'Default', + * 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', + * 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup'. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /** + * Conditional. If createMode is Copy, NonReadableSecondary, + * OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this + * value is required. Specifies the resource ID of the source database. If + * createMode is NonReadableSecondary or OnlineSecondary, the name of the + * source database must be the same as the new database being created. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * Conditional. If createMode is Restore and sourceDatabaseId is the + * deleted database's original resource id when it existed (as opposed to + * its current restorable dropped database id), then this value is + * required. Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private DateTime sourceDatabaseDeletionDate; + + /** + * Conditional. If createMode is PointInTimeRestore, this value is + * required. If createMode is Restore, this value is optional. Specifies + * the point in time (ISO8601 format) of the source database that will be + * restored to create the new database. Must be greater than or equal to + * the source database's earliestRestoreDate value. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Conditional. If createMode is RestoreLongTermRetentionBackup, then this + * value is required. Specifies the resource ID of the recovery point to + * restore from. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointResourceId") + private String recoveryServicesRecoveryPointResourceId; + + /** + * The edition of the database. The DatabaseEditions enumeration contains + * all the valid editions. If createMode is NonReadableSecondary or + * OnlineSecondary, this value is ignored. To see possible values, query + * the capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation." or use the + * Azure CLI command `az sql db list-editions -l westus --query [].name`. + * Possible values include: 'Web', 'Business', 'Basic', 'Standard', + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2'. + */ + @JsonProperty(value = "properties.edition") + private DatabaseEdition edition; + + /** + * The max size of the database expressed in bytes. If createMode is not + * Default, this value is ignored. To see possible values, query the + * capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation.". + */ + @JsonProperty(value = "properties.maxSizeBytes") + private String maxSizeBytes; + + /** + * The configured service level objective ID of the database. This is the + * service level objective that is in the process of being applied to the + * database. Once successfully updated, it will match the value of + * currentServiceObjectiveId property. If requestedServiceObjectiveId and + * requestedServiceObjectiveName are both updated, the value of + * requestedServiceObjectiveId overrides the value of + * requestedServiceObjectiveName. To see possible values, query the + * capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation." or use the + * Azure CLI command `az sql db list-editions --location <location> + * --query [].supportedServiceLevelObjectives[].name` . + */ + @JsonProperty(value = "properties.requestedServiceObjectiveId") + private UUID requestedServiceObjectiveId; + + /** + * The name of the configured service level objective of the database. This + * is the service level objective that is in the process of being applied + * to the database. Once successfully updated, it will match the value of + * serviceLevelObjective property. To see possible values, query the + * capabilities API + * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) + * referred to by operationId: "Capabilities_ListByLocation." or use the + * Azure CLI command `az sql db list-editions --location <location> + * --query [].supportedServiceLevelObjectives[].name`. Possible values + * include: 'System', 'System0', 'System1', 'System2', 'System3', + * 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', + * 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', + * 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', + * 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', + * 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', + * 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', + * 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', + * 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "properties.requestedServiceObjectiveName") + private ServiceObjectiveName requestedServiceObjectiveName; + + /** + * The current service level objective of the database. Possible values + * include: 'System', 'System0', 'System1', 'System2', 'System3', + * 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', + * 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', + * 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', + * 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', + * 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', + * 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', + * 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', + * 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "properties.serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private ServiceObjectiveName serviceLevelObjective; + + /** + * The status of the database. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The name of the elastic pool the database is in. If elasticPoolName and + * requestedServiceObjectiveName are both updated, the value of + * requestedServiceObjectiveName is ignored. Not supported for + * DataWarehouse edition. + */ + @JsonProperty(value = "properties.elasticPoolName") + private String elasticPoolName; + + /** + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * The list of service tier advisors for this database. Expanded property. + */ + @JsonProperty(value = "properties.serviceTierAdvisors", access = JsonProperty.Access.WRITE_ONLY) + private List serviceTierAdvisors; + + /** + * The transparent data encryption info for this database. + */ + @JsonProperty(value = "properties.transparentDataEncryption", access = JsonProperty.Access.WRITE_ONLY) + private List transparentDataEncryption; + + /** + * The recommended indices for this database. + */ + @JsonProperty(value = "properties.recommendedIndex", access = JsonProperty.Access.WRITE_ONLY) + private List recommendedIndex; + + /** + * The resource identifier of the failover group containing this database. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * Conditional. If the database is a geo-secondary, readScale indicates + * whether read-only connections are allowed to this database or not. Not + * supported for DataWarehouse edition. Possible values include: 'Enabled', + * 'Disabled'. + */ + @JsonProperty(value = "properties.readScale") + private ReadScale readScale; + + /** + * Indicates the name of the sample schema to apply when creating this + * database. If createMode is not Default, this value is ignored. Not + * supported for DataWarehouse edition. Possible values include: + * 'AdventureWorksLT'. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /** + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * Get kind of database. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get the collation of the database. If createMode is not Default, this value is ignored. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation of the database. If createMode is not Default, this value is ignored. + * + * @param collation the collation value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the containment state of the database. + * + * @return the containmentState value + */ + public Long containmentState() { + return this.containmentState; + } + + /** + * Get the current service level objective ID of the database. This is the ID of the service level objective that is currently active. + * + * @return the currentServiceObjectiveId value + */ + public UUID currentServiceObjectiveId() { + return this.currentServiceObjectiveId; + } + + /** + * Get the ID of the database. + * + * @return the databaseId value + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get this records the earliest start date and time that restore is available for this database (ISO8601 format). + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + OnlineSecondary/NonReadableSecondary: creates a database as a (readable or nonreadable) secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, NonReadableSecondary, OnlineSecondary and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Copy', 'Default', 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup'. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + OnlineSecondary/NonReadableSecondary: creates a database as a (readable or nonreadable) secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, NonReadableSecondary, OnlineSecondary and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Copy', 'Default', 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup'. + * + * @param createMode the createMode value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get conditional. If createMode is Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this value is required. Specifies the resource ID of the source database. If createMode is NonReadableSecondary or OnlineSecondary, the name of the source database must be the same as the new database being created. + * + * @return the sourceDatabaseId value + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set conditional. If createMode is Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this value is required. Specifies the resource ID of the source database. If createMode is NonReadableSecondary or OnlineSecondary, the name of the source database must be the same as the new database being created. + * + * @param sourceDatabaseId the sourceDatabaseId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get conditional. If createMode is Restore and sourceDatabaseId is the deleted database's original resource id when it existed (as opposed to its current restorable dropped database id), then this value is required. Specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value + */ + public DateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set conditional. If createMode is Restore and sourceDatabaseId is the deleted database's original resource id when it existed (as opposed to its current restorable dropped database id), then this value is required. Specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get conditional. If createMode is PointInTimeRestore, this value is required. If createMode is Restore, this value is optional. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. Must be greater than or equal to the source database's earliestRestoreDate value. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set conditional. If createMode is PointInTimeRestore, this value is required. If createMode is Restore, this value is optional. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. Must be greater than or equal to the source database's earliestRestoreDate value. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. + * + * @return the recoveryServicesRecoveryPointResourceId value + */ + public String recoveryServicesRecoveryPointResourceId() { + return this.recoveryServicesRecoveryPointResourceId; + } + + /** + * Set conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. + * + * @param recoveryServicesRecoveryPointResourceId the recoveryServicesRecoveryPointResourceId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRecoveryServicesRecoveryPointResourceId(String recoveryServicesRecoveryPointResourceId) { + this.recoveryServicesRecoveryPointResourceId = recoveryServicesRecoveryPointResourceId; + return this; + } + + /** + * Get the edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions -l westus --query [].name`. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * + * @return the edition value + */ + public DatabaseEdition edition() { + return this.edition; + } + + /** + * Set the edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions -l westus --query [].name`. Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2'. + * + * @param edition the edition value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withEdition(DatabaseEdition edition) { + this.edition = edition; + return this; + } + + /** + * Get the max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation.". + * + * @return the maxSizeBytes value + */ + public String maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation.". + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withMaxSizeBytes(String maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name` . + * + * @return the requestedServiceObjectiveId value + */ + public UUID requestedServiceObjectiveId() { + return this.requestedServiceObjectiveId; + } + + /** + * Set the configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name` . + * + * @param requestedServiceObjectiveId the requestedServiceObjectiveId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRequestedServiceObjectiveId(UUID requestedServiceObjectiveId) { + this.requestedServiceObjectiveId = requestedServiceObjectiveId; + return this; + } + + /** + * Get the name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name`. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @return the requestedServiceObjectiveName value + */ + public ServiceObjectiveName requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Set the name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI command `az sql db list-editions --location <location> --query [].supportedServiceLevelObjectives[].name`. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @param requestedServiceObjectiveName the requestedServiceObjectiveName value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRequestedServiceObjectiveName(ServiceObjectiveName requestedServiceObjectiveName) { + this.requestedServiceObjectiveName = requestedServiceObjectiveName; + return this; + } + + /** + * Get the current service level objective of the database. Possible values include: 'System', 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + * + * @return the serviceLevelObjective value + */ + public ServiceObjectiveName serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the status of the database. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Set the name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. + * + * @param elasticPoolName the elasticPoolName value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withElasticPoolName(String elasticPoolName) { + this.elasticPoolName = elasticPoolName; + return this; + } + + /** + * Get the default secondary region for this database. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the list of service tier advisors for this database. Expanded property. + * + * @return the serviceTierAdvisors value + */ + public List serviceTierAdvisors() { + return this.serviceTierAdvisors; + } + + /** + * Get the transparent data encryption info for this database. + * + * @return the transparentDataEncryption value + */ + public List transparentDataEncryption() { + return this.transparentDataEncryption; + } + + /** + * Get the recommended indices for this database. + * + * @return the recommendedIndex value + */ + public List recommendedIndex() { + return this.recommendedIndex; + } + + /** + * Get the resource identifier of the failover group containing this database. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. Possible values include: 'Enabled', 'Disabled'. + * + * @return the readScale value + */ + public ReadScale readScale() { + return this.readScale; + } + + /** + * Set conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. Possible values include: 'Enabled', 'Disabled'. + * + * @param readScale the readScale value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withReadScale(ReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get indicates the name of the sample schema to apply when creating this database. If createMode is not Default, this value is ignored. Not supported for DataWarehouse edition. Possible values include: 'AdventureWorksLT'. + * + * @return the sampleName value + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set indicates the name of the sample schema to apply when creating this database. If createMode is not Default, this value is ignored. Not supported for DataWarehouse edition. Possible values include: 'AdventureWorksLT'. + * + * @param sampleName the sampleName value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..04b53bf0bcdee --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyImpl.java @@ -0,0 +1,202 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseSecurityAlertPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.SecurityAlertPolicyState; +import com.microsoft.azure.management.sql.v2014_04_01.SecurityAlertPolicyEmailAccountAdmins; +import com.microsoft.azure.management.sql.v2014_04_01.SecurityAlertPolicyUseServerDefault; + +class DatabaseSecurityAlertPolicyImpl extends CreatableUpdatableImpl implements DatabaseSecurityAlertPolicy, DatabaseSecurityAlertPolicy.Definition, DatabaseSecurityAlertPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + DatabaseSecurityAlertPolicyImpl(String name, SqlManager manager) { + super(name, new DatabaseSecurityAlertPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + DatabaseSecurityAlertPolicyImpl(DatabaseSecurityAlertPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabaseThreatDetectionPoliciesInner client = this.manager().inner().databaseThreatDetectionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseThreatDetectionPoliciesInner client = this.manager().inner().databaseThreatDetectionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseThreatDetectionPoliciesInner client = this.manager().inner().databaseThreatDetectionPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String disabledAlerts() { + return this.inner().disabledAlerts(); + } + + @Override + public SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins() { + return this.inner().emailAccountAdmins(); + } + + @Override + public String emailAddresses() { + return this.inner().emailAddresses(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @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 SecurityAlertPolicyUseServerDefault useServerDefault() { + return this.inner().useServerDefault(); + } + + @Override + public DatabaseSecurityAlertPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.inner().withState(state); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withDisabledAlerts(String disabledAlerts) { + this.inner().withDisabledAlerts(disabledAlerts); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withEmailAccountAdmins(SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins) { + this.inner().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withEmailAddresses(String emailAddresses) { + this.inner().withEmailAddresses(emailAddresses); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.inner().withRetentionDays(retentionDays); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.inner().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.inner().withStorageEndpoint(storageEndpoint); + return this; + } + + @Override + public DatabaseSecurityAlertPolicyImpl withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault) { + this.inner().withUseServerDefault(useServerDefault); + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..7a528d7a582eb --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseSecurityAlertPolicyInner.java @@ -0,0 +1,283 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.SecurityAlertPolicyState; +import com.microsoft.azure.management.sql.v2014_04_01.SecurityAlertPolicyEmailAccountAdmins; +import com.microsoft.azure.management.sql.v2014_04_01.SecurityAlertPolicyUseServerDefault; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Contains information about a database Threat Detection policy. + */ +@JsonFlatten +public class DatabaseSecurityAlertPolicyInner extends ProxyResource { + /** + * The geo-location where the resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Specifies the state of the policy. If state is Enabled, storageEndpoint + * and storageAccountAccessKey are required. Possible values include: + * 'New', 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.state", required = true) + private SecurityAlertPolicyState state; + + /** + * Specifies the semicolon-separated list of alerts that are disabled, or + * empty string to disable no alerts. Possible values: Sql_Injection; + * Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. + */ + @JsonProperty(value = "properties.disabledAlerts") + private String disabledAlerts; + + /** + * Specifies the semicolon-separated list of e-mail addresses to which the + * alert is sent. + */ + @JsonProperty(value = "properties.emailAddresses") + private String emailAddresses; + + /** + * Specifies that the alert is sent to the account administrators. Possible + * values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.emailAccountAdmins") + private SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins; + + /** + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. If state is Enabled, storageEndpoint is + * required. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /** + * Specifies the identifier key of the Threat Detection audit storage + * account. If state is Enabled, storageAccountAccessKey is required. + */ + @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 whether to use the default server policy. Possible values + * include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.useServerDefault") + private SecurityAlertPolicyUseServerDefault useServerDefault; + + /** + * Get the geo-location where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the geo-location where the resource lives. + * + * @param location the location value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get resource kind. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @return the state value + */ + public SecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. Possible values include: 'New', 'Enabled', 'Disabled'. + * + * @param state the state value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withState(SecurityAlertPolicyState state) { + this.state = state; + return this; + } + + /** + * Get specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. + * + * @return the disabledAlerts value + */ + public String disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. + * + * @param disabledAlerts the disabledAlerts value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withDisabledAlerts(String disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get specifies the semicolon-separated list of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value + */ + public String emailAddresses() { + return this.emailAddresses; + } + + /** + * Set specifies the semicolon-separated list of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withEmailAddresses(String emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get specifies that the alert is sent to the account administrators. Possible values include: 'Enabled', 'Disabled'. + * + * @return the emailAccountAdmins value + */ + public SecurityAlertPolicyEmailAccountAdmins emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set specifies that the alert is sent to the account administrators. Possible values include: 'Enabled', 'Disabled'. + * + * @param emailAccountAdmins the emailAccountAdmins value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withEmailAccountAdmins(SecurityAlertPolicyEmailAccountAdmins 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. If state is Enabled, storageEndpoint is required. + * + * @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. If state is Enabled, storageEndpoint is required. + * + * @param storageEndpoint the storageEndpoint value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get specifies the identifier key of the Threat Detection audit storage account. If state is Enabled, storageAccountAccessKey is required. + * + * @return the storageAccountAccessKey value + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set specifies the identifier key of the Threat Detection audit storage account. If state is Enabled, storageAccountAccessKey is required. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner 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 DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get specifies whether to use the default server policy. Possible values include: 'Enabled', 'Disabled'. + * + * @return the useServerDefault value + */ + public SecurityAlertPolicyUseServerDefault useServerDefault() { + return this.useServerDefault; + } + + /** + * Set specifies whether to use the default server policy. Possible values include: 'Enabled', 'Disabled'. + * + * @param useServerDefault the useServerDefault value to set + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withUseServerDefault(SecurityAlertPolicyUseServerDefault useServerDefault) { + this.useServerDefault = useServerDefault; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesImpl.java new file mode 100644 index 0000000000000..0fcf96b45a379 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesImpl.java @@ -0,0 +1,55 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseThreatDetectionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseSecurityAlertPolicy; + +class DatabaseThreatDetectionPoliciesImpl extends WrapperImpl implements DatabaseThreatDetectionPolicies { + private final SqlManager manager; + + DatabaseThreatDetectionPoliciesImpl(SqlManager manager) { + super(manager.inner().databaseThreatDetectionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseSecurityAlertPolicyImpl define(String name) { + return wrapModel(name); + } + + private DatabaseSecurityAlertPolicyImpl wrapModel(DatabaseSecurityAlertPolicyInner inner) { + return new DatabaseSecurityAlertPolicyImpl(inner, manager()); + } + + private DatabaseSecurityAlertPolicyImpl wrapModel(String name) { + return new DatabaseSecurityAlertPolicyImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabaseThreatDetectionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public DatabaseSecurityAlertPolicy call(DatabaseSecurityAlertPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesInner.java new file mode 100644 index 0000000000000..75e528ee51d35 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesInner.java @@ -0,0 +1,264 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseThreatDetectionPolicies. + */ +public class DatabaseThreatDetectionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseThreatDetectionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseThreatDetectionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseThreatDetectionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseThreatDetectionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseThreatDetectionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseThreatDetectionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.DatabaseThreatDetectionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @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.v2014_04_01.DatabaseThreatDetectionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("securityAlertPolicyName") String securityAlertPolicyName, @Body DatabaseSecurityAlertPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database'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 serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection 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 DatabaseSecurityAlertPolicyInner object if successful. + */ + public DatabaseSecurityAlertPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database'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 serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection 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 serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a database'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 serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseSecurityAlertPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseSecurityAlertPolicyInner>() { + @Override + public DatabaseSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database'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 serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseSecurityAlertPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + 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.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String securityAlertPolicyName = "default"; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, securityAlertPolicyName, 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 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 serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param parameters The database Threat Detection 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 DatabaseSecurityAlertPolicyInner object if successful. + */ + public DatabaseSecurityAlertPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database'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 serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param parameters The database Threat Detection 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 serverName, String databaseName, DatabaseSecurityAlertPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database'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 serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param parameters The database Threat Detection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseSecurityAlertPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseSecurityAlertPolicyInner>() { + @Override + public DatabaseSecurityAlertPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database'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 serverName The name of the server. + * @param databaseName The name of the database for which database Threat Detection policy is defined. + * @param parameters The database Threat Detection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseSecurityAlertPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseSecurityAlertPolicyInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, securityAlertPolicyName, 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesImpl.java new file mode 100644 index 0000000000000..a1e17953b8ea5 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesImpl.java @@ -0,0 +1,193 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.Databases; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.Database; +import com.microsoft.azure.management.sql.v2014_04_01.ImportExportResponse; +import com.microsoft.azure.management.sql.v2014_04_01.ExportRequest; +import com.microsoft.azure.management.sql.v2014_04_01.ImportRequest; + +class DatabasesImpl extends WrapperImpl implements Databases { + private final SqlManager manager; + + DatabasesImpl(SqlManager manager) { + super(manager.inner().databases()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseImpl define(String name) { + return wrapModel(name); + } + + private DatabaseImpl wrapModel(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + + private DatabaseImpl wrapModel(String name) { + return new DatabaseImpl(name, this.manager()); + } + + @Override + public Completable pauseAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.pauseAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + + @Override + public Completable resumeAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.resumeAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + + @Override + public Observable getByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, String databaseName) { + DatabasesInner client = this.inner(); + return client.getByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + DatabasesInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName) { + DatabasesInner client = this.inner(); + return client.getByRecommendedElasticPoolAsync(resourceGroupName, serverName, recommendedElasticPoolName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + DatabasesInner client = this.inner(); + return client.listByRecommendedElasticPoolAsync(resourceGroupName, serverName, recommendedElasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + DatabasesInner client = this.inner(); + return client.exportAsync(resourceGroupName, serverName, databaseName, parameters) + .map(new Func1() { + @Override + public ImportExportResponse call(ImportExportResponseInner inner) { + return new ImportExportResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + DatabasesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + + @Override + public ImportExportResponseImpl defineExtension(String name) { + return wrapExtensionModel(name); + } + + private ImportExportResponseImpl wrapExtensionModel(String name) { + return new ImportExportResponseImpl(name, this.manager()); + } + + private ImportExportResponseImpl wrapImportExportResponseModel(ImportExportResponseInner inner) { + return new ImportExportResponseImpl(inner, manager()); + } + + @Override + public Observable importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters) { + DatabasesInner client = this.inner(); + return client.importMethodAsync(resourceGroupName, serverName, parameters) + .map(new Func1() { + @Override + public ImportExportResponse call(ImportExportResponseInner inner) { + return new ImportExportResponseImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java new file mode 100644 index 0000000000000..d1ccf2cecc619 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java @@ -0,0 +1,2264 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseUpdate; +import com.microsoft.azure.management.sql.v2014_04_01.ExportRequest; +import com.microsoft.azure.management.sql.v2014_04_01.ImportExtensionRequest; +import com.microsoft.azure.management.sql.v2014_04_01.ImportRequest; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Databases. + */ +public class DatabasesInner { + /** The Retrofit service to perform REST calls. */ + private DatabasesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabasesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Databases to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Databases pause" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause") + Observable> pause(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Databases beginPause" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause") + Observable> beginPause(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Databases resume" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume") + Observable> resume(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Databases beginResume" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume") + Observable> beginResume(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Databases createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body DatabaseInner parameters, @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.v2014_04_01.Databases beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body DatabaseInner parameters, @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.v2014_04_01.Databases update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body DatabaseUpdate parameters, @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.v2014_04_01.Databases beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body DatabaseUpdate parameters, @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.v2014_04_01.Databases delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Databases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @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.v2014_04_01.Databases listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases") + Observable> listByServer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @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.v2014_04_01.Databases getByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases/{databaseName}") + Observable> getByElasticPool(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Databases listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases") + Observable> listByElasticPool(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Databases getByRecommendedElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases/{databaseName}") + Observable> getByRecommendedElasticPool(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("recommendedElasticPoolName") String recommendedElasticPoolName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Databases listByRecommendedElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases") + Observable> listByRecommendedElasticPool(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("recommendedElasticPoolName") String recommendedElasticPoolName, @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.v2014_04_01.Databases importMethod" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import") + Observable> importMethod(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ImportRequest parameters, @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.v2014_04_01.Databases beginImportMethod" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import") + Observable> beginImportMethod(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ImportRequest parameters, @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.v2014_04_01.Databases createImportOperation" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}") + Observable> createImportOperation(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("extensionName") String extensionName, @Query("api-version") String apiVersion, @Body ImportExtensionRequest parameters, @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.v2014_04_01.Databases beginCreateImportOperation" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}") + Observable> beginCreateImportOperation(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("extensionName") String extensionName, @Query("api-version") String apiVersion, @Body ImportExtensionRequest parameters, @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.v2014_04_01.Databases export" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export") + Observable> export(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ExportRequest parameters, @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.v2014_04_01.Databases beginExport" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export") + Observable> beginExport(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ExportRequest parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @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 pause(String resourceGroupName, String serverName, String databaseName) { + pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @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 pauseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable pauseAsync(String resourceGroupName, String serverName, String databaseName) { + return pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> pauseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.pause(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @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 beginPause(String resourceGroupName, String serverName, String databaseName) { + beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @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 beginPauseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginPauseAsync(String resourceGroupName, String serverName, String databaseName) { + return beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Pauses a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to pause. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginPauseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginPause(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginPauseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginPauseDelegate(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); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @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 resume(String resourceGroupName, String serverName, String databaseName) { + resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @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 resumeAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable resumeAsync(String resourceGroupName, String serverName, String databaseName) { + return resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> resumeWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.resume(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @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 beginResume(String resourceGroupName, String serverName, String databaseName) { + beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @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 beginResumeAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginResumeAsync(String resourceGroupName, String serverName, String databaseName) { + return beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Resumes a data warehouse. + * + * @param resourceGroupName The 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 data warehouse to resume. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginResumeWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginResume(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginResumeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginResumeDelegate(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); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a 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 DatabaseInner object if successful. + */ + public DatabaseInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a 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 createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a 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 DatabaseInner object if successful. + */ + public DatabaseInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be operated on (updated or created). + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a 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 DatabaseInner object if successful. + */ + public DatabaseInner update(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a 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 updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a 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 DatabaseInner object if successful. + */ + public DatabaseInner beginUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a 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 beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to be updated. + * @param parameters The required parameters for updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes 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 serverName The name of the server. + * @param databaseName The name of the database to be 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 + */ + public void delete(String resourceGroupName, String serverName, String databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Deletes 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 serverName The name of the server. + * @param databaseName The name of the database to be 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 deleteAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Deletes 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 serverName The name of the server. + * @param databaseName The name of the database to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes 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 serverName The name of the server. + * @param databaseName The name of the database to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the database to be retrieved. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the database to be retrieved. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a database. + * + * @param resourceGroupName The 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 to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the database to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + 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.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), expand, 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); + } + } + }); + } + + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the database to be retrieved. + * @param expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner get(String resourceGroupName, String serverName, String databaseName, String expand) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, expand).toBlocking().single().body(); + } + + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the database to be retrieved. + * @param expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @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 expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, expand), serviceCallback); + } + + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the database to be retrieved. + * @param expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String expand) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, expand).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the database to be retrieved. + * @param expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String expand) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), expand, 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); + } + + /** + * Returns a list of databases in a 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 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 List<DatabaseInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns a list of databases in a 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 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns a list of databases in a 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of databases in a 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(String resourceGroupName, String serverName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + final String filter = null; + return service.listByServer(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Returns a list of databases in a 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 serverName The name of the server. + * @param expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @param filter An OData filter expression that describes a subset of databases to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<DatabaseInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName, String expand, String filter) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName, expand, filter).toBlocking().single().body(); + } + + /** + * Returns a list of databases in a 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 serverName The name of the server. + * @param expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @param filter An OData filter expression that describes a subset of databases to return. + * @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(String resourceGroupName, String serverName, String expand, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName, expand, filter), serviceCallback); + } + + /** + * Returns a list of databases in a 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 serverName The name of the server. + * @param expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @param filter An OData filter expression that describes a subset of databases to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName, String expand, String filter) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName, expand, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of databases in a 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 serverName The name of the server. + * @param expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption. + * @param filter An OData filter expression that describes a subset of databases to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(String resourceGroupName, String serverName, String expand, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByServer(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + + /** + * Gets a database inside of an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database to be retrieved. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner getByElasticPool(String resourceGroupName, String serverName, String elasticPoolName, String databaseName) { + return getByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database inside of an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database to be retrieved. + * @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 getByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, databaseName), serviceCallback); + } + + /** + * Gets a database inside of an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable getByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, String databaseName) { + return getByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database inside of an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> getByElasticPoolWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, String databaseName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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.getByElasticPool(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByElasticPoolDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByElasticPoolDelegate(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); + } + + /** + * Returns a list of databases in an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<DatabaseInner> object if successful. + */ + public List listByElasticPool(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Returns a list of databases in an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @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> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Returns a list of databases in an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of databases in an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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.listByElasticPool(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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 database inside of a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database to be retrieved. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner getByRecommendedElasticPool(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName) { + return getByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database inside of a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database to be retrieved. + * @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 getByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName, databaseName), serviceCallback); + } + + /** + * Gets a database inside of a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable getByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName) { + return getByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database inside of a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the elastic pool to be retrieved. + * @param databaseName The name of the database to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> getByRecommendedElasticPoolWithServiceResponseAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (recommendedElasticPoolName == null) { + throw new IllegalArgumentException("Parameter recommendedElasticPoolName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName 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.getByRecommendedElasticPool(this.client.subscriptionId(), resourceGroupName, serverName, recommendedElasticPoolName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByRecommendedElasticPoolDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByRecommendedElasticPoolDelegate(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); + } + + /** + * Returns a list of databases inside a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<DatabaseInner> object if successful. + */ + public List listByRecommendedElasticPool(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return listByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).toBlocking().single().body(); + } + + /** + * Returns a list of databases inside a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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> listByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName), serviceCallback); + } + + /** + * Returns a list of databases inside a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable> listByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return listByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of databases inside a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable>> listByRecommendedElasticPoolWithServiceResponseAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (recommendedElasticPoolName == null) { + throw new IllegalArgumentException("Parameter recommendedElasticPoolName 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.listByRecommendedElasticPool(this.client.subscriptionId(), resourceGroupName, serverName, recommendedElasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByRecommendedElasticPoolDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByRecommendedElasticPoolDelegate(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); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner importMethod(String resourceGroupName, String serverName, ImportRequest parameters) { + return importMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a 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 importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(importMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters) { + return importMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> importMethodWithServiceResponseAsync(String resourceGroupName, String serverName, ImportRequest parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.importMethod(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner beginImportMethod(String resourceGroupName, String serverName, ImportRequest parameters) { + return beginImportMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a 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 beginImportMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginImportMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable beginImportMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters) { + return beginImportMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Imports a bacpac into a new 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 parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable> beginImportMethodWithServiceResponseAsync(String resourceGroupName, String serverName, ImportRequest parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginImportMethod(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginImportMethodDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginImportMethodDelegate(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); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 to import into + * @param parameters The required parameters for importing a Bacpac into a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner createImportOperation(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { + return createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 to import into + * @param parameters The required parameters for importing a Bacpac into a 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 createImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 to import into + * @param parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { + return createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 to import into + * @param parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createImportOperationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String extensionName = "import"; + Observable> observable = service.createImportOperation(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, extensionName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 to import into + * @param parameters The required parameters for importing a Bacpac into a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner beginCreateImportOperation(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { + return beginCreateImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 to import into + * @param parameters The required parameters for importing a Bacpac into a 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 beginCreateImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 to import into + * @param parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable beginCreateImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { + return beginCreateImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. + * + * @param resourceGroupName The 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 to import into + * @param parameters The required parameters for importing a Bacpac into a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable> beginCreateImportOperationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String extensionName = "import"; + return service.beginCreateImportOperation(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, extensionName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateImportOperationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateImportOperationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 to be exported. + * @param parameters The required parameters for exporting a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner export(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 to be exported. + * @param parameters The required parameters for exporting a 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 exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 to be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 to be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> exportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.export(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 to be exported. + * @param parameters The required parameters for exporting a 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 ImportExportResponseInner object if successful. + */ + public ImportExportResponseInner beginExport(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + return beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 to be exported. + * @param parameters The required parameters for exporting a 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 beginExportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 to be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable beginExportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + return beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { + @Override + public ImportExportResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports a database to a bacpac. + * + * @param resourceGroupName The 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 to be exported. + * @param parameters The required parameters for exporting a database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImportExportResponseInner object + */ + public Observable> beginExportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginExport(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginExportDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginExportDelegate(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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesImpl.java new file mode 100644 index 0000000000000..6d3add08855fb --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolActivities; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolActivity; + +class ElasticPoolActivitiesImpl extends WrapperImpl implements ElasticPoolActivities { + private final SqlManager manager; + + ElasticPoolActivitiesImpl(SqlManager manager) { + super(manager.inner().elasticPoolActivities()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolActivitiesInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ElasticPoolActivity call(ElasticPoolActivityInner inner) { + return new ElasticPoolActivityImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesInner.java new file mode 100644 index 0000000000000..423b827d66989 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesInner.java @@ -0,0 +1,159 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ElasticPoolActivities. + */ +public class ElasticPoolActivitiesInner { + /** The Retrofit service to perform REST calls. */ + private ElasticPoolActivitiesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolActivitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ElasticPoolActivitiesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ElasticPoolActivitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ElasticPoolActivities to be + * used by Retrofit to perform actually REST calls. + */ + interface ElasticPoolActivitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolActivities listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity") + Observable> listByElasticPool(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool for which to get the current activity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ElasticPoolActivityInner> object if successful. + */ + public List listByElasticPool(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool for which to get the current activity. + * @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> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool for which to get the current activity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ElasticPoolActivityInner> object + */ + public Observable> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns elastic pool activities. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool for which to get the current activity. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ElasticPoolActivityInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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.listByElasticPool(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivityImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivityImpl.java new file mode 100644 index 0000000000000..6b10ff2146ec3 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivityImpl.java @@ -0,0 +1,148 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolActivity; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; +import java.util.UUID; + +class ElasticPoolActivityImpl extends WrapperImpl implements ElasticPoolActivity { + private final SqlManager manager; + ElasticPoolActivityImpl(ElasticPoolActivityInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String elasticPoolName() { + return this.inner().elasticPoolName(); + } + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public Integer errorCode() { + return this.inner().errorCode(); + } + + @Override + public String errorMessage() { + return this.inner().errorMessage(); + } + + @Override + public Integer errorSeverity() { + return this.inner().errorSeverity(); + } + + @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 String operation() { + return this.inner().operation(); + } + + @Override + public UUID operationId() { + return this.inner().operationId(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public Integer requestedDatabaseDtuCap() { + return this.inner().requestedDatabaseDtuCap(); + } + + @Override + public Integer requestedDatabaseDtuGuarantee() { + return this.inner().requestedDatabaseDtuGuarantee(); + } + + @Override + public Integer requestedDatabaseDtuMax() { + return this.inner().requestedDatabaseDtuMax(); + } + + @Override + public Integer requestedDatabaseDtuMin() { + return this.inner().requestedDatabaseDtuMin(); + } + + @Override + public Integer requestedDtu() { + return this.inner().requestedDtu(); + } + + @Override + public Integer requestedDtuGuarantee() { + return this.inner().requestedDtuGuarantee(); + } + + @Override + public String requestedElasticPoolName() { + return this.inner().requestedElasticPoolName(); + } + + @Override + public Long requestedStorageLimitInGB() { + return this.inner().requestedStorageLimitInGB(); + } + + @Override + public Integer requestedStorageLimitInMB() { + return this.inner().requestedStorageLimitInMB(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivityInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivityInner.java new file mode 100644 index 0000000000000..709126b0b4b7a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivityInner.java @@ -0,0 +1,348 @@ +/** + * 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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents the activity on an elastic pool. + */ +@JsonFlatten +public class ElasticPoolActivityInner extends ProxyResource { + /** + * The geo-location where the resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The time the operation finished (ISO8601 format). + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The error code if available. + */ + @JsonProperty(value = "properties.errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /** + * The error message if available. + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * The error severity if available. + */ + @JsonProperty(value = "properties.errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /** + * The operation name. + */ + @JsonProperty(value = "properties.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The unique operation ID. + */ + @JsonProperty(value = "properties.operationId", access = JsonProperty.Access.WRITE_ONLY) + private UUID operationId; + + /** + * The percentage complete if available. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /** + * The requested max DTU per database if available. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuMax", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuMax; + + /** + * The requested min DTU per database if available. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuMin", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuMin; + + /** + * The requested DTU for the pool if available. + */ + @JsonProperty(value = "properties.requestedDtu", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDtu; + + /** + * The requested name for the elastic pool if available. + */ + @JsonProperty(value = "properties.requestedElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedElasticPoolName; + + /** + * The requested storage limit for the pool in GB if available. + */ + @JsonProperty(value = "properties.requestedStorageLimitInGB", access = JsonProperty.Access.WRITE_ONLY) + private Long requestedStorageLimitInGB; + + /** + * The name of the elastic pool. + */ + @JsonProperty(value = "properties.elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /** + * The name of the server the elastic pool is in. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The time the operation started (ISO8601 format). + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The current state of the operation. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The requested storage limit in MB. + */ + @JsonProperty(value = "properties.requestedStorageLimitInMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedStorageLimitInMB; + + /** + * The requested per database DTU guarantee. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuGuarantee", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuGuarantee; + + /** + * The requested per database DTU cap. + */ + @JsonProperty(value = "properties.requestedDatabaseDtuCap", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuCap; + + /** + * The requested DTU guarantee. + */ + @JsonProperty(value = "properties.requestedDtuGuarantee", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDtuGuarantee; + + /** + * Get the geo-location where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the geo-location where the resource lives. + * + * @param location the location value to set + * @return the ElasticPoolActivityInner object itself. + */ + public ElasticPoolActivityInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the time the operation finished (ISO8601 format). + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the error code if available. + * + * @return the errorCode value + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the error message if available. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the error severity if available. + * + * @return the errorSeverity value + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the operation name. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the unique operation ID. + * + * @return the operationId value + */ + public UUID operationId() { + return this.operationId; + } + + /** + * Get the percentage complete if available. + * + * @return the percentComplete value + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the requested max DTU per database if available. + * + * @return the requestedDatabaseDtuMax value + */ + public Integer requestedDatabaseDtuMax() { + return this.requestedDatabaseDtuMax; + } + + /** + * Get the requested min DTU per database if available. + * + * @return the requestedDatabaseDtuMin value + */ + public Integer requestedDatabaseDtuMin() { + return this.requestedDatabaseDtuMin; + } + + /** + * Get the requested DTU for the pool if available. + * + * @return the requestedDtu value + */ + public Integer requestedDtu() { + return this.requestedDtu; + } + + /** + * Get the requested name for the elastic pool if available. + * + * @return the requestedElasticPoolName value + */ + public String requestedElasticPoolName() { + return this.requestedElasticPoolName; + } + + /** + * Get the requested storage limit for the pool in GB if available. + * + * @return the requestedStorageLimitInGB value + */ + public Long requestedStorageLimitInGB() { + return this.requestedStorageLimitInGB; + } + + /** + * Get the name of the elastic pool. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the name of the server the elastic pool is in. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the time the operation started (ISO8601 format). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the current state of the operation. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the requested storage limit in MB. + * + * @return the requestedStorageLimitInMB value + */ + public Integer requestedStorageLimitInMB() { + return this.requestedStorageLimitInMB; + } + + /** + * Get the requested per database DTU guarantee. + * + * @return the requestedDatabaseDtuGuarantee value + */ + public Integer requestedDatabaseDtuGuarantee() { + return this.requestedDatabaseDtuGuarantee; + } + + /** + * Get the requested per database DTU cap. + * + * @return the requestedDatabaseDtuCap value + */ + public Integer requestedDatabaseDtuCap() { + return this.requestedDatabaseDtuCap; + } + + /** + * Get the requested DTU guarantee. + * + * @return the requestedDtuGuarantee value + */ + public Integer requestedDtuGuarantee() { + return this.requestedDtuGuarantee; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivitiesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivitiesImpl.java new file mode 100644 index 0000000000000..a26dd566926c5 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivitiesImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolDatabaseActivities; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolDatabaseActivity; + +class ElasticPoolDatabaseActivitiesImpl extends WrapperImpl implements ElasticPoolDatabaseActivities { + private final SqlManager manager; + + ElasticPoolDatabaseActivitiesImpl(SqlManager manager) { + super(manager.inner().elasticPoolDatabaseActivities()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolDatabaseActivitiesInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ElasticPoolDatabaseActivity call(ElasticPoolDatabaseActivityInner inner) { + return new ElasticPoolDatabaseActivityImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivitiesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivitiesInner.java new file mode 100644 index 0000000000000..b307d0ef72cd5 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivitiesInner.java @@ -0,0 +1,159 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ElasticPoolDatabaseActivities. + */ +public class ElasticPoolDatabaseActivitiesInner { + /** The Retrofit service to perform REST calls. */ + private ElasticPoolDatabaseActivitiesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolDatabaseActivitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ElasticPoolDatabaseActivitiesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ElasticPoolDatabaseActivitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ElasticPoolDatabaseActivities to be + * used by Retrofit to perform actually REST calls. + */ + interface ElasticPoolDatabaseActivitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolDatabaseActivities listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity") + Observable> listByElasticPool(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ElasticPoolDatabaseActivityInner> object if successful. + */ + public List listByElasticPool(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @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> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ElasticPoolDatabaseActivityInner> object + */ + public Observable> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns activity on databases inside of an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ElasticPoolDatabaseActivityInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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.listByElasticPool(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivityImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivityImpl.java new file mode 100644 index 0000000000000..9a04cf4216fd4 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivityImpl.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolDatabaseActivity; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; +import java.util.UUID; + +class ElasticPoolDatabaseActivityImpl extends WrapperImpl implements ElasticPoolDatabaseActivity { + private final SqlManager manager; + ElasticPoolDatabaseActivityImpl(ElasticPoolDatabaseActivityInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String currentElasticPoolName() { + return this.inner().currentElasticPoolName(); + } + + @Override + public String currentServiceObjective() { + return this.inner().currentServiceObjective(); + } + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public Integer errorCode() { + return this.inner().errorCode(); + } + + @Override + public String errorMessage() { + return this.inner().errorMessage(); + } + + @Override + public Integer errorSeverity() { + return this.inner().errorSeverity(); + } + + @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 String operation() { + return this.inner().operation(); + } + + @Override + public UUID operationId() { + return this.inner().operationId(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public String requestedElasticPoolName() { + return this.inner().requestedElasticPoolName(); + } + + @Override + public String requestedServiceObjective() { + return this.inner().requestedServiceObjective(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivityInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivityInner.java new file mode 100644 index 0000000000000..3ee41a2e29970 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolDatabaseActivityInner.java @@ -0,0 +1,273 @@ +/** + * 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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents the activity on an elastic pool. + */ +@JsonFlatten +public class ElasticPoolDatabaseActivityInner extends ProxyResource { + /** + * The geo-location where the resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The database name. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * The time the operation finished (ISO8601 format). + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The error code if available. + */ + @JsonProperty(value = "properties.errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /** + * The error message if available. + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * The error severity if available. + */ + @JsonProperty(value = "properties.errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /** + * The operation name. + */ + @JsonProperty(value = "properties.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The unique operation ID. + */ + @JsonProperty(value = "properties.operationId", access = JsonProperty.Access.WRITE_ONLY) + private UUID operationId; + + /** + * The percentage complete if available. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /** + * The name for the elastic pool the database is moving into if available. + */ + @JsonProperty(value = "properties.requestedElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedElasticPoolName; + + /** + * The name of the current elastic pool the database is in if available. + */ + @JsonProperty(value = "properties.currentElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String currentElasticPoolName; + + /** + * The name of the current service objective if available. + */ + @JsonProperty(value = "properties.currentServiceObjective", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjective; + + /** + * The name of the requested service objective if available. + */ + @JsonProperty(value = "properties.requestedServiceObjective", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjective; + + /** + * The name of the server the elastic pool is in. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The time the operation started (ISO8601 format). + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The current state of the operation. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * Get the geo-location where the resource lives. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the geo-location where the resource lives. + * + * @param location the location value to set + * @return the ElasticPoolDatabaseActivityInner object itself. + */ + public ElasticPoolDatabaseActivityInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the database name. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the time the operation finished (ISO8601 format). + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the error code if available. + * + * @return the errorCode value + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the error message if available. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the error severity if available. + * + * @return the errorSeverity value + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the operation name. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the unique operation ID. + * + * @return the operationId value + */ + public UUID operationId() { + return this.operationId; + } + + /** + * Get the percentage complete if available. + * + * @return the percentComplete value + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the name for the elastic pool the database is moving into if available. + * + * @return the requestedElasticPoolName value + */ + public String requestedElasticPoolName() { + return this.requestedElasticPoolName; + } + + /** + * Get the name of the current elastic pool the database is in if available. + * + * @return the currentElasticPoolName value + */ + public String currentElasticPoolName() { + return this.currentElasticPoolName; + } + + /** + * Get the name of the current service objective if available. + * + * @return the currentServiceObjective value + */ + public String currentServiceObjective() { + return this.currentServiceObjective; + } + + /** + * Get the name of the requested service objective if available. + * + * @return the requestedServiceObjective value + */ + public String requestedServiceObjective() { + return this.requestedServiceObjective; + } + + /** + * Get the name of the server the elastic pool is in. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the time the operation started (ISO8601 format). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the current state of the operation. + * + * @return the state value + */ + public String state() { + return this.state; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolImpl.java new file mode 100644 index 0000000000000..559f0e2c34749 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolImpl.java @@ -0,0 +1,251 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPool; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolUpdate; +import java.util.Map; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolState; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolEdition; +import rx.functions.Func1; + +class ElasticPoolImpl extends CreatableUpdatableImpl implements ElasticPool, ElasticPool.Definition, ElasticPool.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String elasticPoolName; + private ElasticPoolUpdate updateParameter; + + ElasticPoolImpl(String name, SqlManager manager) { + super(name, new ElasticPoolInner()); + this.manager = manager; + // Set resource name + this.elasticPoolName = name; + // + this.updateParameter = new ElasticPoolUpdate(); + } + + ElasticPoolImpl(ElasticPoolInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.elasticPoolName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.elasticPoolName = IdParsingUtils.getValueFromIdByName(inner.id(), "elasticPools"); + // + this.updateParameter = new ElasticPoolUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.elasticPoolName, this.inner()) + .map(new Func1() { + @Override + public ElasticPoolInner call(ElasticPoolInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.elasticPoolName, this.updateParameter) + .map(new Func1() { + @Override + public ElasticPoolInner call(ElasticPoolInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.getAsync(this.resourceGroupName, this.serverName, this.elasticPoolName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ElasticPoolUpdate(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public Integer databaseDtuMax() { + return this.inner().databaseDtuMax(); + } + + @Override + public Integer databaseDtuMin() { + return this.inner().databaseDtuMin(); + } + + @Override + public Integer dtu() { + return this.inner().dtu(); + } + + @Override + public ElasticPoolEdition edition() { + return this.inner().edition(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ElasticPoolState state() { + return this.inner().state(); + } + + @Override + public Integer storageMB() { + return this.inner().storageMB(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Boolean zoneRedundant() { + return this.inner().zoneRedundant(); + } + + @Override + public ElasticPoolImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ElasticPoolImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public ElasticPoolImpl withDatabaseDtuMax(Integer databaseDtuMax) { + if (isInCreateMode()) { + this.inner().withDatabaseDtuMax(databaseDtuMax); + } else { + this.updateParameter.withDatabaseDtuMax(databaseDtuMax); + } + return this; + } + + @Override + public ElasticPoolImpl withDatabaseDtuMin(Integer databaseDtuMin) { + if (isInCreateMode()) { + this.inner().withDatabaseDtuMin(databaseDtuMin); + } else { + this.updateParameter.withDatabaseDtuMin(databaseDtuMin); + } + return this; + } + + @Override + public ElasticPoolImpl withDtu(Integer dtu) { + if (isInCreateMode()) { + this.inner().withDtu(dtu); + } else { + this.updateParameter.withDtu(dtu); + } + return this; + } + + @Override + public ElasticPoolImpl withEdition(ElasticPoolEdition edition) { + if (isInCreateMode()) { + this.inner().withEdition(edition); + } else { + this.updateParameter.withEdition(edition); + } + return this; + } + + @Override + public ElasticPoolImpl withStorageMB(Integer storageMB) { + if (isInCreateMode()) { + this.inner().withStorageMB(storageMB); + } else { + this.updateParameter.withStorageMB(storageMB); + } + return this; + } + + @Override + public ElasticPoolImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public ElasticPoolImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.inner().withZoneRedundant(zoneRedundant); + } else { + this.updateParameter.withZoneRedundant(zoneRedundant); + } + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolInner.java new file mode 100644 index 0000000000000..a07689e4ff810 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolInner.java @@ -0,0 +1,229 @@ +/** + * 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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolState; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolEdition; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Represents a database elastic pool. + */ +@JsonFlatten +public class ElasticPoolInner extends Resource { + /** + * The creation date of the elastic pool (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The state of the elastic pool. Possible values include: 'Creating', + * 'Ready', 'Disabled'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ElasticPoolState state; + + /** + * The edition of the elastic pool. Possible values include: 'Basic', + * 'Standard', 'Premium'. + */ + @JsonProperty(value = "properties.edition") + private ElasticPoolEdition edition; + + /** + * The total shared DTU for the database elastic pool. + */ + @JsonProperty(value = "properties.dtu") + private Integer dtu; + + /** + * The maximum DTU any one database can consume. + */ + @JsonProperty(value = "properties.databaseDtuMax") + private Integer databaseDtuMax; + + /** + * The minimum DTU all databases are guaranteed. + */ + @JsonProperty(value = "properties.databaseDtuMin") + private Integer databaseDtuMin; + + /** + * Gets storage limit for the database elastic pool in MB. + */ + @JsonProperty(value = "properties.storageMB") + private Integer storageMB; + + /** + * Whether or not this database elastic pool is zone redundant, which means + * the replicas of this database will be spread across multiple + * availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * Kind of elastic pool. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Get the creation date of the elastic pool (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the state of the elastic pool. Possible values include: 'Creating', 'Ready', 'Disabled'. + * + * @return the state value + */ + public ElasticPoolState state() { + return this.state; + } + + /** + * Get the edition of the elastic pool. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @return the edition value + */ + public ElasticPoolEdition edition() { + return this.edition; + } + + /** + * Set the edition of the elastic pool. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @param edition the edition value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withEdition(ElasticPoolEdition edition) { + this.edition = edition; + return this; + } + + /** + * Get the total shared DTU for the database elastic pool. + * + * @return the dtu value + */ + public Integer dtu() { + return this.dtu; + } + + /** + * Set the total shared DTU for the database elastic pool. + * + * @param dtu the dtu value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withDtu(Integer dtu) { + this.dtu = dtu; + return this; + } + + /** + * Get the maximum DTU any one database can consume. + * + * @return the databaseDtuMax value + */ + public Integer databaseDtuMax() { + return this.databaseDtuMax; + } + + /** + * Set the maximum DTU any one database can consume. + * + * @param databaseDtuMax the databaseDtuMax value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withDatabaseDtuMax(Integer databaseDtuMax) { + this.databaseDtuMax = databaseDtuMax; + return this; + } + + /** + * Get the minimum DTU all databases are guaranteed. + * + * @return the databaseDtuMin value + */ + public Integer databaseDtuMin() { + return this.databaseDtuMin; + } + + /** + * Set the minimum DTU all databases are guaranteed. + * + * @param databaseDtuMin the databaseDtuMin value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withDatabaseDtuMin(Integer databaseDtuMin) { + this.databaseDtuMin = databaseDtuMin; + return this; + } + + /** + * Get gets storage limit for the database elastic pool in MB. + * + * @return the storageMB value + */ + public Integer storageMB() { + return this.storageMB; + } + + /** + * Set gets storage limit for the database elastic pool in MB. + * + * @param storageMB the storageMB value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withStorageMB(Integer storageMB) { + this.storageMB = storageMB; + return this; + } + + /** + * Get whether or not this database elastic pool is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database elastic pool is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get kind of elastic pool. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsImpl.java new file mode 100644 index 0000000000000..aea59fae7ed1c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPools; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPool; + +class ElasticPoolsImpl extends WrapperImpl implements ElasticPools { + private final SqlManager manager; + + ElasticPoolsImpl(SqlManager manager) { + super(manager.inner().elasticPools()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ElasticPoolImpl define(String name) { + return wrapModel(name); + } + + private ElasticPoolImpl wrapModel(ElasticPoolInner inner) { + return new ElasticPoolImpl(inner, manager()); + } + + private ElasticPoolImpl wrapModel(String name) { + return new ElasticPoolImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + ElasticPoolsInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ElasticPool call(ElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, elasticPoolName) + .map(new Func1() { + @Override + public ElasticPool call(ElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, elasticPoolName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java new file mode 100644 index 0000000000000..e4d2a1955e77c --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java @@ -0,0 +1,741 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolUpdate; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ElasticPools. + */ +public class ElasticPoolsInner { + /** The Retrofit service to perform REST calls. */ + private ElasticPoolsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ElasticPoolsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ElasticPoolsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ElasticPools to be + * used by Retrofit to perform actually REST calls. + */ + interface ElasticPoolsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ElasticPools createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Body ElasticPoolInner parameters, @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.v2014_04_01.ElasticPools beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Body ElasticPoolInner parameters, @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.v2014_04_01.ElasticPools update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Body ElasticPoolUpdate parameters, @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.v2014_04_01.ElasticPools beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Body ElasticPoolUpdate parameters, @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.v2014_04_01.ElasticPools delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ElasticPools get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ElasticPools listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools") + Observable> listByServer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates a new elastic pool or updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic pool. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner createOrUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().last().body(); + } + + /** + * Creates a new elastic pool or updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic pool. + * @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 elasticPoolName, ElasticPoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Creates a new elastic pool or updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new elastic pool or updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a new elastic pool or updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic pool. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner beginCreateOrUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body(); + } + + /** + * Creates a new elastic pool or updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic pool. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Creates a new elastic pool or updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new elastic pool or updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be operated on (updated or created). + * @param parameters The required parameters for creating or updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be updated. + * @param parameters The required parameters for updating an elastic pool. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner update(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().last().body(); + } + + /** + * Updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be updated. + * @param parameters The required parameters for updating an elastic pool. + * @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 serverName, String elasticPoolName, ElasticPoolUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be updated. + * @param parameters The required parameters for updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be updated. + * @param parameters The required parameters for updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be updated. + * @param parameters The required parameters for updating an elastic pool. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner beginUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be updated. + * @param parameters The required parameters for updating an elastic pool. + * @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 serverName, String elasticPoolName, ElasticPoolUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be updated. + * @param parameters The required parameters for updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be updated. + * @param parameters The required parameters for updating an elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be 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 + */ + public void delete(String resourceGroupName, String serverName, String elasticPoolName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Deletes the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be 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 deleteAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Deletes the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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.delete(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner get(String resourceGroupName, String serverName, String elasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @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 elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName 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(this.client.subscriptionId(), resourceGroupName, serverName, elasticPoolName, 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); + } + + /** + * Returns a list of elastic pools in a 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 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 List<ElasticPoolInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns a list of elastic pools in a 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 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns a list of elastic pools in a 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ElasticPoolInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of elastic pools in a 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ElasticPoolInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(String resourceGroupName, String serverName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByServer(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRuleImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRuleImpl.java new file mode 100644 index 0000000000000..65010f09c7ede --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRuleImpl.java @@ -0,0 +1,126 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.FirewallRule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class FirewallRuleImpl extends CreatableUpdatableImpl implements FirewallRule, FirewallRule.Definition, FirewallRule.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String firewallRuleName; + + FirewallRuleImpl(String name, SqlManager manager) { + super(name, new FirewallRuleInner()); + this.manager = manager; + // Set resource name + this.firewallRuleName = name; + // + } + + FirewallRuleImpl(FirewallRuleInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.firewallRuleName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.firewallRuleName = IdParsingUtils.getValueFromIdByName(inner.id(), "firewallRules"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + FirewallRulesInner client = this.manager().inner().firewallRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.firewallRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + FirewallRulesInner client = this.manager().inner().firewallRules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.firewallRuleName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + FirewallRulesInner client = this.manager().inner().firewallRules(); + return client.getAsync(this.resourceGroupName, this.serverName, this.firewallRuleName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String endIpAddress() { + return this.inner().endIpAddress(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String startIpAddress() { + return this.inner().startIpAddress(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public FirewallRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public FirewallRuleImpl withEndIpAddress(String endIpAddress) { + this.inner().withEndIpAddress(endIpAddress); + return this; + } + + @Override + public FirewallRuleImpl withStartIpAddress(String startIpAddress) { + this.inner().withStartIpAddress(startIpAddress); + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRuleInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRuleInner.java new file mode 100644 index 0000000000000..882909f48b09a --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRuleInner.java @@ -0,0 +1,105 @@ +/** + * 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.v2014_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a server firewall rule. + */ +@JsonFlatten +public class FirewallRuleInner extends ProxyResource { + /** + * Kind of server that contains this firewall rule. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Location of the server that contains this firewall rule. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The start IP address of the firewall rule. Must be IPv4 format. Use + * value '0.0.0.0' to represent all Azure-internal IP addresses. + */ + @JsonProperty(value = "properties.startIpAddress", required = true) + private String startIpAddress; + + /** + * The end IP address of the firewall rule. Must be IPv4 format. Must be + * greater than or equal to startIpAddress. Use value '0.0.0.0' to + * represent all Azure-internal IP addresses. + */ + @JsonProperty(value = "properties.endIpAddress", required = true) + private String endIpAddress; + + /** + * Get kind of server that contains this firewall rule. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get location of the server that contains this firewall rule. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @return the startIpAddress value + */ + public String startIpAddress() { + return this.startIpAddress; + } + + /** + * Set the start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @param startIpAddress the startIpAddress value to set + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withStartIpAddress(String startIpAddress) { + this.startIpAddress = startIpAddress; + return this; + } + + /** + * Get the end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @return the endIpAddress value + */ + public String endIpAddress() { + return this.endIpAddress; + } + + /** + * Set the end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * + * @param endIpAddress the endIpAddress value to set + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withEndIpAddress(String endIpAddress) { + this.endIpAddress = endIpAddress; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesImpl.java new file mode 100644 index 0000000000000..0ab505ff34941 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesImpl.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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.FirewallRules; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.FirewallRule; + +class FirewallRulesImpl extends WrapperImpl implements FirewallRules { + private final SqlManager manager; + + FirewallRulesImpl(SqlManager manager) { + super(manager.inner().firewallRules()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public FirewallRuleImpl define(String name) { + return wrapModel(name); + } + + private FirewallRuleImpl wrapModel(FirewallRuleInner inner) { + return new FirewallRuleImpl(inner, manager()); + } + + private FirewallRuleImpl wrapModel(String name) { + return new FirewallRuleImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + FirewallRulesInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public FirewallRule call(FirewallRuleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String firewallRuleName) { + FirewallRulesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, firewallRuleName) + .map(new Func1() { + @Override + public FirewallRule call(FirewallRuleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { + FirewallRulesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, firewallRuleName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesInner.java new file mode 100644 index 0000000000000..2fd6243725c4e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/FirewallRulesInner.java @@ -0,0 +1,456 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import 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.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in FirewallRules. + */ +public class FirewallRulesInner { + /** The Retrofit service to perform REST calls. */ + private FirewallRulesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of FirewallRulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public FirewallRulesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(FirewallRulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for FirewallRules to be + * used by Retrofit to perform actually REST calls. + */ + interface FirewallRulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.FirewallRules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @Query("api-version") String apiVersion, @Body FirewallRuleInner parameters, @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.v2014_04_01.FirewallRules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.FirewallRules get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("firewallRuleName") String firewallRuleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.FirewallRules listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules") + Observable> listByServer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @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 FirewallRuleInner object if successful. + */ + public FirewallRuleInner createOrUpdate(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @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 firewallRuleName, FirewallRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters), serviceCallback); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).map(new Func1, FirewallRuleInner>() { + @Override + public FirewallRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @param parameters The required parameters for creating or updating a firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, firewallRuleName, this.client.apiVersion(), parameters, 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 a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 firewallRuleName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).toBlocking().single().body(); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 firewallRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName), serviceCallback); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName 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.delete(this.client.subscriptionId(), resourceGroupName, serverName, firewallRuleName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 FirewallRuleInner object if successful. + */ + public FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).toBlocking().single().body(); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @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 firewallRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName), serviceCallback); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).map(new Func1, FirewallRuleInner>() { + @Override + public FirewallRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The 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 firewallRuleName The name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallRuleInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String firewallRuleName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (firewallRuleName == null) { + throw new IllegalArgumentException("Parameter firewallRuleName 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(this.client.subscriptionId(), resourceGroupName, serverName, firewallRuleName, 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); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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 List<FirewallRuleInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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 List<FirewallRuleInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of firewall rules. + * + * @param resourceGroupName The 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 List<FirewallRuleInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(String resourceGroupName, String serverName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByServer(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/IdParsingUtils.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..3e2876d3a0a90 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v2014_04_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ImportExportResponseImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ImportExportResponseImpl.java new file mode 100644 index 0000000000000..3e57bcdbd399f --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ImportExportResponseImpl.java @@ -0,0 +1,219 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ImportExportResponse; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.ImportExtensionRequest; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2014_04_01.AuthenticationType; +import com.microsoft.azure.management.sql.v2014_04_01.StorageKeyType; +import rx.functions.Func1; + +class ImportExportResponseImpl extends CreatableUpdatableImpl implements ImportExportResponse, ImportExportResponse.Definition, ImportExportResponse.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private ImportExtensionRequest createOrUpdateParameter; + + ImportExportResponseImpl(String name, SqlManager manager) { + super(name, new ImportExportResponseInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + this.createOrUpdateParameter = new ImportExtensionRequest(); + } + + ImportExportResponseImpl(ImportExportResponseInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + this.createOrUpdateParameter = new ImportExtensionRequest(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.createImportOperationAsync(this.resourceGroupName, this.serverName, this.databaseName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public ImportExportResponseInner call(ImportExportResponseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.createImportOperationAsync(this.resourceGroupName, this.serverName, this.databaseName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public ImportExportResponseInner call(ImportExportResponseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabasesInner client = this.manager().inner().databases(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new ImportExtensionRequest(); + } + + @Override + public String blobUri() { + return this.inner().blobUri(); + } + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public String errorMessage() { + return this.inner().errorMessage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String lastModifiedTime() { + return this.inner().lastModifiedTime(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String queuedTime() { + return this.inner().queuedTime(); + } + + @Override + public UUID requestId() { + return this.inner().requestId(); + } + + @Override + public String requestType() { + return this.inner().requestType(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public String status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ImportExportResponseImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + @Override + public ImportExportResponseImpl withAdministratorLogin(String administratorLogin) { + this.createOrUpdateParameter.withAdministratorLogin(administratorLogin); + return this; + } + + @Override + public ImportExportResponseImpl withAdministratorLoginPassword(String administratorLoginPassword) { + this.createOrUpdateParameter.withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + @Override + public ImportExportResponseImpl withOperationMode(String operationMode) { + this.createOrUpdateParameter.withOperationMode(operationMode); + return this; + } + + @Override + public ImportExportResponseImpl withStorageKey(String storageKey) { + this.createOrUpdateParameter.withStorageKey(storageKey); + return this; + } + + @Override + public ImportExportResponseImpl withStorageKeyType(StorageKeyType storageKeyType) { + this.createOrUpdateParameter.withStorageKeyType(storageKeyType); + return this; + } + + @Override + public ImportExportResponseImpl withStorageUri(String storageUri) { + this.createOrUpdateParameter.withStorageUri(storageUri); + return this; + } + + @Override + public ImportExportResponseImpl withAuthenticationType(AuthenticationType authenticationType) { + this.createOrUpdateParameter.withAuthenticationType(authenticationType); + return this; + } + + @Override + public ImportExportResponseImpl withName(String name) { + this.createOrUpdateParameter.withName(name); + return this; + } + + @Override + public ImportExportResponseImpl withType(String type) { + this.createOrUpdateParameter.withType(type); + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ImportExportResponseInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ImportExportResponseInner.java new file mode 100644 index 0000000000000..205cb55da1747 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ImportExportResponseInner.java @@ -0,0 +1,156 @@ +/** + * 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.v2014_04_01.implementation; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Response for Import/Export Get operation. + */ +@JsonFlatten +public class ImportExportResponseInner extends ProxyResource { + /** + * The request type of the operation. + */ + @JsonProperty(value = "properties.requestType", access = JsonProperty.Access.WRITE_ONLY) + private String requestType; + + /** + * The request type of the operation. + */ + @JsonProperty(value = "properties.requestId", access = JsonProperty.Access.WRITE_ONLY) + private UUID requestId; + + /** + * The name of the server. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The name of the database. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * The status message returned from the server. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The operation status last modified time. + */ + @JsonProperty(value = "properties.lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private String lastModifiedTime; + + /** + * The operation queued time. + */ + @JsonProperty(value = "properties.queuedTime", access = JsonProperty.Access.WRITE_ONLY) + private String queuedTime; + + /** + * The blob uri. + */ + @JsonProperty(value = "properties.blobUri", access = JsonProperty.Access.WRITE_ONLY) + private String blobUri; + + /** + * The error message returned from the server. + */ + @JsonProperty(value = "properties.errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * Get the request type of the operation. + * + * @return the requestType value + */ + public String requestType() { + return this.requestType; + } + + /** + * Get the request type of the operation. + * + * @return the requestId value + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Get the name of the server. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the name of the database. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the status message returned from the server. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the operation status last modified time. + * + * @return the lastModifiedTime value + */ + public String lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get the operation queued time. + * + * @return the queuedTime value + */ + public String queuedTime() { + return this.queuedTime; + } + + /** + * Get the blob uri. + * + * @return the blobUri value + */ + public String blobUri() { + return this.blobUri; + } + + /** + * Get the error message returned from the server. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/PageImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..0a52f2fa78a9d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.v2014_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolImpl.java new file mode 100644 index 0000000000000..b6358db3c0748 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolImpl.java @@ -0,0 +1,130 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPool; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolEdition; +import java.util.ArrayList; +import com.microsoft.azure.management.sql.v2014_04_01.Database; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPoolMetric; +import org.joda.time.DateTime; + +class RecommendedElasticPoolImpl extends IndexableRefreshableWrapperImpl implements RecommendedElasticPool { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String recommendedElasticPoolName; + + RecommendedElasticPoolImpl(RecommendedElasticPoolInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.recommendedElasticPoolName = IdParsingUtils.getValueFromIdByName(inner.id(), "recommendedElasticPools"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RecommendedElasticPoolsInner client = this.manager().inner().recommendedElasticPools(); + return client.getAsync(this.resourceGroupName, this.serverName, this.recommendedElasticPoolName); + } + + + + @Override + public Double databaseDtuMax() { + return this.inner().databaseDtuMax(); + } + + @Override + public Double databaseDtuMin() { + return this.inner().databaseDtuMin(); + } + + @Override + public ElasticPoolEdition databaseEdition() { + return this.inner().databaseEdition(); + } + + @Override + public List databases() { + List lst = new ArrayList(); + if (this.inner().databases() != null) { + for (DatabaseInner inner : this.inner().databases()) { + lst.add( new DatabaseImpl(inner, manager())); + } + } + return lst; + } + + @Override + public Double dtu() { + return this.inner().dtu(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Double maxObservedDtu() { + return this.inner().maxObservedDtu(); + } + + @Override + public Double maxObservedStorageMB() { + return this.inner().maxObservedStorageMB(); + } + + @Override + public List metrics() { + List lst = new ArrayList(); + if (this.inner().metrics() != null) { + for (RecommendedElasticPoolMetricInner inner : this.inner().metrics()) { + lst.add( new RecommendedElasticPoolMetricImpl(inner, manager())); + } + } + return lst; + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime observationPeriodEnd() { + return this.inner().observationPeriodEnd(); + } + + @Override + public DateTime observationPeriodStart() { + return this.inner().observationPeriodStart(); + } + + @Override + public Double storageMB() { + return this.inner().storageMB(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolInner.java new file mode 100644 index 0000000000000..4f9e68cc60c45 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolInner.java @@ -0,0 +1,234 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolEdition; +import org.joda.time.DateTime; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a recommented elastic pool. + */ +@JsonFlatten +public class RecommendedElasticPoolInner extends ProxyResource { + /** + * The edition of the recommended elastic pool. The ElasticPoolEdition + * enumeration contains all the valid editions. Possible values include: + * 'Basic', 'Standard', 'Premium'. + */ + @JsonProperty(value = "properties.databaseEdition", access = JsonProperty.Access.WRITE_ONLY) + private ElasticPoolEdition databaseEdition; + + /** + * The DTU for the recommended elastic pool. + */ + @JsonProperty(value = "properties.dtu") + private Double dtu; + + /** + * The minimum DTU for the database. + */ + @JsonProperty(value = "properties.databaseDtuMin") + private Double databaseDtuMin; + + /** + * The maximum DTU for the database. + */ + @JsonProperty(value = "properties.databaseDtuMax") + private Double databaseDtuMax; + + /** + * Gets storage size in megabytes. + */ + @JsonProperty(value = "properties.storageMB") + private Double storageMB; + + /** + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime observationPeriodStart; + + /** + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime observationPeriodEnd; + + /** + * Gets maximum observed DTU. + */ + @JsonProperty(value = "properties.maxObservedDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double maxObservedDtu; + + /** + * Gets maximum observed storage in megabytes. + */ + @JsonProperty(value = "properties.maxObservedStorageMB", access = JsonProperty.Access.WRITE_ONLY) + private Double maxObservedStorageMB; + + /** + * The list of databases in this pool. Expanded property. + */ + @JsonProperty(value = "properties.databases", access = JsonProperty.Access.WRITE_ONLY) + private List databases; + + /** + * The list of databases housed in the server. Expanded property. + */ + @JsonProperty(value = "properties.metrics", access = JsonProperty.Access.WRITE_ONLY) + private List metrics; + + /** + * Get the edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. Possible values include: 'Basic', 'Standard', 'Premium'. + * + * @return the databaseEdition value + */ + public ElasticPoolEdition databaseEdition() { + return this.databaseEdition; + } + + /** + * Get the DTU for the recommended elastic pool. + * + * @return the dtu value + */ + public Double dtu() { + return this.dtu; + } + + /** + * Set the DTU for the recommended elastic pool. + * + * @param dtu the dtu value to set + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withDtu(Double dtu) { + this.dtu = dtu; + return this; + } + + /** + * Get the minimum DTU for the database. + * + * @return the databaseDtuMin value + */ + public Double databaseDtuMin() { + return this.databaseDtuMin; + } + + /** + * Set the minimum DTU for the database. + * + * @param databaseDtuMin the databaseDtuMin value to set + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withDatabaseDtuMin(Double databaseDtuMin) { + this.databaseDtuMin = databaseDtuMin; + return this; + } + + /** + * Get the maximum DTU for the database. + * + * @return the databaseDtuMax value + */ + public Double databaseDtuMax() { + return this.databaseDtuMax; + } + + /** + * Set the maximum DTU for the database. + * + * @param databaseDtuMax the databaseDtuMax value to set + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withDatabaseDtuMax(Double databaseDtuMax) { + this.databaseDtuMax = databaseDtuMax; + return this; + } + + /** + * Get gets storage size in megabytes. + * + * @return the storageMB value + */ + public Double storageMB() { + return this.storageMB; + } + + /** + * Set gets storage size in megabytes. + * + * @param storageMB the storageMB value to set + * @return the RecommendedElasticPoolInner object itself. + */ + public RecommendedElasticPoolInner withStorageMB(Double storageMB) { + this.storageMB = storageMB; + return this; + } + + /** + * Get the observation period start (ISO8601 format). + * + * @return the observationPeriodStart value + */ + public DateTime observationPeriodStart() { + return this.observationPeriodStart; + } + + /** + * Get the observation period start (ISO8601 format). + * + * @return the observationPeriodEnd value + */ + public DateTime observationPeriodEnd() { + return this.observationPeriodEnd; + } + + /** + * Get gets maximum observed DTU. + * + * @return the maxObservedDtu value + */ + public Double maxObservedDtu() { + return this.maxObservedDtu; + } + + /** + * Get gets maximum observed storage in megabytes. + * + * @return the maxObservedStorageMB value + */ + public Double maxObservedStorageMB() { + return this.maxObservedStorageMB; + } + + /** + * Get the list of databases in this pool. Expanded property. + * + * @return the databases value + */ + public List databases() { + return this.databases; + } + + /** + * Get the list of databases housed in the server. Expanded property. + * + * @return the metrics value + */ + public List metrics() { + return this.metrics; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolMetricImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolMetricImpl.java new file mode 100644 index 0000000000000..3065c0517cfab --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolMetricImpl.java @@ -0,0 +1,46 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPoolMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class RecommendedElasticPoolMetricImpl extends WrapperImpl implements RecommendedElasticPoolMetric { + private final SqlManager manager; + + RecommendedElasticPoolMetricImpl(RecommendedElasticPoolMetricInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public DateTime dateTimeProperty() { + return this.inner().dateTimeProperty(); + } + + @Override + public Double dtu() { + return this.inner().dtu(); + } + + @Override + public Double sizeGB() { + return this.inner().sizeGB(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolMetricInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolMetricInner.java new file mode 100644 index 0000000000000..b1332d083abff --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolMetricInner.java @@ -0,0 +1,97 @@ +/** + * 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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents recommended elastic pool metric. + */ +public class RecommendedElasticPoolMetricInner { + /** + * The time of metric (ISO8601 format). + */ + @JsonProperty(value = "dateTime") + private DateTime dateTimeProperty; + + /** + * Gets or sets the DTUs (Database Transaction Units). See + * https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/. + */ + @JsonProperty(value = "dtu") + private Double dtu; + + /** + * Gets or sets size in gigabytes. + */ + @JsonProperty(value = "sizeGB") + private Double sizeGB; + + /** + * Get the time of metric (ISO8601 format). + * + * @return the dateTimeProperty value + */ + public DateTime dateTimeProperty() { + return this.dateTimeProperty; + } + + /** + * Set the time of metric (ISO8601 format). + * + * @param dateTimeProperty the dateTimeProperty value to set + * @return the RecommendedElasticPoolMetricInner object itself. + */ + public RecommendedElasticPoolMetricInner withDateTimeProperty(DateTime dateTimeProperty) { + this.dateTimeProperty = dateTimeProperty; + return this; + } + + /** + * Get gets or sets the DTUs (Database Transaction Units). See https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/. + * + * @return the dtu value + */ + public Double dtu() { + return this.dtu; + } + + /** + * Set gets or sets the DTUs (Database Transaction Units). See https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/. + * + * @param dtu the dtu value to set + * @return the RecommendedElasticPoolMetricInner object itself. + */ + public RecommendedElasticPoolMetricInner withDtu(Double dtu) { + this.dtu = dtu; + return this; + } + + /** + * Get gets or sets size in gigabytes. + * + * @return the sizeGB value + */ + public Double sizeGB() { + return this.sizeGB; + } + + /** + * Set gets or sets size in gigabytes. + * + * @param sizeGB the sizeGB value to set + * @return the RecommendedElasticPoolMetricInner object itself. + */ + public RecommendedElasticPoolMetricInner withSizeGB(Double sizeGB) { + this.sizeGB = sizeGB; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsImpl.java new file mode 100644 index 0000000000000..6140596fbe34d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsImpl.java @@ -0,0 +1,88 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPools; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPool; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPoolMetric; + +class RecommendedElasticPoolsImpl extends WrapperImpl implements RecommendedElasticPools { + private final SqlManager manager; + + RecommendedElasticPoolsImpl(SqlManager manager) { + super(manager.inner().recommendedElasticPools()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private RecommendedElasticPoolImpl wrapModel(RecommendedElasticPoolInner inner) { + return new RecommendedElasticPoolImpl(inner, manager()); + } + + @Override + public Observable listByServerAsync(String resourceGroupName, String serverName) { + RecommendedElasticPoolsInner client = this.inner(); + return client.listByServerAsync(resourceGroupName, serverName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RecommendedElasticPool call(RecommendedElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + RecommendedElasticPoolsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, recommendedElasticPoolName) + .map(new Func1() { + @Override + public RecommendedElasticPool call(RecommendedElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + private RecommendedElasticPoolMetricImpl wrapRecommendedElasticPoolMetricModel(RecommendedElasticPoolMetricInner inner) { + return new RecommendedElasticPoolMetricImpl(inner, manager()); + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + RecommendedElasticPoolsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, serverName, recommendedElasticPoolName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public RecommendedElasticPoolMetric call(RecommendedElasticPoolMetricInner inner) { + return wrapRecommendedElasticPoolMetricModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java new file mode 100644 index 0000000000000..e5c6cca5a3293 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java @@ -0,0 +1,351 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RecommendedElasticPools. + */ +public class RecommendedElasticPoolsInner { + /** The Retrofit service to perform REST calls. */ + private RecommendedElasticPoolsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of RecommendedElasticPoolsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RecommendedElasticPoolsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(RecommendedElasticPoolsService.class); + this.client = client; + } + + /** + * The interface defining all the services for RecommendedElasticPools to be + * used by Retrofit to perform actually REST calls. + */ + interface RecommendedElasticPoolsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPools get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("recommendedElasticPoolName") String recommendedElasticPoolName, @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.v2014_04_01.RecommendedElasticPools listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools") + Observable> listByServer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPools listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("recommendedElasticPoolName") String recommendedElasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 RecommendedElasticPoolInner object if successful. + */ + public RecommendedElasticPoolInner get(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).toBlocking().single().body(); + } + + /** + * Gets a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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 recommendedElasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName), serviceCallback); + } + + /** + * Gets a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecommendedElasticPoolInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).map(new Func1, RecommendedElasticPoolInner>() { + @Override + public RecommendedElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a recommented elastic pool. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecommendedElasticPoolInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (recommendedElasticPoolName == null) { + throw new IllegalArgumentException("Parameter recommendedElasticPoolName 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(this.client.subscriptionId(), resourceGroupName, serverName, recommendedElasticPoolName, 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); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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 List<RecommendedElasticPoolInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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(String resourceGroupName, String serverName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByServerWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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 List<RecommendedElasticPoolInner> object + */ + public Observable> listByServerAsync(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns recommended elastic pools. + * + * @param resourceGroupName The 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 List<RecommendedElasticPoolInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(String resourceGroupName, String serverName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByServer(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } 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); + } + + /** + * Returns recommented elastic pool metrics. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<RecommendedElasticPoolMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).toBlocking().single().body(); + } + + /** + * Returns recommented elastic pool metrics. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @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> listMetricsAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName), serviceCallback); + } + + /** + * Returns recommented elastic pool metrics. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RecommendedElasticPoolMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns recommented elastic pool metrics. + * + * @param resourceGroupName The 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 recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<RecommendedElasticPoolMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (recommendedElasticPoolName == null) { + throw new IllegalArgumentException("Parameter recommendedElasticPoolName 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.listMetrics(this.client.subscriptionId(), resourceGroupName, serverName, recommendedElasticPoolName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinkImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinkImpl.java new file mode 100644 index 0000000000000..f551a050b6f5f --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinkImpl.java @@ -0,0 +1,117 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationLink; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationRole; +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationState; +import org.joda.time.DateTime; + +class ReplicationLinkImpl extends IndexableRefreshableWrapperImpl implements ReplicationLink { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String linkId; + + ReplicationLinkImpl(ReplicationLinkInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.linkId = IdParsingUtils.getValueFromIdByName(inner.id(), "replicationLinks"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ReplicationLinksInner client = this.manager().inner().replicationLinks(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.linkId); + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isTerminationAllowed() { + return this.inner().isTerminationAllowed(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String partnerDatabase() { + return this.inner().partnerDatabase(); + } + + @Override + public String partnerLocation() { + return this.inner().partnerLocation(); + } + + @Override + public ReplicationRole partnerRole() { + return this.inner().partnerRole(); + } + + @Override + public String partnerServer() { + return this.inner().partnerServer(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public String replicationMode() { + return this.inner().replicationMode(); + } + + @Override + public ReplicationState replicationState() { + return this.inner().replicationState(); + } + + @Override + public ReplicationRole role() { + return this.inner().role(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinkInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinkInner.java new file mode 100644 index 0000000000000..5c09c6fe8df96 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinkInner.java @@ -0,0 +1,194 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationRole; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database replication link. + */ +@JsonFlatten +public class ReplicationLinkInner extends ProxyResource { + /** + * Location of the server that contains this firewall rule. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Legacy value indicating whether termination is allowed. Currently + * always returns true. + */ + @JsonProperty(value = "properties.isTerminationAllowed", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isTerminationAllowed; + + /** + * Replication mode of this replication link. + */ + @JsonProperty(value = "properties.replicationMode", access = JsonProperty.Access.WRITE_ONLY) + private String replicationMode; + + /** + * The name of the server hosting the partner database. + */ + @JsonProperty(value = "properties.partnerServer", access = JsonProperty.Access.WRITE_ONLY) + private String partnerServer; + + /** + * The name of the partner database. + */ + @JsonProperty(value = "properties.partnerDatabase", access = JsonProperty.Access.WRITE_ONLY) + private String partnerDatabase; + + /** + * The Azure Region of the partner database. + */ + @JsonProperty(value = "properties.partnerLocation", access = JsonProperty.Access.WRITE_ONLY) + private String partnerLocation; + + /** + * The role of the database in the replication link. Possible values + * include: 'Primary', 'Secondary', 'NonReadableSecondary', 'Source', + * 'Copy'. + */ + @JsonProperty(value = "properties.role", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationRole role; + + /** + * The role of the partner database in the replication link. Possible + * values include: 'Primary', 'Secondary', 'NonReadableSecondary', + * 'Source', 'Copy'. + */ + @JsonProperty(value = "properties.partnerRole", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationRole partnerRole; + + /** + * The start time for the replication link. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The percentage of seeding complete for the replication link. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /** + * The replication state for the replication link. Possible values include: + * 'PENDING', 'SEEDING', 'CATCH_UP', 'SUSPENDED'. + */ + @JsonProperty(value = "properties.replicationState", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationState replicationState; + + /** + * Get location of the server that contains this firewall rule. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get legacy value indicating whether termination is allowed. Currently always returns true. + * + * @return the isTerminationAllowed value + */ + public Boolean isTerminationAllowed() { + return this.isTerminationAllowed; + } + + /** + * Get replication mode of this replication link. + * + * @return the replicationMode value + */ + public String replicationMode() { + return this.replicationMode; + } + + /** + * Get the name of the server hosting the partner database. + * + * @return the partnerServer value + */ + public String partnerServer() { + return this.partnerServer; + } + + /** + * Get the name of the partner database. + * + * @return the partnerDatabase value + */ + public String partnerDatabase() { + return this.partnerDatabase; + } + + /** + * Get the Azure Region of the partner database. + * + * @return the partnerLocation value + */ + public String partnerLocation() { + return this.partnerLocation; + } + + /** + * Get the role of the database in the replication link. Possible values include: 'Primary', 'Secondary', 'NonReadableSecondary', 'Source', 'Copy'. + * + * @return the role value + */ + public ReplicationRole role() { + return this.role; + } + + /** + * Get the role of the partner database in the replication link. Possible values include: 'Primary', 'Secondary', 'NonReadableSecondary', 'Source', 'Copy'. + * + * @return the partnerRole value + */ + public ReplicationRole partnerRole() { + return this.partnerRole; + } + + /** + * Get the start time for the replication link. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the percentage of seeding complete for the replication link. + * + * @return the percentComplete value + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the replication state for the replication link. Possible values include: 'PENDING', 'SEEDING', 'CATCH_UP', 'SUSPENDED'. + * + * @return the replicationState value + */ + public ReplicationState replicationState() { + return this.replicationState; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksImpl.java new file mode 100644 index 0000000000000..094b92744f79d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksImpl.java @@ -0,0 +1,84 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationLinks; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationLink; + +class ReplicationLinksImpl extends WrapperImpl implements ReplicationLinks { + private final SqlManager manager; + + ReplicationLinksImpl(SqlManager manager) { + super(manager.inner().replicationLinks()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ReplicationLinkImpl wrapModel(ReplicationLinkInner inner) { + return new ReplicationLinkImpl(inner, manager()); + } + + @Override + public Completable failoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinksInner client = this.inner(); + return client.failoverAsync(resourceGroupName, serverName, databaseName, linkId).toCompletable(); + } + + @Override + public Completable failoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinksInner client = this.inner(); + return client.failoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).toCompletable(); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + ReplicationLinksInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReplicationLink call(ReplicationLinkInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinksInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, linkId) + .map(new Func1() { + @Override + public ReplicationLink call(ReplicationLinkInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinksInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName, linkId).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java new file mode 100644 index 0000000000000..a4cb1d8c51849 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java @@ -0,0 +1,749 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ReplicationLinks. + */ +public class ReplicationLinksInner { + /** The Retrofit service to perform REST calls. */ + private ReplicationLinksService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ReplicationLinksInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReplicationLinksInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ReplicationLinksService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReplicationLinks to be + * used by Retrofit to perform actually REST calls. + */ + interface ReplicationLinksService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ReplicationLinks delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v2014_04_01.ReplicationLinks get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v2014_04_01.ReplicationLinks failover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover") + Observable> failover(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v2014_04_01.ReplicationLinks beginFailover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover") + Observable> beginFailover(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v2014_04_01.ReplicationLinks failoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss") + Observable> failoverAllowDataLoss(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v2014_04_01.ReplicationLinks beginFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss") + Observable> beginFailoverAllowDataLoss(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("linkId") String linkId, @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.v2014_04_01.ReplicationLinks listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link to be 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 + */ + public void delete(String resourceGroupName, String serverName, String databaseName, String linkId) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().single().body(); + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link to be 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 deleteAsync(String resourceGroupName, String serverName, String databaseName, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @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 linkId) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param resourceGroupName The 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 that has the replication link to be dropped. + * @param linkId The ID of the replication link to be deleted. + * @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 linkId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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.delete(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 to get the link for. + * @param linkId The replication link ID to be retrieved. + * @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 ReplicationLinkInner object if successful. + */ + public ReplicationLinkInner get(String resourceGroupName, String serverName, String databaseName, String linkId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().single().body(); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 to get the link for. + * @param linkId The replication link ID to be retrieved. + * @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 linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 to get the link for. + * @param linkId The replication link ID to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationLinkInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, ReplicationLinkInner>() { + @Override + public ReplicationLinkInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database replication link. + * + * @param resourceGroupName The 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 to get the link for. + * @param linkId The replication link ID to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReplicationLinkInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, 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 which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 failover(String resourceGroupName, String serverName, String databaseName, String linkId) { + failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().last().body(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture failoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return failoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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.failover(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 beginFailover(String resourceGroupName, String serverName, String databaseName, String linkId) { + beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().single().body(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginFailoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginFailoverAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica 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 that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginFailoverWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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.beginFailover(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginFailoverDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginFailoverDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 failoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId) { + failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().last().body(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 failoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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.failoverAllowDataLoss(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 beginFailoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId) { + beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().single().body(); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @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 beginFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId), serviceCallback); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database that has the replication link to be failed over. + * @param linkId The ID of the replication link to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (linkId == null) { + throw new IllegalArgumentException("Parameter linkId 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.beginFailoverAllowDataLoss(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, linkId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginFailoverAllowDataLossDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginFailoverAllowDataLossDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 to retrieve links for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReplicationLinkInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 to retrieve links for. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 to retrieve links for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReplicationLinkInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a database's replication links. + * + * @param resourceGroupName The 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 to retrieve links for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReplicationLinkInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + 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.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByDatabase(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersImpl.java new file mode 100644 index 0000000000000..fb29786e42b3b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.Servers; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.CheckNameAvailabilityResponse; + +class ServersImpl extends WrapperImpl implements Servers { + private final SqlManager manager; + + ServersImpl(SqlManager manager) { + super(manager.inner().servers()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable checkNameAvailabilityAsync(String name) { + ServersInner client = this.inner(); + return client.checkNameAvailabilityAsync(name) + .map(new Func1() { + @Override + public CheckNameAvailabilityResponse call(CheckNameAvailabilityResponseInner inner) { + return new CheckNameAvailabilityResponseImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersInner.java new file mode 100644 index 0000000000000..ae53681ce9724 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServersInner.java @@ -0,0 +1,143 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2014_04_01.CheckNameAvailabilityRequest; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Servers. + */ +public class ServersInner { + /** The Retrofit service to perform REST calls. */ + private ServersService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServersInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Servers to be + * used by Retrofit to perform actually REST calls. + */ + interface ServersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.Servers checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability") + Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CheckNameAvailabilityRequest parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @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 CheckNameAvailabilityResponseInner object if successful. + */ + public CheckNameAvailabilityResponseInner checkNameAvailability(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @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 checkNameAvailabilityAsync(String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(name), serviceCallback); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResponseInner object + */ + public Observable checkNameAvailabilityAsync(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).map(new Func1, CheckNameAvailabilityResponseInner>() { + @Override + public CheckNameAvailabilityResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param name The name whose availability is to be checked. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResponseInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String name) { + 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."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + CheckNameAvailabilityRequest parameters = new CheckNameAvailabilityRequest(); + parameters.withName(name); + return service.checkNameAvailability(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 = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorImpl.java new file mode 100644 index 0000000000000..7654387ba6009 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorImpl.java @@ -0,0 +1,158 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.ServiceTierAdvisor; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.SloUsageMetric; + +class ServiceTierAdvisorImpl extends IndexableRefreshableWrapperImpl implements ServiceTierAdvisor { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String serviceTierAdvisorName; + + ServiceTierAdvisorImpl(ServiceTierAdvisorInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.serviceTierAdvisorName = IdParsingUtils.getValueFromIdByName(inner.id(), "serviceTierAdvisors"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ServiceTierAdvisorsInner client = this.manager().inner().serviceTierAdvisors(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.serviceTierAdvisorName); + } + + + + @Override + public Double activeTimeRatio() { + return this.inner().activeTimeRatio(); + } + + @Override + public Double avgDtu() { + return this.inner().avgDtu(); + } + + @Override + public double confidence() { + return this.inner().confidence(); + } + + @Override + public String currentServiceLevelObjective() { + return this.inner().currentServiceLevelObjective(); + } + + @Override + public UUID currentServiceLevelObjectiveId() { + return this.inner().currentServiceLevelObjectiveId(); + } + + @Override + public String databaseSizeBasedRecommendationServiceLevelObjective() { + return this.inner().databaseSizeBasedRecommendationServiceLevelObjective(); + } + + @Override + public UUID databaseSizeBasedRecommendationServiceLevelObjectiveId() { + return this.inner().databaseSizeBasedRecommendationServiceLevelObjectiveId(); + } + + @Override + public String disasterPlanBasedRecommendationServiceLevelObjective() { + return this.inner().disasterPlanBasedRecommendationServiceLevelObjective(); + } + + @Override + public UUID disasterPlanBasedRecommendationServiceLevelObjectiveId() { + return this.inner().disasterPlanBasedRecommendationServiceLevelObjectiveId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Double maxDtu() { + return this.inner().maxDtu(); + } + + @Override + public Double maxSizeInGB() { + return this.inner().maxSizeInGB(); + } + + @Override + public Double minDtu() { + return this.inner().minDtu(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime observationPeriodEnd() { + return this.inner().observationPeriodEnd(); + } + + @Override + public DateTime observationPeriodStart() { + return this.inner().observationPeriodStart(); + } + + @Override + public String overallRecommendationServiceLevelObjective() { + return this.inner().overallRecommendationServiceLevelObjective(); + } + + @Override + public UUID overallRecommendationServiceLevelObjectiveId() { + return this.inner().overallRecommendationServiceLevelObjectiveId(); + } + + @Override + public List serviceLevelObjectiveUsageMetrics() { + return this.inner().serviceLevelObjectiveUsageMetrics(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String usageBasedRecommendationServiceLevelObjective() { + return this.inner().usageBasedRecommendationServiceLevelObjective(); + } + + @Override + public UUID usageBasedRecommendationServiceLevelObjectiveId() { + return this.inner().usageBasedRecommendationServiceLevelObjectiveId(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorInner.java new file mode 100644 index 0000000000000..d2cb90000f19f --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorInner.java @@ -0,0 +1,318 @@ +/** + * 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.v2014_04_01.implementation; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.SloUsageMetric; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a Service Tier Advisor. + */ +@JsonFlatten +public class ServiceTierAdvisorInner extends ProxyResource { + /** + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime observationPeriodStart; + + /** + * The observation period start (ISO8601 format). + */ + @JsonProperty(value = "properties.observationPeriodEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime observationPeriodEnd; + + /** + * The activeTimeRatio for service tier advisor. + */ + @JsonProperty(value = "properties.activeTimeRatio", access = JsonProperty.Access.WRITE_ONLY) + private Double activeTimeRatio; + + /** + * Gets or sets minDtu for service tier advisor. + */ + @JsonProperty(value = "properties.minDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double minDtu; + + /** + * Gets or sets avgDtu for service tier advisor. + */ + @JsonProperty(value = "properties.avgDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double avgDtu; + + /** + * Gets or sets maxDtu for service tier advisor. + */ + @JsonProperty(value = "properties.maxDtu", access = JsonProperty.Access.WRITE_ONLY) + private Double maxDtu; + + /** + * Gets or sets maxSizeInGB for service tier advisor. + */ + @JsonProperty(value = "properties.maxSizeInGB", access = JsonProperty.Access.WRITE_ONLY) + private Double maxSizeInGB; + + /** + * Gets or sets serviceLevelObjectiveUsageMetrics for the service tier + * advisor. + */ + @JsonProperty(value = "properties.serviceLevelObjectiveUsageMetrics", access = JsonProperty.Access.WRITE_ONLY) + private List serviceLevelObjectiveUsageMetrics; + + /** + * Gets or sets currentServiceLevelObjective for service tier advisor. + */ + @JsonProperty(value = "properties.currentServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceLevelObjective; + + /** + * Gets or sets currentServiceLevelObjectiveId for service tier advisor. + */ + @JsonProperty(value = "properties.currentServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID currentServiceLevelObjectiveId; + + /** + * Gets or sets usageBasedRecommendationServiceLevelObjective for service + * tier advisor. + */ + @JsonProperty(value = "properties.usageBasedRecommendationServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String usageBasedRecommendationServiceLevelObjective; + + /** + * Gets or sets usageBasedRecommendationServiceLevelObjectiveId for service + * tier advisor. + */ + @JsonProperty(value = "properties.usageBasedRecommendationServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID usageBasedRecommendationServiceLevelObjectiveId; + + /** + * Gets or sets databaseSizeBasedRecommendationServiceLevelObjective for + * service tier advisor. + */ + @JsonProperty(value = "properties.databaseSizeBasedRecommendationServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String databaseSizeBasedRecommendationServiceLevelObjective; + + /** + * Gets or sets databaseSizeBasedRecommendationServiceLevelObjectiveId for + * service tier advisor. + */ + @JsonProperty(value = "properties.databaseSizeBasedRecommendationServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseSizeBasedRecommendationServiceLevelObjectiveId; + + /** + * Gets or sets disasterPlanBasedRecommendationServiceLevelObjective for + * service tier advisor. + */ + @JsonProperty(value = "properties.disasterPlanBasedRecommendationServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String disasterPlanBasedRecommendationServiceLevelObjective; + + /** + * Gets or sets disasterPlanBasedRecommendationServiceLevelObjectiveId for + * service tier advisor. + */ + @JsonProperty(value = "properties.disasterPlanBasedRecommendationServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID disasterPlanBasedRecommendationServiceLevelObjectiveId; + + /** + * Gets or sets overallRecommendationServiceLevelObjective for service tier + * advisor. + */ + @JsonProperty(value = "properties.overallRecommendationServiceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String overallRecommendationServiceLevelObjective; + + /** + * Gets or sets overallRecommendationServiceLevelObjectiveId for service + * tier advisor. + */ + @JsonProperty(value = "properties.overallRecommendationServiceLevelObjectiveId", access = JsonProperty.Access.WRITE_ONLY) + private UUID overallRecommendationServiceLevelObjectiveId; + + /** + * Gets or sets confidence for service tier advisor. + */ + @JsonProperty(value = "properties.confidence", access = JsonProperty.Access.WRITE_ONLY) + private double confidence; + + /** + * Get the observation period start (ISO8601 format). + * + * @return the observationPeriodStart value + */ + public DateTime observationPeriodStart() { + return this.observationPeriodStart; + } + + /** + * Get the observation period start (ISO8601 format). + * + * @return the observationPeriodEnd value + */ + public DateTime observationPeriodEnd() { + return this.observationPeriodEnd; + } + + /** + * Get the activeTimeRatio for service tier advisor. + * + * @return the activeTimeRatio value + */ + public Double activeTimeRatio() { + return this.activeTimeRatio; + } + + /** + * Get gets or sets minDtu for service tier advisor. + * + * @return the minDtu value + */ + public Double minDtu() { + return this.minDtu; + } + + /** + * Get gets or sets avgDtu for service tier advisor. + * + * @return the avgDtu value + */ + public Double avgDtu() { + return this.avgDtu; + } + + /** + * Get gets or sets maxDtu for service tier advisor. + * + * @return the maxDtu value + */ + public Double maxDtu() { + return this.maxDtu; + } + + /** + * Get gets or sets maxSizeInGB for service tier advisor. + * + * @return the maxSizeInGB value + */ + public Double maxSizeInGB() { + return this.maxSizeInGB; + } + + /** + * Get gets or sets serviceLevelObjectiveUsageMetrics for the service tier advisor. + * + * @return the serviceLevelObjectiveUsageMetrics value + */ + public List serviceLevelObjectiveUsageMetrics() { + return this.serviceLevelObjectiveUsageMetrics; + } + + /** + * Get gets or sets currentServiceLevelObjective for service tier advisor. + * + * @return the currentServiceLevelObjective value + */ + public String currentServiceLevelObjective() { + return this.currentServiceLevelObjective; + } + + /** + * Get gets or sets currentServiceLevelObjectiveId for service tier advisor. + * + * @return the currentServiceLevelObjectiveId value + */ + public UUID currentServiceLevelObjectiveId() { + return this.currentServiceLevelObjectiveId; + } + + /** + * Get gets or sets usageBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the usageBasedRecommendationServiceLevelObjective value + */ + public String usageBasedRecommendationServiceLevelObjective() { + return this.usageBasedRecommendationServiceLevelObjective; + } + + /** + * Get gets or sets usageBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the usageBasedRecommendationServiceLevelObjectiveId value + */ + public UUID usageBasedRecommendationServiceLevelObjectiveId() { + return this.usageBasedRecommendationServiceLevelObjectiveId; + } + + /** + * Get gets or sets databaseSizeBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the databaseSizeBasedRecommendationServiceLevelObjective value + */ + public String databaseSizeBasedRecommendationServiceLevelObjective() { + return this.databaseSizeBasedRecommendationServiceLevelObjective; + } + + /** + * Get gets or sets databaseSizeBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the databaseSizeBasedRecommendationServiceLevelObjectiveId value + */ + public UUID databaseSizeBasedRecommendationServiceLevelObjectiveId() { + return this.databaseSizeBasedRecommendationServiceLevelObjectiveId; + } + + /** + * Get gets or sets disasterPlanBasedRecommendationServiceLevelObjective for service tier advisor. + * + * @return the disasterPlanBasedRecommendationServiceLevelObjective value + */ + public String disasterPlanBasedRecommendationServiceLevelObjective() { + return this.disasterPlanBasedRecommendationServiceLevelObjective; + } + + /** + * Get gets or sets disasterPlanBasedRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the disasterPlanBasedRecommendationServiceLevelObjectiveId value + */ + public UUID disasterPlanBasedRecommendationServiceLevelObjectiveId() { + return this.disasterPlanBasedRecommendationServiceLevelObjectiveId; + } + + /** + * Get gets or sets overallRecommendationServiceLevelObjective for service tier advisor. + * + * @return the overallRecommendationServiceLevelObjective value + */ + public String overallRecommendationServiceLevelObjective() { + return this.overallRecommendationServiceLevelObjective; + } + + /** + * Get gets or sets overallRecommendationServiceLevelObjectiveId for service tier advisor. + * + * @return the overallRecommendationServiceLevelObjectiveId value + */ + public UUID overallRecommendationServiceLevelObjectiveId() { + return this.overallRecommendationServiceLevelObjectiveId; + } + + /** + * Get gets or sets confidence for service tier advisor. + * + * @return the confidence value + */ + public double confidence() { + return this.confidence; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsImpl.java new file mode 100644 index 0000000000000..18d3f380e3259 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsImpl.java @@ -0,0 +1,65 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceTierAdvisors; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceTierAdvisor; + +class ServiceTierAdvisorsImpl extends WrapperImpl implements ServiceTierAdvisors { + private final SqlManager manager; + + ServiceTierAdvisorsImpl(SqlManager manager) { + super(manager.inner().serviceTierAdvisors()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ServiceTierAdvisorImpl wrapModel(ServiceTierAdvisorInner inner) { + return new ServiceTierAdvisorImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + ServiceTierAdvisorsInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ServiceTierAdvisor call(ServiceTierAdvisorInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + ServiceTierAdvisorsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName) + .map(new Func1() { + @Override + public ServiceTierAdvisor call(ServiceTierAdvisorInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsInner.java new file mode 100644 index 0000000000000..82868d139f4e2 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServiceTierAdvisorsInner.java @@ -0,0 +1,263 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ServiceTierAdvisors. + */ +public class ServiceTierAdvisorsInner { + /** The Retrofit service to perform REST calls. */ + private ServiceTierAdvisorsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ServiceTierAdvisorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServiceTierAdvisorsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ServiceTierAdvisorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServiceTierAdvisors to be + * used by Retrofit to perform actually REST calls. + */ + interface ServiceTierAdvisorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.ServiceTierAdvisors get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors/{serviceTierAdvisorName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("serviceTierAdvisorName") String serviceTierAdvisorName, @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.v2014_04_01.ServiceTierAdvisors listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/serviceTierAdvisors") + Observable> listByDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @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 ServiceTierAdvisorInner object if successful. + */ + public ServiceTierAdvisorInner get(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName).toBlocking().single().body(); + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @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 serviceTierAdvisorName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName), serviceCallback); + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceTierAdvisorInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, serviceTierAdvisorName).map(new Func1, ServiceTierAdvisorInner>() { + @Override + public ServiceTierAdvisorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a service tier advisor. + * + * @param resourceGroupName The 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 database. + * @param serviceTierAdvisorName The name of service tier advisor. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceTierAdvisorInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String serviceTierAdvisorName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (serviceTierAdvisorName == null) { + throw new IllegalArgumentException("Parameter serviceTierAdvisorName 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(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, serviceTierAdvisorName, 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); + } + + /** + * Returns service tier advisors for specified 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 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 List<ServiceTierAdvisorInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns service tier advisors for specified 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 database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns service tier advisors for specified 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 database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ServiceTierAdvisorInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns service tier advisors for specified 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 database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ServiceTierAdvisorInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + 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.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByDatabase(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManagementClientImpl.java new file mode 100644 index 0000000000000..ddb7d43009f90 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManagementClientImpl.java @@ -0,0 +1,350 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the SqlManagementClientImpl class. + */ +public class SqlManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription ID that identifies an Azure subscription. */ + private String subscriptionId; + + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public SqlManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the request. */ + private String apiVersion; + + /** + * Gets The API version to use for the request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SqlManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public SqlManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ServersInner object to access its operations. + */ + private ServersInner servers; + + /** + * Gets the ServersInner object to access its operations. + * @return the ServersInner object. + */ + public ServersInner servers() { + return this.servers; + } + + /** + * The DatabasesInner object to access its operations. + */ + private DatabasesInner databases; + + /** + * Gets the DatabasesInner object to access its operations. + * @return the DatabasesInner object. + */ + public DatabasesInner databases() { + return this.databases; + } + + /** + * The ElasticPoolsInner object to access its operations. + */ + private ElasticPoolsInner elasticPools; + + /** + * Gets the ElasticPoolsInner object to access its operations. + * @return the ElasticPoolsInner object. + */ + public ElasticPoolsInner elasticPools() { + return this.elasticPools; + } + + /** + * The FirewallRulesInner object to access its operations. + */ + private FirewallRulesInner firewallRules; + + /** + * Gets the FirewallRulesInner object to access its operations. + * @return the FirewallRulesInner object. + */ + public FirewallRulesInner firewallRules() { + return this.firewallRules; + } + + /** + * The RecommendedElasticPoolsInner object to access its operations. + */ + private RecommendedElasticPoolsInner recommendedElasticPools; + + /** + * Gets the RecommendedElasticPoolsInner object to access its operations. + * @return the RecommendedElasticPoolsInner object. + */ + public RecommendedElasticPoolsInner recommendedElasticPools() { + return this.recommendedElasticPools; + } + + /** + * The ReplicationLinksInner object to access its operations. + */ + private ReplicationLinksInner replicationLinks; + + /** + * Gets the ReplicationLinksInner object to access its operations. + * @return the ReplicationLinksInner object. + */ + public ReplicationLinksInner replicationLinks() { + return this.replicationLinks; + } + + /** + * The ElasticPoolActivitiesInner object to access its operations. + */ + private ElasticPoolActivitiesInner elasticPoolActivities; + + /** + * Gets the ElasticPoolActivitiesInner object to access its operations. + * @return the ElasticPoolActivitiesInner object. + */ + public ElasticPoolActivitiesInner elasticPoolActivities() { + return this.elasticPoolActivities; + } + + /** + * The ElasticPoolDatabaseActivitiesInner object to access its operations. + */ + private ElasticPoolDatabaseActivitiesInner elasticPoolDatabaseActivities; + + /** + * Gets the ElasticPoolDatabaseActivitiesInner object to access its operations. + * @return the ElasticPoolDatabaseActivitiesInner object. + */ + public ElasticPoolDatabaseActivitiesInner elasticPoolDatabaseActivities() { + return this.elasticPoolDatabaseActivities; + } + + /** + * The ServiceTierAdvisorsInner object to access its operations. + */ + private ServiceTierAdvisorsInner serviceTierAdvisors; + + /** + * Gets the ServiceTierAdvisorsInner object to access its operations. + * @return the ServiceTierAdvisorsInner object. + */ + public ServiceTierAdvisorsInner serviceTierAdvisors() { + return this.serviceTierAdvisors; + } + + /** + * The TransparentDataEncryptionsInner object to access its operations. + */ + private TransparentDataEncryptionsInner transparentDataEncryptions; + + /** + * Gets the TransparentDataEncryptionsInner object to access its operations. + * @return the TransparentDataEncryptionsInner object. + */ + public TransparentDataEncryptionsInner transparentDataEncryptions() { + return this.transparentDataEncryptions; + } + + /** + * The TransparentDataEncryptionActivitiesInner object to access its operations. + */ + private TransparentDataEncryptionActivitiesInner transparentDataEncryptionActivities; + + /** + * Gets the TransparentDataEncryptionActivitiesInner object to access its operations. + * @return the TransparentDataEncryptionActivitiesInner object. + */ + public TransparentDataEncryptionActivitiesInner transparentDataEncryptionActivities() { + return this.transparentDataEncryptionActivities; + } + + /** + * The DatabaseThreatDetectionPoliciesInner object to access its operations. + */ + private DatabaseThreatDetectionPoliciesInner databaseThreatDetectionPolicies; + + /** + * Gets the DatabaseThreatDetectionPoliciesInner object to access its operations. + * @return the DatabaseThreatDetectionPoliciesInner object. + */ + public DatabaseThreatDetectionPoliciesInner databaseThreatDetectionPolicies() { + return this.databaseThreatDetectionPolicies; + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SqlManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2014-04-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.servers = new ServersInner(restClient().retrofit(), this); + this.databases = new DatabasesInner(restClient().retrofit(), this); + this.elasticPools = new ElasticPoolsInner(restClient().retrofit(), this); + this.firewallRules = new FirewallRulesInner(restClient().retrofit(), this); + this.recommendedElasticPools = new RecommendedElasticPoolsInner(restClient().retrofit(), this); + this.replicationLinks = new ReplicationLinksInner(restClient().retrofit(), this); + this.elasticPoolActivities = new ElasticPoolActivitiesInner(restClient().retrofit(), this); + this.elasticPoolDatabaseActivities = new ElasticPoolDatabaseActivitiesInner(restClient().retrofit(), this); + this.serviceTierAdvisors = new ServiceTierAdvisorsInner(restClient().retrofit(), this); + this.transparentDataEncryptions = new TransparentDataEncryptionsInner(restClient().retrofit(), this); + this.transparentDataEncryptionActivities = new TransparentDataEncryptionActivitiesInner(restClient().retrofit(), this); + this.databaseThreatDetectionPolicies = new DatabaseThreatDetectionPoliciesInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "SqlManagementClient", "2014-04-01"); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManager.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManager.java new file mode 100644 index 0000000000000..48bcb3d5c4a75 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/SqlManager.java @@ -0,0 +1,231 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.sql.v2014_04_01.Servers; +import com.microsoft.azure.management.sql.v2014_04_01.Databases; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPools; +import com.microsoft.azure.management.sql.v2014_04_01.FirewallRules; +import com.microsoft.azure.management.sql.v2014_04_01.RecommendedElasticPools; +import com.microsoft.azure.management.sql.v2014_04_01.ReplicationLinks; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolActivities; +import com.microsoft.azure.management.sql.v2014_04_01.ElasticPoolDatabaseActivities; +import com.microsoft.azure.management.sql.v2014_04_01.ServiceTierAdvisors; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptions; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivities; +import com.microsoft.azure.management.sql.v2014_04_01.DatabaseThreatDetectionPolicies; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Sql resource management. + */ +public final class SqlManager extends ManagerCore { + private Servers servers; + private Databases databases; + private ElasticPools elasticPools; + private FirewallRules firewallRules; + private RecommendedElasticPools recommendedElasticPools; + private ReplicationLinks replicationLinks; + private ElasticPoolActivities elasticPoolActivities; + private ElasticPoolDatabaseActivities elasticPoolDatabaseActivities; + private ServiceTierAdvisors serviceTierAdvisors; + private TransparentDataEncryptions transparentDataEncryptions; + private TransparentDataEncryptionActivities transparentDataEncryptionActivities; + private DatabaseThreatDetectionPolicies databaseThreatDetectionPolicies; + /** + * Get a Configurable instance that can be used to create SqlManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SqlManager.ConfigurableImpl(); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SqlManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(RestClient restClient, String subscriptionId) { + return new SqlManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SqlManager that exposes Sql management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Sql management API entry points that work across subscriptions + */ + SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Servers. + */ + public Servers servers() { + if (this.servers == null) { + this.servers = new ServersImpl(this); + } + return this.servers; + } + + /** + * @return Entry point to manage Databases. + */ + public Databases databases() { + if (this.databases == null) { + this.databases = new DatabasesImpl(this); + } + return this.databases; + } + + /** + * @return Entry point to manage ElasticPools. + */ + public ElasticPools elasticPools() { + if (this.elasticPools == null) { + this.elasticPools = new ElasticPoolsImpl(this); + } + return this.elasticPools; + } + + /** + * @return Entry point to manage FirewallRules. + */ + public FirewallRules firewallRules() { + if (this.firewallRules == null) { + this.firewallRules = new FirewallRulesImpl(this); + } + return this.firewallRules; + } + + /** + * @return Entry point to manage RecommendedElasticPools. + */ + public RecommendedElasticPools recommendedElasticPools() { + if (this.recommendedElasticPools == null) { + this.recommendedElasticPools = new RecommendedElasticPoolsImpl(this); + } + return this.recommendedElasticPools; + } + + /** + * @return Entry point to manage ReplicationLinks. + */ + public ReplicationLinks replicationLinks() { + if (this.replicationLinks == null) { + this.replicationLinks = new ReplicationLinksImpl(this); + } + return this.replicationLinks; + } + + /** + * @return Entry point to manage ElasticPoolActivities. + */ + public ElasticPoolActivities elasticPoolActivities() { + if (this.elasticPoolActivities == null) { + this.elasticPoolActivities = new ElasticPoolActivitiesImpl(this); + } + return this.elasticPoolActivities; + } + + /** + * @return Entry point to manage ElasticPoolDatabaseActivities. + */ + public ElasticPoolDatabaseActivities elasticPoolDatabaseActivities() { + if (this.elasticPoolDatabaseActivities == null) { + this.elasticPoolDatabaseActivities = new ElasticPoolDatabaseActivitiesImpl(this); + } + return this.elasticPoolDatabaseActivities; + } + + /** + * @return Entry point to manage ServiceTierAdvisors. + */ + public ServiceTierAdvisors serviceTierAdvisors() { + if (this.serviceTierAdvisors == null) { + this.serviceTierAdvisors = new ServiceTierAdvisorsImpl(this); + } + return this.serviceTierAdvisors; + } + + /** + * @return Entry point to manage TransparentDataEncryptions. + */ + public TransparentDataEncryptions transparentDataEncryptions() { + if (this.transparentDataEncryptions == null) { + this.transparentDataEncryptions = new TransparentDataEncryptionsImpl(this); + } + return this.transparentDataEncryptions; + } + + /** + * @return Entry point to manage TransparentDataEncryptionActivities. + */ + public TransparentDataEncryptionActivities transparentDataEncryptionActivities() { + if (this.transparentDataEncryptionActivities == null) { + this.transparentDataEncryptionActivities = new TransparentDataEncryptionActivitiesImpl(this); + } + return this.transparentDataEncryptionActivities; + } + + /** + * @return Entry point to manage DatabaseThreatDetectionPolicies. + */ + public DatabaseThreatDetectionPolicies databaseThreatDetectionPolicies() { + if (this.databaseThreatDetectionPolicies == null) { + this.databaseThreatDetectionPolicies = new DatabaseThreatDetectionPoliciesImpl(this); + } + return this.databaseThreatDetectionPolicies; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SqlManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SqlManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SqlManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesImpl.java new file mode 100644 index 0000000000000..36994fcb89bf8 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesImpl.java @@ -0,0 +1,49 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivities; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivity; + +class TransparentDataEncryptionActivitiesImpl extends WrapperImpl implements TransparentDataEncryptionActivities { + private final SqlManager manager; + + TransparentDataEncryptionActivitiesImpl(SqlManager manager) { + super(manager.inner().transparentDataEncryptionActivities()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByConfigurationAsync(String resourceGroupName, String serverName, String databaseName) { + TransparentDataEncryptionActivitiesInner client = this.inner(); + return client.listByConfigurationAsync(resourceGroupName, serverName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public TransparentDataEncryptionActivity call(TransparentDataEncryptionActivityInner inner) { + return new TransparentDataEncryptionActivityImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesInner.java new file mode 100644 index 0000000000000..61af0ac2e78e8 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesInner.java @@ -0,0 +1,160 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in TransparentDataEncryptionActivities. + */ +public class TransparentDataEncryptionActivitiesInner { + /** The Retrofit service to perform REST calls. */ + private TransparentDataEncryptionActivitiesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of TransparentDataEncryptionActivitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TransparentDataEncryptionActivitiesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(TransparentDataEncryptionActivitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for TransparentDataEncryptionActivities to be + * used by Retrofit to perform actually REST calls. + */ + interface TransparentDataEncryptionActivitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivities listByConfiguration" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}/operationResults") + Observable> listByConfiguration(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("transparentDataEncryptionName") String transparentDataEncryptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 for which the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<TransparentDataEncryptionActivityInner> object if successful. + */ + public List listByConfiguration(String resourceGroupName, String serverName, String databaseName) { + return listByConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 for which the transparent data encryption applies. + * @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> listByConfigurationAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 for which the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<TransparentDataEncryptionActivityInner> object + */ + public Observable> listByConfigurationAsync(String resourceGroupName, String serverName, String databaseName) { + return listByConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a database's transparent data encryption operation result. + * + * @param resourceGroupName The 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 for which the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<TransparentDataEncryptionActivityInner> object + */ + public Observable>> listByConfigurationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String transparentDataEncryptionName = "current"; + return service.listByConfiguration(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, transparentDataEncryptionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByConfigurationDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByConfigurationDelegate(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/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivityImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivityImpl.java new file mode 100644 index 0000000000000..0c0b0f10946f0 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivityImpl.java @@ -0,0 +1,57 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivity; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivityStatus; + +class TransparentDataEncryptionActivityImpl extends WrapperImpl implements TransparentDataEncryptionActivity { + private final SqlManager manager; + TransparentDataEncryptionActivityImpl(TransparentDataEncryptionActivityInner 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 location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Double percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public TransparentDataEncryptionActivityStatus status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivityInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivityInner.java new file mode 100644 index 0000000000000..720e8ca7803ff --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivityInner.java @@ -0,0 +1,68 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionActivityStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database transparent data encryption Scan. + */ +@JsonFlatten +public class TransparentDataEncryptionActivityInner extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The status of the database. Possible values include: 'Encrypting', + * 'Decrypting'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private TransparentDataEncryptionActivityStatus status; + + /** + * The percent complete of the transparent data encryption scan for a + * database. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Double percentComplete; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the status of the database. Possible values include: 'Encrypting', 'Decrypting'. + * + * @return the status value + */ + public TransparentDataEncryptionActivityStatus status() { + return this.status; + } + + /** + * Get the percent complete of the transparent data encryption scan for a database. + * + * @return the percentComplete value + */ + public Double percentComplete() { + return this.percentComplete; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionImpl.java new file mode 100644 index 0000000000000..8e5684f91121d --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionImpl.java @@ -0,0 +1,52 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryption; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionStatus; + +class TransparentDataEncryptionImpl extends WrapperImpl implements TransparentDataEncryption { + private final SqlManager manager; + TransparentDataEncryptionImpl(TransparentDataEncryptionInner 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 location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public TransparentDataEncryptionStatus status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionInner.java new file mode 100644 index 0000000000000..38eb1a8aa63b5 --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionInner.java @@ -0,0 +1,63 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Represents a database transparent data encryption configuration. + */ +@JsonFlatten +public class TransparentDataEncryptionInner extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The status of the database transparent data encryption. Possible values + * include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.status") + private TransparentDataEncryptionStatus status; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled'. + * + * @return the status value + */ + public TransparentDataEncryptionStatus status() { + return this.status; + } + + /** + * Set the status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled'. + * + * @param status the status value to set + * @return the TransparentDataEncryptionInner object itself. + */ + public TransparentDataEncryptionInner withStatus(TransparentDataEncryptionStatus status) { + this.status = status; + return this; + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsImpl.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsImpl.java new file mode 100644 index 0000000000000..e00a1d23c466e --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsImpl.java @@ -0,0 +1,54 @@ +/** + * 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.v2014_04_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryption; + +class TransparentDataEncryptionsImpl extends WrapperImpl implements TransparentDataEncryptions { + private final SqlManager manager; + + TransparentDataEncryptionsImpl(SqlManager manager) { + super(manager.inner().transparentDataEncryptions()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + TransparentDataEncryptionsInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public TransparentDataEncryption call(TransparentDataEncryptionInner inner) { + return new TransparentDataEncryptionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + TransparentDataEncryptionsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public TransparentDataEncryption call(TransparentDataEncryptionInner inner) { + return new TransparentDataEncryptionImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsInner.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsInner.java new file mode 100644 index 0000000000000..e46177c8bb32b --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionsInner.java @@ -0,0 +1,352 @@ +/** + * 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.v2014_04_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptionStatus; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in TransparentDataEncryptions. + */ +public class TransparentDataEncryptionsInner { + /** The Retrofit service to perform REST calls. */ + private TransparentDataEncryptionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of TransparentDataEncryptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TransparentDataEncryptionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(TransparentDataEncryptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for TransparentDataEncryptions to be + * used by Retrofit to perform actually REST calls. + */ + interface TransparentDataEncryptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("transparentDataEncryptionName") String transparentDataEncryptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TransparentDataEncryptionInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2014_04_01.TransparentDataEncryptions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{transparentDataEncryptionName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("transparentDataEncryptionName") String transparentDataEncryptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 for which setting the transparent data encryption applies. + * @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 TransparentDataEncryptionInner object if successful. + */ + public TransparentDataEncryptionInner createOrUpdate(String resourceGroupName, String serverName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 for which setting the transparent data encryption applies. + * @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, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 for which setting the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, TransparentDataEncryptionInner>() { + @Override + public TransparentDataEncryptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 for which setting the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String transparentDataEncryptionName = "current"; + final TransparentDataEncryptionStatus status = null; + TransparentDataEncryptionInner parameters = new TransparentDataEncryptionInner(); + parameters.withStatus(null); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, transparentDataEncryptionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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); + } + } + }); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 for which setting the transparent data encryption applies. + * @param status The status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled' + * @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 TransparentDataEncryptionInner object if successful. + */ + public TransparentDataEncryptionInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionStatus status) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, status).toBlocking().single().body(); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 for which setting the transparent data encryption applies. + * @param status The status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled' + * @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, TransparentDataEncryptionStatus status, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, status), serviceCallback); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 for which setting the transparent data encryption applies. + * @param status The status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionStatus status) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, status).map(new Func1, TransparentDataEncryptionInner>() { + @Override + public TransparentDataEncryptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 for which setting the transparent data encryption applies. + * @param status The status of the database transparent data encryption. Possible values include: 'Enabled', 'Disabled' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionStatus status) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String transparentDataEncryptionName = "current"; + TransparentDataEncryptionInner parameters = new TransparentDataEncryptionInner(); + parameters.withStatus(status); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, transparentDataEncryptionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 for which the transparent data encryption applies. + * @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 TransparentDataEncryptionInner object if successful. + */ + public TransparentDataEncryptionInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 for which the transparent data encryption applies. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 for which the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, TransparentDataEncryptionInner>() { + @Override + public TransparentDataEncryptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's transparent data encryption configuration. + * + * @param resourceGroupName The 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 for which the transparent data encryption applies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransparentDataEncryptionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + 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.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String transparentDataEncryptionName = "current"; + return service.get(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, transparentDataEncryptionName, 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); + } + +} diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/package-info.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/package-info.java new file mode 100644 index 0000000000000..cee659caf32dc --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v2014_04_01.implementation; diff --git a/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/package-info.java b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/package-info.java new file mode 100644 index 0000000000000..20de3edad10df --- /dev/null +++ b/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v2014_04_01; diff --git a/sql/resource-manager/v2017_10_01_preview/pom.xml b/sql/resource-manager/v2017_10_01_preview/pom.xml new file mode 100644 index 0000000000000..c8dd3d5addf73 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.sql.v2017_10_01_preview + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-sql + 1.0.0-beta + jar + Microsoft Azure SDK for Sql Management + This package contains Microsoft Sql Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/BackupShortTermRetentionPolicies.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/BackupShortTermRetentionPolicies.java new file mode 100644 index 0000000000000..3f82eafccc3f9 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/BackupShortTermRetentionPolicies.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_10_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.BackupShortTermRetentionPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BackupShortTermRetentionPolicies. + */ +public interface BackupShortTermRetentionPolicies extends SupportsCreating, HasInner { + /** + * Gets a 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 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 getAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a 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 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_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/BackupShortTermRetentionPolicy.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/BackupShortTermRetentionPolicy.java new file mode 100644 index 0000000000000..32dcb53fb9d06 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/BackupShortTermRetentionPolicy.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_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.BackupShortTermRetentionPolicyInner; +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_10_01_preview.implementation.SqlManager; + +/** + * Type representing BackupShortTermRetentionPolicy. + */ +public interface BackupShortTermRetentionPolicy 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 BackupShortTermRetentionPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of BackupShortTermRetentionPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a BackupShortTermRetentionPolicy definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the backupshorttermretentionpolicy definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, serverName, databaseName. + */ + WithCreate withExistingDatabasis(String resourceGroupName, String serverName, String databaseName); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a BackupShortTermRetentionPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of BackupShortTermRetentionPolicy update stages. + */ + interface UpdateStages { + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Capabilities.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Capabilities.java new file mode 100644 index 0000000000000..07145c4dede45 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Capabilities.java @@ -0,0 +1,26 @@ +/** + * 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_10_01_preview; + +import rx.Observable; + +/** + * Type representing Capabilities. + */ +public interface Capabilities { + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(String locationName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CapabilityGroup.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CapabilityGroup.java new file mode 100644 index 0000000000000..5be26e7734d34 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CapabilityGroup.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CapabilityGroup. + */ +public final class CapabilityGroup extends ExpandableStringEnum { + /** Static value supportedEditions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_EDITIONS = fromString("supportedEditions"); + + /** Static value supportedElasticPoolEditions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_ELASTIC_POOL_EDITIONS = fromString("supportedElasticPoolEditions"); + + /** Static value supportedManagedInstanceVersions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_MANAGED_INSTANCE_VERSIONS = fromString("supportedManagedInstanceVersions"); + + /** + * Creates or finds a CapabilityGroup from its string representation. + * @param name a name to look for + * @return the corresponding CapabilityGroup + */ + @JsonCreator + public static CapabilityGroup fromString(String name) { + return fromString(name, CapabilityGroup.class); + } + + /** + * @return known CapabilityGroup values + */ + public static Collection values() { + return values(CapabilityGroup.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CapabilityStatus.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CapabilityStatus.java new file mode 100644 index 0000000000000..4306f9745d4fd --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CapabilityStatus.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CapabilityStatus. + */ +public enum CapabilityStatus { + /** Enum value Visible. */ + VISIBLE("Visible"), + + /** Enum value Available. */ + AVAILABLE("Available"), + + /** Enum value Default. */ + DEFAULT("Default"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a CapabilityStatus instance. */ + private String value; + + CapabilityStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CapabilityStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed CapabilityStatus object, or null if unable to parse. + */ + @JsonCreator + public static CapabilityStatus fromString(String value) { + CapabilityStatus[] items = CapabilityStatus.values(); + for (CapabilityStatus 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_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CatalogCollationType.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CatalogCollationType.java new file mode 100644 index 0000000000000..de060acd99ae8 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CatalogCollationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CatalogCollationType. + */ +public final class CatalogCollationType extends ExpandableStringEnum { + /** Static value DATABASE_DEFAULT for CatalogCollationType. */ + public static final CatalogCollationType DATABASE_DEFAULT = fromString("DATABASE_DEFAULT"); + + /** Static value SQL_Latin1_General_CP1_CI_AS for CatalogCollationType. */ + public static final CatalogCollationType SQL_LATIN1_GENERAL_CP1_CI_AS = fromString("SQL_Latin1_General_CP1_CI_AS"); + + /** + * Creates or finds a CatalogCollationType from its string representation. + * @param name a name to look for + * @return the corresponding CatalogCollationType + */ + @JsonCreator + public static CatalogCollationType fromString(String name) { + return fromString(name, CatalogCollationType.class); + } + + /** + * @return known CatalogCollationType values + */ + public static Collection values() { + return values(CatalogCollationType.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CreateMode.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CreateMode.java new file mode 100644 index 0000000000000..ff711aa5a8ccb --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/CreateMode.java @@ -0,0 +1,65 @@ +/** + * 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_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CreateMode. + */ +public final class CreateMode extends ExpandableStringEnum { + /** Static value Default for CreateMode. */ + public static final CreateMode DEFAULT = fromString("Default"); + + /** Static value Copy for CreateMode. */ + public static final CreateMode COPY = fromString("Copy"); + + /** Static value Secondary for CreateMode. */ + public static final CreateMode SECONDARY = fromString("Secondary"); + + /** Static value PointInTimeRestore for CreateMode. */ + public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** Static value Restore for CreateMode. */ + public static final CreateMode RESTORE = fromString("Restore"); + + /** Static value Recovery for CreateMode. */ + public static final CreateMode RECOVERY = fromString("Recovery"); + + /** Static value RestoreExternalBackup for CreateMode. */ + public static final CreateMode RESTORE_EXTERNAL_BACKUP = fromString("RestoreExternalBackup"); + + /** Static value RestoreExternalBackupSecondary for CreateMode. */ + public static final CreateMode RESTORE_EXTERNAL_BACKUP_SECONDARY = fromString("RestoreExternalBackupSecondary"); + + /** Static value RestoreLongTermRetentionBackup for CreateMode. */ + public static final CreateMode RESTORE_LONG_TERM_RETENTION_BACKUP = fromString("RestoreLongTermRetentionBackup"); + + /** Static value OnlineSecondary for CreateMode. */ + public static final CreateMode ONLINE_SECONDARY = fromString("OnlineSecondary"); + + /** + * Creates or finds a CreateMode from its string representation. + * @param name a name to look for + * @return the corresponding CreateMode + */ + @JsonCreator + public static CreateMode fromString(String name) { + return fromString(name, CreateMode.class); + } + + /** + * @return known CreateMode values + */ + public static Collection values() { + return values(CreateMode.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Database.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Database.java new file mode 100644 index 0000000000000..67c6cc9fd40b0 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Database.java @@ -0,0 +1,613 @@ +/** + * 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_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.DatabaseInner; +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_10_01_preview.implementation.SqlManager; +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing Database. + */ +public interface Database extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the catalogCollation value. + */ + CatalogCollationType catalogCollation(); + + /** + * @return the collation value. + */ + String collation(); + + /** + * @return the createMode value. + */ + CreateMode createMode(); + + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the currentServiceObjectiveName value. + */ + String currentServiceObjectiveName(); + + /** + * @return the currentSku value. + */ + Sku currentSku(); + + /** + * @return the databaseId value. + */ + UUID databaseId(); + + /** + * @return the defaultSecondaryLocation value. + */ + String defaultSecondaryLocation(); + + /** + * @return the earliestRestoreDate value. + */ + DateTime earliestRestoreDate(); + + /** + * @return the elasticPoolId value. + */ + String elasticPoolId(); + + /** + * @return the failoverGroupId value. + */ + String failoverGroupId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the licenseType value. + */ + DatabaseLicenseType licenseType(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the longTermRetentionBackupResourceId value. + */ + String longTermRetentionBackupResourceId(); + + /** + * @return the managedBy value. + */ + String managedBy(); + + /** + * @return the maxLogSizeBytes value. + */ + Long maxLogSizeBytes(); + + /** + * @return the maxSizeBytes value. + */ + Long maxSizeBytes(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the readScale value. + */ + DatabaseReadScale readScale(); + + /** + * @return the recoverableDatabaseId value. + */ + String recoverableDatabaseId(); + + /** + * @return the recoveryServicesRecoveryPointId value. + */ + String recoveryServicesRecoveryPointId(); + + /** + * @return the requestedServiceObjectiveName value. + */ + String requestedServiceObjectiveName(); + + /** + * @return the restorableDroppedDatabaseId value. + */ + String restorableDroppedDatabaseId(); + + /** + * @return the restorePointInTime value. + */ + DateTime restorePointInTime(); + + /** + * @return the sampleName value. + */ + SampleName sampleName(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the sourceDatabaseDeletionDate value. + */ + DateTime sourceDatabaseDeletionDate(); + + /** + * @return the sourceDatabaseId value. + */ + String sourceDatabaseId(); + + /** + * @return the status value. + */ + DatabaseStatus status(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * The entirety of the Database definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of Database definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Database definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the database definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithLocation withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the database definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the database definition allowing to specify CatalogCollation. + */ + interface WithCatalogCollation { + /** + * Specifies catalogCollation. + */ + WithCreate withCatalogCollation(CatalogCollationType catalogCollation); + } + + /** + * The stage of the database definition allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + WithCreate withCollation(String collation); + } + + /** + * The stage of the database definition allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + WithCreate withCreateMode(CreateMode createMode); + } + + /** + * The stage of the database definition allowing to specify ElasticPoolId. + */ + interface WithElasticPoolId { + /** + * Specifies elasticPoolId. + */ + WithCreate withElasticPoolId(String elasticPoolId); + } + + /** + * The stage of the database definition allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + WithCreate withLicenseType(DatabaseLicenseType licenseType); + } + + /** + * The stage of the database definition allowing to specify LongTermRetentionBackupResourceId. + */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies longTermRetentionBackupResourceId. + */ + WithCreate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + + /** + * The stage of the database definition allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + WithCreate withMaxSizeBytes(Long maxSizeBytes); + } + + /** + * The stage of the database definition allowing to specify ReadScale. + */ + interface WithReadScale { + /** + * Specifies readScale. + */ + WithCreate withReadScale(DatabaseReadScale readScale); + } + + /** + * The stage of the database definition allowing to specify RecoverableDatabaseId. + */ + interface WithRecoverableDatabaseId { + /** + * Specifies recoverableDatabaseId. + */ + WithCreate withRecoverableDatabaseId(String recoverableDatabaseId); + } + + /** + * The stage of the database definition allowing to specify RecoveryServicesRecoveryPointId. + */ + interface WithRecoveryServicesRecoveryPointId { + /** + * Specifies recoveryServicesRecoveryPointId. + */ + WithCreate withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId); + } + + /** + * The stage of the database definition allowing to specify RestorableDroppedDatabaseId. + */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies restorableDroppedDatabaseId. + */ + WithCreate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + + /** + * The stage of the database definition allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + WithCreate withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the database definition allowing to specify SampleName. + */ + interface WithSampleName { + /** + * Specifies sampleName. + */ + WithCreate withSampleName(SampleName sampleName); + } + + /** + * The stage of the database definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the database definition allowing to specify SourceDatabaseDeletionDate. + */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies sourceDatabaseDeletionDate. + */ + WithCreate withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate); + } + + /** + * The stage of the database definition allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + WithCreate withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the database definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the database definition allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + + /** + * 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.WithCatalogCollation, DefinitionStages.WithCollation, DefinitionStages.WithCreateMode, DefinitionStages.WithElasticPoolId, DefinitionStages.WithLicenseType, DefinitionStages.WithLongTermRetentionBackupResourceId, DefinitionStages.WithMaxSizeBytes, DefinitionStages.WithReadScale, DefinitionStages.WithRecoverableDatabaseId, DefinitionStages.WithRecoveryServicesRecoveryPointId, DefinitionStages.WithRestorableDroppedDatabaseId, DefinitionStages.WithRestorePointInTime, DefinitionStages.WithSampleName, DefinitionStages.WithSku, DefinitionStages.WithSourceDatabaseDeletionDate, DefinitionStages.WithSourceDatabaseId, DefinitionStages.WithTags, DefinitionStages.WithZoneRedundant { + } + } + /** + * The template for a Database update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCatalogCollation, UpdateStages.WithCollation, UpdateStages.WithCreateMode, UpdateStages.WithElasticPoolId, UpdateStages.WithLicenseType, UpdateStages.WithLongTermRetentionBackupResourceId, UpdateStages.WithMaxSizeBytes, UpdateStages.WithReadScale, UpdateStages.WithRecoverableDatabaseId, UpdateStages.WithRecoveryServicesRecoveryPointId, UpdateStages.WithRestorableDroppedDatabaseId, UpdateStages.WithRestorePointInTime, UpdateStages.WithSampleName, UpdateStages.WithSku, UpdateStages.WithSourceDatabaseDeletionDate, UpdateStages.WithSourceDatabaseId, UpdateStages.WithTags, UpdateStages.WithZoneRedundant { + } + + /** + * Grouping of Database update stages. + */ + interface UpdateStages { + /** + * The stage of the database update allowing to specify CatalogCollation. + */ + interface WithCatalogCollation { + /** + * Specifies catalogCollation. + */ + Update withCatalogCollation(CatalogCollationType catalogCollation); + } + + /** + * The stage of the database update allowing to specify Collation. + */ + interface WithCollation { + /** + * Specifies collation. + */ + Update withCollation(String collation); + } + + /** + * The stage of the database update allowing to specify CreateMode. + */ + interface WithCreateMode { + /** + * Specifies createMode. + */ + Update withCreateMode(CreateMode createMode); + } + + /** + * The stage of the database update allowing to specify ElasticPoolId. + */ + interface WithElasticPoolId { + /** + * Specifies elasticPoolId. + */ + Update withElasticPoolId(String elasticPoolId); + } + + /** + * The stage of the database update allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + Update withLicenseType(DatabaseLicenseType licenseType); + } + + /** + * The stage of the database update allowing to specify LongTermRetentionBackupResourceId. + */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies longTermRetentionBackupResourceId. + */ + Update withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + + /** + * The stage of the database update allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + Update withMaxSizeBytes(Long maxSizeBytes); + } + + /** + * The stage of the database update allowing to specify ReadScale. + */ + interface WithReadScale { + /** + * Specifies readScale. + */ + Update withReadScale(DatabaseReadScale readScale); + } + + /** + * The stage of the database update allowing to specify RecoverableDatabaseId. + */ + interface WithRecoverableDatabaseId { + /** + * Specifies recoverableDatabaseId. + */ + Update withRecoverableDatabaseId(String recoverableDatabaseId); + } + + /** + * The stage of the database update allowing to specify RecoveryServicesRecoveryPointId. + */ + interface WithRecoveryServicesRecoveryPointId { + /** + * Specifies recoveryServicesRecoveryPointId. + */ + Update withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId); + } + + /** + * The stage of the database update allowing to specify RestorableDroppedDatabaseId. + */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies restorableDroppedDatabaseId. + */ + Update withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + + /** + * The stage of the database update allowing to specify RestorePointInTime. + */ + interface WithRestorePointInTime { + /** + * Specifies restorePointInTime. + */ + Update withRestorePointInTime(DateTime restorePointInTime); + } + + /** + * The stage of the database update allowing to specify SampleName. + */ + interface WithSampleName { + /** + * Specifies sampleName. + */ + Update withSampleName(SampleName sampleName); + } + + /** + * The stage of the database update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the database update allowing to specify SourceDatabaseDeletionDate. + */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies sourceDatabaseDeletionDate. + */ + Update withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate); + } + + /** + * The stage of the database update allowing to specify SourceDatabaseId. + */ + interface WithSourceDatabaseId { + /** + * Specifies sourceDatabaseId. + */ + Update withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The stage of the database update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + /** + * The stage of the database update allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseLicenseType.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseLicenseType.java new file mode 100644 index 0000000000000..95a4681b8d88f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseLicenseType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseLicenseType. + */ +public final class DatabaseLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for DatabaseLicenseType. */ + public static final DatabaseLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for DatabaseLicenseType. */ + public static final DatabaseLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a DatabaseLicenseType from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseLicenseType + */ + @JsonCreator + public static DatabaseLicenseType fromString(String name) { + return fromString(name, DatabaseLicenseType.class); + } + + /** + * @return known DatabaseLicenseType values + */ + public static Collection values() { + return values(DatabaseLicenseType.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseOperation.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseOperation.java new file mode 100644 index 0000000000000..0aead71d2da3f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseOperation.java @@ -0,0 +1,106 @@ +/** + * 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_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.DatabaseOperationInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing DatabaseOperation. + */ +public interface DatabaseOperation extends HasInner, HasManager { + /** + * @return the databaseName value. + */ + String databaseName(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * @return the errorDescription value. + */ + String errorDescription(); + + /** + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * @return the estimatedCompletionTime value. + */ + DateTime estimatedCompletionTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isCancellable value. + */ + Boolean isCancellable(); + + /** + * @return the isUserError value. + */ + Boolean isUserError(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + ManagementOperationState state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseOperations.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseOperations.java new file mode 100644 index 0000000000000..186108b1a4eaa --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseOperations.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import rx.Observable; +import rx.Completable; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.DatabaseOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseOperations. + */ +public interface DatabaseOperations extends HasInner { + /** + * Cancels the asynchronous operation on the 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 operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId); + + /** + * Gets a list of operations performed on the 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_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseReadScale.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseReadScale.java new file mode 100644 index 0000000000000..4cbd6a8f55270 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseReadScale.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseReadScale. + */ +public final class DatabaseReadScale extends ExpandableStringEnum { + /** Static value Enabled for DatabaseReadScale. */ + public static final DatabaseReadScale ENABLED = fromString("Enabled"); + + /** Static value Disabled for DatabaseReadScale. */ + public static final DatabaseReadScale DISABLED = fromString("Disabled"); + + /** + * Creates or finds a DatabaseReadScale from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseReadScale + */ + @JsonCreator + public static DatabaseReadScale fromString(String name) { + return fromString(name, DatabaseReadScale.class); + } + + /** + * @return known DatabaseReadScale values + */ + public static Collection values() { + return values(DatabaseReadScale.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseStatus.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseStatus.java new file mode 100644 index 0000000000000..9f978f320c7d2 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseStatus.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseStatus. + */ +public final class DatabaseStatus extends ExpandableStringEnum { + /** Static value Online for DatabaseStatus. */ + public static final DatabaseStatus ONLINE = fromString("Online"); + + /** Static value Restoring for DatabaseStatus. */ + public static final DatabaseStatus RESTORING = fromString("Restoring"); + + /** Static value RecoveryPending for DatabaseStatus. */ + public static final DatabaseStatus RECOVERY_PENDING = fromString("RecoveryPending"); + + /** Static value Recovering for DatabaseStatus. */ + public static final DatabaseStatus RECOVERING = fromString("Recovering"); + + /** Static value Suspect for DatabaseStatus. */ + public static final DatabaseStatus SUSPECT = fromString("Suspect"); + + /** Static value Offline for DatabaseStatus. */ + public static final DatabaseStatus OFFLINE = fromString("Offline"); + + /** Static value Standby for DatabaseStatus. */ + public static final DatabaseStatus STANDBY = fromString("Standby"); + + /** Static value Shutdown for DatabaseStatus. */ + public static final DatabaseStatus SHUTDOWN = fromString("Shutdown"); + + /** Static value EmergencyMode for DatabaseStatus. */ + public static final DatabaseStatus EMERGENCY_MODE = fromString("EmergencyMode"); + + /** Static value AutoClosed for DatabaseStatus. */ + public static final DatabaseStatus AUTO_CLOSED = fromString("AutoClosed"); + + /** Static value Copying for DatabaseStatus. */ + public static final DatabaseStatus COPYING = fromString("Copying"); + + /** Static value Creating for DatabaseStatus. */ + public static final DatabaseStatus CREATING = fromString("Creating"); + + /** Static value Inaccessible for DatabaseStatus. */ + public static final DatabaseStatus INACCESSIBLE = fromString("Inaccessible"); + + /** Static value OfflineSecondary for DatabaseStatus. */ + public static final DatabaseStatus OFFLINE_SECONDARY = fromString("OfflineSecondary"); + + /** Static value Pausing for DatabaseStatus. */ + public static final DatabaseStatus PAUSING = fromString("Pausing"); + + /** Static value Paused for DatabaseStatus. */ + public static final DatabaseStatus PAUSED = fromString("Paused"); + + /** Static value Resuming for DatabaseStatus. */ + public static final DatabaseStatus RESUMING = fromString("Resuming"); + + /** Static value Scaling for DatabaseStatus. */ + public static final DatabaseStatus SCALING = fromString("Scaling"); + + /** + * Creates or finds a DatabaseStatus from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseStatus + */ + @JsonCreator + public static DatabaseStatus fromString(String name) { + return fromString(name, DatabaseStatus.class); + } + + /** + * @return known DatabaseStatus values + */ + public static Collection values() { + return values(DatabaseStatus.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseUpdate.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseUpdate.java new file mode 100644 index 0000000000000..eafe8ef45060a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseUpdate.java @@ -0,0 +1,712 @@ +/** + * 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_10_01_preview; + +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A database resource. + */ +@JsonFlatten +public class DatabaseUpdate { + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * Secondary: creates a database as a secondary replica of an existing + * database. sourceDatabaseId must be specified as the resource ID of the + * existing primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported + * for DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /** + * The collation of the database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The name of the sample schema to apply when creating this database. + * Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', + * 'WideWorldImportersFull'. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /** + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "properties.elasticPoolId") + private String elasticPoolId; + + /** + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * The status of the database. Possible values include: 'Online', + * 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', + * 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', + * 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', + * 'Resuming', 'Scaling'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /** + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The current service level objective name of the database. + */ + @JsonProperty(value = "properties.currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /** + * The requested service level objective name of the database. + */ + @JsonProperty(value = "properties.requestedServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjectiveName; + + /** + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private DateTime sourceDatabaseDeletionDate; + + /** + * The resource identifier of the recovery point associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /** + * The resource identifier of the long term retention backup associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /** + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /** + * The resource identifier of the restorable dropped database associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /** + * Collation of the metadata catalog. Possible values include: + * 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /** + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * The license type to apply for this database. Possible values include: + * 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private DatabaseLicenseType licenseType; + + /** + * The max log size for this database. + */ + @JsonProperty(value = "properties.maxLogSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long maxLogSizeBytes; + + /** + * This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * The state of read-only routing. If enabled, connections that have + * application intent set to readonly in their connection string may be + * routed to a readonly secondary replica in the same region. Possible + * values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.readScale") + private DatabaseReadScale readScale; + + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "properties.currentSku", access = JsonProperty.Access.WRITE_ONLY) + private Sku currentSku; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the name and tier of the SKU. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the name and tier of the SKU. + * + * @param sku the sku value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + * + * @param createMode the createMode value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the collation of the database. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation of the database. + * + * @param collation the collation value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the max size of the database expressed in bytes. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the max size of the database expressed in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @return the sampleName value + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @param sampleName the sampleName value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get the resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value + */ + public String elasticPoolId() { + return this.elasticPoolId; + } + + /** + * Set the resource identifier of the elastic pool containing this database. + * + * @param elasticPoolId the elasticPoolId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withElasticPoolId(String elasticPoolId) { + this.elasticPoolId = elasticPoolId; + return this; + } + + /** + * Get the resource identifier of the source database associated with create operation of this database. + * + * @return the sourceDatabaseId value + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set the resource identifier of the source database associated with create operation of this database. + * + * @param sourceDatabaseId the sourceDatabaseId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the status of the database. Possible values include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling'. + * + * @return the status value + */ + public DatabaseStatus status() { + return this.status; + } + + /** + * Get the ID of the database. + * + * @return the databaseId value + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the current service level objective name of the database. + * + * @return the currentServiceObjectiveName value + */ + public String currentServiceObjectiveName() { + return this.currentServiceObjectiveName; + } + + /** + * Get the requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value + */ + public String requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Get the default secondary region for this database. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value + */ + public DateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get the resource identifier of the recovery point associated with create operation of this database. + * + * @return the recoveryServicesRecoveryPointId value + */ + public String recoveryServicesRecoveryPointId() { + return this.recoveryServicesRecoveryPointId; + } + + /** + * Set the resource identifier of the recovery point associated with create operation of this database. + * + * @param recoveryServicesRecoveryPointId the recoveryServicesRecoveryPointId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.recoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; + return this; + } + + /** + * Get the resource identifier of the long term retention backup associated with create operation of this database. + * + * @return the longTermRetentionBackupResourceId value + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the resource identifier of the long term retention backup associated with create operation of this database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * 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 DatabaseUpdate object itself. + */ + public DatabaseUpdate withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @return the restorableDroppedDatabaseId value + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * Get collation of the metadata catalog. Possible values include: 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + * + * @return the catalogCollation value + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set collation of the metadata catalog. Possible values include: 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + * + * @param catalogCollation the catalogCollation value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the license type to apply for this database. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public DatabaseLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type to apply for this database. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withLicenseType(DatabaseLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the max log size for this database. + * + * @return the maxLogSizeBytes value + */ + public Long maxLogSizeBytes() { + return this.maxLogSizeBytes; + } + + /** + * Get this records the earliest start date and time that restore is available for this database (ISO8601 format). + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'Enabled', 'Disabled'. + * + * @return the readScale value + */ + public DatabaseReadScale readScale() { + return this.readScale; + } + + /** + * Set the state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'Enabled', 'Disabled'. + * + * @param readScale the readScale value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withReadScale(DatabaseReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get the name and tier of the SKU. + * + * @return the currentSku value + */ + public Sku currentSku() { + return this.currentSku; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java new file mode 100644 index 0000000000000..b363f4918cf43 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessment.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database vulnerability assessment. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessment extends ProxyResource { + /** + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "properties.storageContainerPath", required = true) + private String storageContainerPath; + + /** + * A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. + */ + @JsonProperty(value = "properties.storageContainerSasKey", required = true) + private String storageContainerSasKey; + + /** + * The recurring scans settings. + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set a blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + * + * @param storageContainerPath the storageContainerPath value to set + * @return the DatabaseVulnerabilityAssessment object itself. + */ + public DatabaseVulnerabilityAssessment withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * Get a shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. + * + * @return the storageContainerSasKey value + */ + public String storageContainerSasKey() { + return this.storageContainerSasKey; + } + + /** + * Set a shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. + * + * @param storageContainerSasKey the storageContainerSasKey value to set + * @return the DatabaseVulnerabilityAssessment object itself. + */ + public DatabaseVulnerabilityAssessment withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get the recurring scans settings. + * + * @return the recurringScans value + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurring scans settings. + * + * @param recurringScans the recurringScans value to set + * @return the DatabaseVulnerabilityAssessment object itself. + */ + public DatabaseVulnerabilityAssessment withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.java new file mode 100644 index 0000000000000..b57f178bb0dcb --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScans.java @@ -0,0 +1,66 @@ +/** + * 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_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanRecord; +import rx.Completable; + +/** + * Type representing DatabaseVulnerabilityAssessmentScans. + */ +public interface DatabaseVulnerabilityAssessmentScans { + /** + * Gets a vulnerability assessment scan record of 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId); + + /** + * Lists the vulnerability assessment scans of 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 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); + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable initiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId); + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportAsync(String resourceGroupName, String serverName, String databaseName, String scanId); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScansExport.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScansExport.java new file mode 100644 index 0000000000000..c0a9252568d1d --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/DatabaseVulnerabilityAssessmentScansExport.java @@ -0,0 +1,40 @@ +/** + * 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_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.DatabaseVulnerabilityAssessmentScansExportInner; + +/** + * Type representing DatabaseVulnerabilityAssessmentScansExport. + */ +public interface DatabaseVulnerabilityAssessmentScansExport extends HasInner, HasManager { + /** + * @return the exportedReportLocation value. + */ + String exportedReportLocation(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Databases.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Databases.java new file mode 100644 index 0000000000000..a0ce679208269 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Databases.java @@ -0,0 +1,109 @@ +/** + * 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_10_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.DatabasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Databases. + */ +public interface Databases extends SupportsCreating, HasInner { + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 to be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName); + + /** + * Pauses 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 serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable pauseAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Resumes 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 serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable resumeAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Renames 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 serverName The name of the server. + * @param databaseName The name of the database to rename. + * @param id The target ID for the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable renameAsync(String resourceGroupName, String serverName, String databaseName, String id); + + /** + * Gets 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 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 getAsync(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of 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 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); + + /** + * Deletes the 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 + */ + Completable deleteAsync(String resourceGroupName, String serverName, String databaseName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/EditionCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/EditionCapability.java new file mode 100644 index 0000000000000..881e52b8594b1 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/EditionCapability.java @@ -0,0 +1,105 @@ +/** + * 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_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The edition capability. + */ +public class EditionCapability { + /** + * The database edition name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported service objectives for the edition. + */ + @JsonProperty(value = "supportedServiceLevelObjectives", access = JsonProperty.Access.WRITE_ONLY) + private List supportedServiceLevelObjectives; + + /** + * Whether or not zone redundancy is supported for the edition. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the database edition name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported service objectives for the edition. + * + * @return the supportedServiceLevelObjectives value + */ + public List supportedServiceLevelObjectives() { + return this.supportedServiceLevelObjectives; + } + + /** + * Get whether or not zone redundancy is supported for the edition. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the EditionCapability object itself. + */ + public EditionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPool.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPool.java new file mode 100644 index 0000000000000..9af9d5d6f326e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPool.java @@ -0,0 +1,267 @@ +/** + * 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_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ElasticPoolInner; +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_10_01_preview.implementation.SqlManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ElasticPool. + */ +public interface ElasticPool extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the licenseType value. + */ + ElasticPoolLicenseType licenseType(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the maxSizeBytes value. + */ + Long maxSizeBytes(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the perDatabaseSettings value. + */ + ElasticPoolPerDatabaseSettings perDatabaseSettings(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the state value. + */ + ElasticPoolState state(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * The entirety of the ElasticPool definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithServer, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of ElasticPool definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ElasticPool definition. + */ + interface Blank extends WithServer { + } + + /** + * The stage of the elasticpool definition allowing to specify Server. + */ + interface WithServer { + /** + * Specifies resourceGroupName, serverName. + */ + WithLocation withExistingServer(String resourceGroupName, String serverName); + } + + /** + * The stage of the elasticpool definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the elasticpool definition allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + WithCreate withLicenseType(ElasticPoolLicenseType licenseType); + } + + /** + * The stage of the elasticpool definition allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + WithCreate withMaxSizeBytes(Long maxSizeBytes); + } + + /** + * The stage of the elasticpool definition allowing to specify PerDatabaseSettings. + */ + interface WithPerDatabaseSettings { + /** + * Specifies perDatabaseSettings. + */ + WithCreate withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings); + } + + /** + * The stage of the elasticpool definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the elasticpool definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the elasticpool definition allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + + /** + * 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.WithLicenseType, DefinitionStages.WithMaxSizeBytes, DefinitionStages.WithPerDatabaseSettings, DefinitionStages.WithSku, DefinitionStages.WithTags, DefinitionStages.WithZoneRedundant { + } + } + /** + * The template for a ElasticPool update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithLicenseType, UpdateStages.WithMaxSizeBytes, UpdateStages.WithPerDatabaseSettings, UpdateStages.WithSku, UpdateStages.WithTags, UpdateStages.WithZoneRedundant { + } + + /** + * Grouping of ElasticPool update stages. + */ + interface UpdateStages { + /** + * The stage of the elasticpool update allowing to specify LicenseType. + */ + interface WithLicenseType { + /** + * Specifies licenseType. + */ + Update withLicenseType(ElasticPoolLicenseType licenseType); + } + + /** + * The stage of the elasticpool update allowing to specify MaxSizeBytes. + */ + interface WithMaxSizeBytes { + /** + * Specifies maxSizeBytes. + */ + Update withMaxSizeBytes(Long maxSizeBytes); + } + + /** + * The stage of the elasticpool update allowing to specify PerDatabaseSettings. + */ + interface WithPerDatabaseSettings { + /** + * Specifies perDatabaseSettings. + */ + Update withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings); + } + + /** + * The stage of the elasticpool update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the elasticpool update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + /** + * The stage of the elasticpool update allowing to specify ZoneRedundant. + */ + interface WithZoneRedundant { + /** + * Specifies zoneRedundant. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolEditionCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolEditionCapability.java new file mode 100644 index 0000000000000..1d8685d63c01f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolEditionCapability.java @@ -0,0 +1,105 @@ +/** + * 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_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The elastic pool edition capability. + */ +public class ElasticPoolEditionCapability { + /** + * The elastic pool edition name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported elastic pool DTU levels for the edition. + */ + @JsonProperty(value = "supportedElasticPoolPerformanceLevels", access = JsonProperty.Access.WRITE_ONLY) + private List supportedElasticPoolPerformanceLevels; + + /** + * Whether or not zone redundancy is supported for the edition. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the elastic pool edition name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported elastic pool DTU levels for the edition. + * + * @return the supportedElasticPoolPerformanceLevels value + */ + public List supportedElasticPoolPerformanceLevels() { + return this.supportedElasticPoolPerformanceLevels; + } + + /** + * Get whether or not zone redundancy is supported for the edition. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ElasticPoolEditionCapability object itself. + */ + public ElasticPoolEditionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolLicenseType.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolLicenseType.java new file mode 100644 index 0000000000000..ad348e202dc34 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolLicenseType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ElasticPoolLicenseType. + */ +public final class ElasticPoolLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for ElasticPoolLicenseType. */ + public static final ElasticPoolLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for ElasticPoolLicenseType. */ + public static final ElasticPoolLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a ElasticPoolLicenseType from its string representation. + * @param name a name to look for + * @return the corresponding ElasticPoolLicenseType + */ + @JsonCreator + public static ElasticPoolLicenseType fromString(String name) { + return fromString(name, ElasticPoolLicenseType.class); + } + + /** + * @return known ElasticPoolLicenseType values + */ + public static Collection values() { + return values(ElasticPoolLicenseType.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolOperation.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolOperation.java new file mode 100644 index 0000000000000..ed48fe185aa33 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolOperation.java @@ -0,0 +1,106 @@ +/** + * 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_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ElasticPoolOperationInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; + +/** + * Type representing ElasticPoolOperation. + */ +public interface ElasticPoolOperation extends HasInner, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * @return the errorDescription value. + */ + String errorDescription(); + + /** + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * @return the estimatedCompletionTime value. + */ + DateTime estimatedCompletionTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isCancellable value. + */ + Boolean isCancellable(); + + /** + * @return the isUserError value. + */ + Boolean isUserError(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * @return the serverName value. + */ + String serverName(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + String state(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolOperations.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolOperations.java new file mode 100644 index 0000000000000..4267ff58d6b8c --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolOperations.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import rx.Observable; +import rx.Completable; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ElasticPoolOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElasticPoolOperations. + */ +public interface ElasticPoolOperations extends HasInner { + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName the String value + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId); + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java new file mode 100644 index 0000000000000..ddbd0dec6cf36 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java @@ -0,0 +1,106 @@ +/** + * 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_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The max per-database performance level capability. + */ +public class ElasticPoolPerDatabaseMaxPerformanceLevelCapability { + /** + * The maximum performance level per database. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /** + * Unit type used to measure performance level. Possible values include: + * 'DTU', 'VCores'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /** + * The list of supported min database performance levels. + */ + @JsonProperty(value = "supportedPerDatabaseMinPerformanceLevels", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMinPerformanceLevels; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the maximum performance level per database. + * + * @return the limit value + */ + public Double limit() { + return this.limit; + } + + /** + * Get unit type used to measure performance level. Possible values include: 'DTU', 'VCores'. + * + * @return the unit value + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + + /** + * Get the list of supported min database performance levels. + * + * @return the supportedPerDatabaseMinPerformanceLevels value + */ + public List supportedPerDatabaseMinPerformanceLevels() { + return this.supportedPerDatabaseMinPerformanceLevels; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ElasticPoolPerDatabaseMaxPerformanceLevelCapability object itself. + */ + public ElasticPoolPerDatabaseMaxPerformanceLevelCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java new file mode 100644 index 0000000000000..03cfba5af15fe --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseMinPerformanceLevelCapability.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_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The minimum per-database performance level capability. + */ +public class ElasticPoolPerDatabaseMinPerformanceLevelCapability { + /** + * The minimum performance level per database. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /** + * Unit type used to measure performance level. Possible values include: + * 'DTU', 'VCores'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the minimum performance level per database. + * + * @return the limit value + */ + public Double limit() { + return this.limit; + } + + /** + * Get unit type used to measure performance level. Possible values include: 'DTU', 'VCores'. + * + * @return the unit value + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ElasticPoolPerDatabaseMinPerformanceLevelCapability object itself. + */ + public ElasticPoolPerDatabaseMinPerformanceLevelCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseSettings.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseSettings.java new file mode 100644 index 0000000000000..07ee0453597b4 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerDatabaseSettings.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_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Per database settings of an elastic pool. + */ +public class ElasticPoolPerDatabaseSettings { + /** + * The minimum capacity all databases are guaranteed. + */ + @JsonProperty(value = "minCapacity") + private Double minCapacity; + + /** + * The maximum capacity any one database can consume. + */ + @JsonProperty(value = "maxCapacity") + private Double maxCapacity; + + /** + * Get the minimum capacity all databases are guaranteed. + * + * @return the minCapacity value + */ + public Double minCapacity() { + return this.minCapacity; + } + + /** + * Set the minimum capacity all databases are guaranteed. + * + * @param minCapacity the minCapacity value to set + * @return the ElasticPoolPerDatabaseSettings object itself. + */ + public ElasticPoolPerDatabaseSettings withMinCapacity(Double minCapacity) { + this.minCapacity = minCapacity; + return this; + } + + /** + * Get the maximum capacity any one database can consume. + * + * @return the maxCapacity value + */ + public Double maxCapacity() { + return this.maxCapacity; + } + + /** + * Set the maximum capacity any one database can consume. + * + * @param maxCapacity the maxCapacity value to set + * @return the ElasticPoolPerDatabaseSettings object itself. + */ + public ElasticPoolPerDatabaseSettings withMaxCapacity(Double maxCapacity) { + this.maxCapacity = maxCapacity; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerformanceLevelCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerformanceLevelCapability.java new file mode 100644 index 0000000000000..666b095d33df1 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolPerformanceLevelCapability.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_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Elastic Pool performance level capability. + */ +public class ElasticPoolPerformanceLevelCapability { + /** + * The performance level for the pool. + */ + @JsonProperty(value = "performanceLevel", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelCapability performanceLevel; + + /** + * The sku. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private Sku sku; + + /** + * List of supported license types. + */ + @JsonProperty(value = "supportedLicenseTypes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedLicenseTypes; + + /** + * The maximum number of databases supported. + */ + @JsonProperty(value = "maxDatabaseCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxDatabaseCount; + + /** + * The included (free) max size for this performance level. + */ + @JsonProperty(value = "includedMaxSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability includedMaxSize; + + /** + * The list of supported max sizes. + */ + @JsonProperty(value = "supportedMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaxSizes; + + /** + * The list of supported per database max sizes. + */ + @JsonProperty(value = "supportedPerDatabaseMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMaxSizes; + + /** + * The list of supported per database max performance levels. + */ + @JsonProperty(value = "supportedPerDatabaseMaxPerformanceLevels", access = JsonProperty.Access.WRITE_ONLY) + private List supportedPerDatabaseMaxPerformanceLevels; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the performance level for the pool. + * + * @return the performanceLevel value + */ + public PerformanceLevelCapability performanceLevel() { + return this.performanceLevel; + } + + /** + * Get the sku. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Get list of supported license types. + * + * @return the supportedLicenseTypes value + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get the maximum number of databases supported. + * + * @return the maxDatabaseCount value + */ + public Integer maxDatabaseCount() { + return this.maxDatabaseCount; + } + + /** + * Get the included (free) max size for this performance level. + * + * @return the includedMaxSize value + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get the list of supported max sizes. + * + * @return the supportedMaxSizes value + */ + public List supportedMaxSizes() { + return this.supportedMaxSizes; + } + + /** + * Get the list of supported per database max sizes. + * + * @return the supportedPerDatabaseMaxSizes value + */ + public List supportedPerDatabaseMaxSizes() { + return this.supportedPerDatabaseMaxSizes; + } + + /** + * Get the list of supported per database max performance levels. + * + * @return the supportedPerDatabaseMaxPerformanceLevels value + */ + public List supportedPerDatabaseMaxPerformanceLevels() { + return this.supportedPerDatabaseMaxPerformanceLevels; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ElasticPoolPerformanceLevelCapability object itself. + */ + public ElasticPoolPerformanceLevelCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolState.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolState.java new file mode 100644 index 0000000000000..5327f4c715ede --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolState.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ElasticPoolState. + */ +public final class ElasticPoolState extends ExpandableStringEnum { + /** Static value Creating for ElasticPoolState. */ + public static final ElasticPoolState CREATING = fromString("Creating"); + + /** Static value Ready for ElasticPoolState. */ + public static final ElasticPoolState READY = fromString("Ready"); + + /** Static value Disabled for ElasticPoolState. */ + public static final ElasticPoolState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a ElasticPoolState from its string representation. + * @param name a name to look for + * @return the corresponding ElasticPoolState + */ + @JsonCreator + public static ElasticPoolState fromString(String name) { + return fromString(name, ElasticPoolState.class); + } + + /** + * @return known ElasticPoolState values + */ + public static Collection values() { + return values(ElasticPoolState.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolUpdate.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolUpdate.java new file mode 100644 index 0000000000000..b346e59de9842 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPoolUpdate.java @@ -0,0 +1,179 @@ +/** + * 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_10_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An elastic pool update. + */ +@JsonFlatten +public class ElasticPoolUpdate { + /** + * The sku property. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * The storage limit for the database elastic pool in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The per database settings for the elastic pool. + */ + @JsonProperty(value = "properties.perDatabaseSettings") + private ElasticPoolPerDatabaseSettings perDatabaseSettings; + + /** + * Whether or not this elastic pool is zone redundant, which means the + * replicas of this elastic pool will be spread across multiple + * availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * The license type to apply for this elastic pool. Possible values + * include: 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private ElasticPoolLicenseType licenseType; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the storage limit for the database elastic pool in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the per database settings for the elastic pool. + * + * @return the perDatabaseSettings value + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.perDatabaseSettings; + } + + /** + * Set the per database settings for the elastic pool. + * + * @param perDatabaseSettings the perDatabaseSettings value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + this.perDatabaseSettings = perDatabaseSettings; + return this; + } + + /** + * Get whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the license type to apply for this elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public ElasticPoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type to apply for this elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withLicenseType(ElasticPoolLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPools.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPools.java new file mode 100644 index 0000000000000..3e480555fef2a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ElasticPools.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_10_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ElasticPoolsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ElasticPools. + */ +public interface ElasticPools extends SupportsCreating, HasInner { + /** + * Gets an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Gets all elastic pools in a 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 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); + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroup.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroup.java new file mode 100644 index 0000000000000..8b022a6bf994a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroup.java @@ -0,0 +1,166 @@ +/** + * 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_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.InstanceFailoverGroupInner; +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_10_01_preview.implementation.SqlManager; +import java.util.List; + +/** + * Type representing InstanceFailoverGroup. + */ +public interface InstanceFailoverGroup extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the managedInstancePairs value. + */ + List managedInstancePairs(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the partnerRegions value. + */ + List partnerRegions(); + + /** + * @return the readOnlyEndpoint value. + */ + InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint(); + + /** + * @return the readWriteEndpoint value. + */ + InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint(); + + /** + * @return the replicationRole value. + */ + InstanceFailoverGroupReplicationRole replicationRole(); + + /** + * @return the replicationState value. + */ + String replicationState(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the InstanceFailoverGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithManagedInstancePairs, DefinitionStages.WithPartnerRegions, DefinitionStages.WithReadWriteEndpoint, DefinitionStages.WithCreate { + } + + /** + * Grouping of InstanceFailoverGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a InstanceFailoverGroup definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the instancefailovergroup definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies resourceGroupName, locationName. + */ + WithManagedInstancePairs withExistingLocation(String resourceGroupName, String locationName); + } + + /** + * The stage of the instancefailovergroup definition allowing to specify ManagedInstancePairs. + */ + interface WithManagedInstancePairs { + /** + * Specifies managedInstancePairs. + */ + WithPartnerRegions withManagedInstancePairs(List managedInstancePairs); + } + + /** + * The stage of the instancefailovergroup definition allowing to specify PartnerRegions. + */ + interface WithPartnerRegions { + /** + * Specifies partnerRegions. + */ + WithReadWriteEndpoint withPartnerRegions(List partnerRegions); + } + + /** + * The stage of the instancefailovergroup definition allowing to specify ReadWriteEndpoint. + */ + interface WithReadWriteEndpoint { + /** + * Specifies readWriteEndpoint. + */ + WithCreate withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint); + } + + /** + * The stage of the instancefailovergroup definition allowing to specify ReadOnlyEndpoint. + */ + interface WithReadOnlyEndpoint { + /** + * Specifies readOnlyEndpoint. + */ + WithCreate withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + + /** + * 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.WithReadOnlyEndpoint { + } + } + /** + * The template for a InstanceFailoverGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithReadOnlyEndpoint { + } + + /** + * Grouping of InstanceFailoverGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the instancefailovergroup update allowing to specify ReadOnlyEndpoint. + */ + interface WithReadOnlyEndpoint { + /** + * Specifies readOnlyEndpoint. + */ + Update withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReadOnlyEndpoint.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReadOnlyEndpoint.java new file mode 100644 index 0000000000000..a282ffa43559e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReadOnlyEndpoint.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Read-only endpoint of the failover group instance. + */ +public class InstanceFailoverGroupReadOnlyEndpoint { + /** + * Failover policy of the read-only endpoint for the failover group. + * Possible values include: 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "failoverPolicy") + private ReadOnlyEndpointFailoverPolicy failoverPolicy; + + /** + * Get failover policy of the read-only endpoint for the failover group. Possible values include: 'Disabled', 'Enabled'. + * + * @return the failoverPolicy value + */ + public ReadOnlyEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set failover policy of the read-only endpoint for the failover group. Possible values include: 'Disabled', 'Enabled'. + * + * @param failoverPolicy the failoverPolicy value to set + * @return the InstanceFailoverGroupReadOnlyEndpoint object itself. + */ + public InstanceFailoverGroupReadOnlyEndpoint withFailoverPolicy(ReadOnlyEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReadWriteEndpoint.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReadWriteEndpoint.java new file mode 100644 index 0000000000000..2057da2639a26 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReadWriteEndpoint.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Read-write endpoint of the failover group instance. + */ +public class InstanceFailoverGroupReadWriteEndpoint { + /** + * Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes + * is required. Possible values include: 'Manual', 'Automatic'. + */ + @JsonProperty(value = "failoverPolicy", required = true) + private ReadWriteEndpointFailoverPolicy failoverPolicy; + + /** + * Grace period before failover with data loss is attempted for the + * read-write endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + */ + @JsonProperty(value = "failoverWithDataLossGracePeriodMinutes") + private Integer failoverWithDataLossGracePeriodMinutes; + + /** + * Get failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic'. + * + * @return the failoverPolicy value + */ + public ReadWriteEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic'. + * + * @param failoverPolicy the failoverPolicy value to set + * @return the InstanceFailoverGroupReadWriteEndpoint object itself. + */ + public InstanceFailoverGroupReadWriteEndpoint withFailoverPolicy(ReadWriteEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Get grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @return the failoverWithDataLossGracePeriodMinutes value + */ + public Integer failoverWithDataLossGracePeriodMinutes() { + return this.failoverWithDataLossGracePeriodMinutes; + } + + /** + * Set grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @param failoverWithDataLossGracePeriodMinutes the failoverWithDataLossGracePeriodMinutes value to set + * @return the InstanceFailoverGroupReadWriteEndpoint object itself. + */ + public InstanceFailoverGroupReadWriteEndpoint withFailoverWithDataLossGracePeriodMinutes(Integer failoverWithDataLossGracePeriodMinutes) { + this.failoverWithDataLossGracePeriodMinutes = failoverWithDataLossGracePeriodMinutes; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReplicationRole.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReplicationRole.java new file mode 100644 index 0000000000000..1adfcac2f295e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroupReplicationRole.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for InstanceFailoverGroupReplicationRole. + */ +public final class InstanceFailoverGroupReplicationRole extends ExpandableStringEnum { + /** Static value Primary for InstanceFailoverGroupReplicationRole. */ + public static final InstanceFailoverGroupReplicationRole PRIMARY = fromString("Primary"); + + /** Static value Secondary for InstanceFailoverGroupReplicationRole. */ + public static final InstanceFailoverGroupReplicationRole SECONDARY = fromString("Secondary"); + + /** + * Creates or finds a InstanceFailoverGroupReplicationRole from its string representation. + * @param name a name to look for + * @return the corresponding InstanceFailoverGroupReplicationRole + */ + @JsonCreator + public static InstanceFailoverGroupReplicationRole fromString(String name) { + return fromString(name, InstanceFailoverGroupReplicationRole.class); + } + + /** + * @return known InstanceFailoverGroupReplicationRole values + */ + public static Collection values() { + return values(InstanceFailoverGroupReplicationRole.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroups.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroups.java new file mode 100644 index 0000000000000..5ab4216cafba7 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/InstanceFailoverGroups.java @@ -0,0 +1,75 @@ +/** + * 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_10_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.InstanceFailoverGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing InstanceFailoverGroups. + */ +public interface InstanceFailoverGroups extends SupportsCreating, HasInner { + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable failoverAsync(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(final String resourceGroupName, final String locationName); + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String locationName, String failoverGroupName); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LicenseTypeCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LicenseTypeCapability.java new file mode 100644 index 0000000000000..d267909346880 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LicenseTypeCapability.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_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The license type capability. + */ +public class LicenseTypeCapability { + /** + * License type identifier. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get license type identifier. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the LicenseTypeCapability object itself. + */ + public LicenseTypeCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LocationCapabilities.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LocationCapabilities.java new file mode 100644 index 0000000000000..3a7332650414c --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LocationCapabilities.java @@ -0,0 +1,46 @@ +/** + * 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_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.SqlManager; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.LocationCapabilitiesInner; +import java.util.List; + +/** + * Type representing LocationCapabilities. + */ +public interface LocationCapabilities extends HasInner, HasManager { + /** + * @return the name value. + */ + String name(); + + /** + * @return the reason value. + */ + String reason(); + + /** + * @return the status value. + */ + CapabilityStatus status(); + + /** + * @return the supportedManagedInstanceVersions value. + */ + List supportedManagedInstanceVersions(); + + /** + * @return the supportedServerVersions value. + */ + List supportedServerVersions(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LogSizeCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LogSizeCapability.java new file mode 100644 index 0000000000000..b00fea2d0e2cf --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LogSizeCapability.java @@ -0,0 +1,48 @@ +/** + * 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_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The log size capability. + */ +public class LogSizeCapability { + /** + * The log size limit (see 'unit' for the units). + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /** + * The units that the limit is expressed in. Possible values include: + * 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes', 'Percent'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private LogSizeUnit unit; + + /** + * Get the log size limit (see 'unit' for the units). + * + * @return the limit value + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the units that the limit is expressed in. Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes', 'Percent'. + * + * @return the unit value + */ + public LogSizeUnit unit() { + return this.unit; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LogSizeUnit.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LogSizeUnit.java new file mode 100644 index 0000000000000..fd7aa55b13cb1 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/LogSizeUnit.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for LogSizeUnit. + */ +public final class LogSizeUnit extends ExpandableStringEnum { + /** Static value Megabytes for LogSizeUnit. */ + public static final LogSizeUnit MEGABYTES = fromString("Megabytes"); + + /** Static value Gigabytes for LogSizeUnit. */ + public static final LogSizeUnit GIGABYTES = fromString("Gigabytes"); + + /** Static value Terabytes for LogSizeUnit. */ + public static final LogSizeUnit TERABYTES = fromString("Terabytes"); + + /** Static value Petabytes for LogSizeUnit. */ + public static final LogSizeUnit PETABYTES = fromString("Petabytes"); + + /** Static value Percent for LogSizeUnit. */ + public static final LogSizeUnit PERCENT = fromString("Percent"); + + /** + * Creates or finds a LogSizeUnit from its string representation. + * @param name a name to look for + * @return the corresponding LogSizeUnit + */ + @JsonCreator + public static LogSizeUnit fromString(String name) { + return fromString(name, LogSizeUnit.class); + } + + /** + * @return known LogSizeUnit values + */ + public static Collection values() { + return values(LogSizeUnit.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEditionCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEditionCapability.java new file mode 100644 index 0000000000000..b7c2a579e9232 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEditionCapability.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_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The managed server capability. + */ +public class ManagedInstanceEditionCapability { + /** + * The managed server version name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The supported families. + */ + @JsonProperty(value = "supportedFamilies", access = JsonProperty.Access.WRITE_ONLY) + private List supportedFamilies; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the managed server version name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the supported families. + * + * @return the supportedFamilies value + */ + public List supportedFamilies() { + return this.supportedFamilies; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ManagedInstanceEditionCapability object itself. + */ + public ManagedInstanceEditionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceFamilyCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceFamilyCapability.java new file mode 100644 index 0000000000000..175468440c1c1 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceFamilyCapability.java @@ -0,0 +1,150 @@ +/** + * 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_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The managed server family capability. + */ +public class ManagedInstanceFamilyCapability { + /** + * Family name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * SKU name. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private String sku; + + /** + * List of supported license types. + */ + @JsonProperty(value = "supportedLicenseTypes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedLicenseTypes; + + /** + * List of supported virtual cores values. + */ + @JsonProperty(value = "supportedVcoresValues", access = JsonProperty.Access.WRITE_ONLY) + private List supportedVcoresValues; + + /** + * Included size. + */ + @JsonProperty(value = "includedMaxSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability includedMaxSize; + + /** + * Storage size ranges. + */ + @JsonProperty(value = "supportedStorageSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedStorageSizes; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get family name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get sKU name. + * + * @return the sku value + */ + public String sku() { + return this.sku; + } + + /** + * Get list of supported license types. + * + * @return the supportedLicenseTypes value + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get list of supported virtual cores values. + * + * @return the supportedVcoresValues value + */ + public List supportedVcoresValues() { + return this.supportedVcoresValues; + } + + /** + * Get included size. + * + * @return the includedMaxSize value + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get storage size ranges. + * + * @return the supportedStorageSizes value + */ + public List supportedStorageSizes() { + return this.supportedStorageSizes; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ManagedInstanceFamilyCapability object itself. + */ + public ManagedInstanceFamilyCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstancePairInfo.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstancePairInfo.java new file mode 100644 index 0000000000000..bd1a793b93f05 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstancePairInfo.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Pairs of Managed Instances in the failover group. + */ +public class ManagedInstancePairInfo { + /** + * Id of Primary Managed Instance in pair. + */ + @JsonProperty(value = "primaryManagedInstanceId") + private String primaryManagedInstanceId; + + /** + * Id of Partner Managed Instance in pair. + */ + @JsonProperty(value = "partnerManagedInstanceId") + private String partnerManagedInstanceId; + + /** + * Get id of Primary Managed Instance in pair. + * + * @return the primaryManagedInstanceId value + */ + public String primaryManagedInstanceId() { + return this.primaryManagedInstanceId; + } + + /** + * Set id of Primary Managed Instance in pair. + * + * @param primaryManagedInstanceId the primaryManagedInstanceId value to set + * @return the ManagedInstancePairInfo object itself. + */ + public ManagedInstancePairInfo withPrimaryManagedInstanceId(String primaryManagedInstanceId) { + this.primaryManagedInstanceId = primaryManagedInstanceId; + return this; + } + + /** + * Get id of Partner Managed Instance in pair. + * + * @return the partnerManagedInstanceId value + */ + public String partnerManagedInstanceId() { + return this.partnerManagedInstanceId; + } + + /** + * Set id of Partner Managed Instance in pair. + * + * @param partnerManagedInstanceId the partnerManagedInstanceId value to set + * @return the ManagedInstancePairInfo object itself. + */ + public ManagedInstancePairInfo withPartnerManagedInstanceId(String partnerManagedInstanceId) { + this.partnerManagedInstanceId = partnerManagedInstanceId; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceTdeCertificates.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceTdeCertificates.java new file mode 100644 index 0000000000000..d40f1452ec066 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceTdeCertificates.java @@ -0,0 +1,31 @@ +/** + * 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_10_01_preview; + +import rx.Completable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.TdeCertificateInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ManagedInstanceTdeCertificatesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedInstanceTdeCertificates. + */ +public interface ManagedInstanceTdeCertificates extends HasInner { + /** + * Creates a TDE certificate 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable createAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVcoresCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVcoresCapability.java new file mode 100644 index 0000000000000..fc92266a82e99 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVcoresCapability.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The managed instance virtual cores capability. + */ +public class ManagedInstanceVcoresCapability { + /** + * The virtual cores identifier. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The virtual cores value. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Integer value; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the virtual cores identifier. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the virtual cores value. + * + * @return the value value + */ + public Integer value() { + return this.value; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ManagedInstanceVcoresCapability object itself. + */ + public ManagedInstanceVcoresCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVersionCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVersionCapability.java new file mode 100644 index 0000000000000..b94bc3939f560 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceVersionCapability.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_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The managed instance capability. + */ +public class ManagedInstanceVersionCapability { + /** + * The server version name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported managed instance editions. + */ + @JsonProperty(value = "supportedEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedEditions; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the server version name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported managed instance editions. + * + * @return the supportedEditions value + */ + public List supportedEditions() { + return this.supportedEditions; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ManagedInstanceVersionCapability object itself. + */ + public ManagedInstanceVersionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagementOperationState.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagementOperationState.java new file mode 100644 index 0000000000000..6252e858363a8 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagementOperationState.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_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagementOperationState. + */ +public final class ManagementOperationState extends ExpandableStringEnum { + /** Static value Pending for ManagementOperationState. */ + public static final ManagementOperationState PENDING = fromString("Pending"); + + /** Static value InProgress for ManagementOperationState. */ + public static final ManagementOperationState IN_PROGRESS = fromString("InProgress"); + + /** Static value Succeeded for ManagementOperationState. */ + public static final ManagementOperationState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ManagementOperationState. */ + public static final ManagementOperationState FAILED = fromString("Failed"); + + /** Static value CancelInProgress for ManagementOperationState. */ + public static final ManagementOperationState CANCEL_IN_PROGRESS = fromString("CancelInProgress"); + + /** Static value Cancelled for ManagementOperationState. */ + public static final ManagementOperationState CANCELLED = fromString("Cancelled"); + + /** + * Creates or finds a ManagementOperationState from its string representation. + * @param name a name to look for + * @return the corresponding ManagementOperationState + */ + @JsonCreator + public static ManagementOperationState fromString(String name) { + return fromString(name, ManagementOperationState.class); + } + + /** + * @return known ManagementOperationState values + */ + public static Collection values() { + return values(ManagementOperationState.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeCapability.java new file mode 100644 index 0000000000000..a064d07edf58e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeCapability.java @@ -0,0 +1,48 @@ +/** + * 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_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The maximum size capability. + */ +public class MaxSizeCapability { + /** + * The maximum size limit (see 'unit' for the units). + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /** + * The units that the limit is expressed in. Possible values include: + * 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeUnit unit; + + /** + * Get the maximum size limit (see 'unit' for the units). + * + * @return the limit value + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the units that the limit is expressed in. Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes'. + * + * @return the unit value + */ + public MaxSizeUnit unit() { + return this.unit; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeRangeCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeRangeCapability.java new file mode 100644 index 0000000000000..f89dedfbdc90e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeRangeCapability.java @@ -0,0 +1,120 @@ +/** + * 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_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The maximum size range capability. + */ +public class MaxSizeRangeCapability { + /** + * Minimum value. + */ + @JsonProperty(value = "minValue", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability minValue; + + /** + * Maximum value. + */ + @JsonProperty(value = "maxValue", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability maxValue; + + /** + * Scale/step size for discrete values between the minimum value and the + * maximum value. + */ + @JsonProperty(value = "scaleSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability scaleSize; + + /** + * Size of transaction log. + */ + @JsonProperty(value = "logSize", access = JsonProperty.Access.WRITE_ONLY) + private LogSizeCapability logSize; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get minimum value. + * + * @return the minValue value + */ + public MaxSizeCapability minValue() { + return this.minValue; + } + + /** + * Get maximum value. + * + * @return the maxValue value + */ + public MaxSizeCapability maxValue() { + return this.maxValue; + } + + /** + * Get scale/step size for discrete values between the minimum value and the maximum value. + * + * @return the scaleSize value + */ + public MaxSizeCapability scaleSize() { + return this.scaleSize; + } + + /** + * Get size of transaction log. + * + * @return the logSize value + */ + public LogSizeCapability logSize() { + return this.logSize; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the MaxSizeRangeCapability object itself. + */ + public MaxSizeRangeCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeUnit.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeUnit.java new file mode 100644 index 0000000000000..f9d7c29d3dc4e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/MaxSizeUnit.java @@ -0,0 +1,47 @@ +/** + * 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_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for MaxSizeUnit. + */ +public final class MaxSizeUnit extends ExpandableStringEnum { + /** Static value Megabytes for MaxSizeUnit. */ + public static final MaxSizeUnit MEGABYTES = fromString("Megabytes"); + + /** Static value Gigabytes for MaxSizeUnit. */ + public static final MaxSizeUnit GIGABYTES = fromString("Gigabytes"); + + /** Static value Terabytes for MaxSizeUnit. */ + public static final MaxSizeUnit TERABYTES = fromString("Terabytes"); + + /** Static value Petabytes for MaxSizeUnit. */ + public static final MaxSizeUnit PETABYTES = fromString("Petabytes"); + + /** + * Creates or finds a MaxSizeUnit from its string representation. + * @param name a name to look for + * @return the corresponding MaxSizeUnit + */ + @JsonCreator + public static MaxSizeUnit fromString(String name) { + return fromString(name, MaxSizeUnit.class); + } + + /** + * @return known MaxSizeUnit values + */ + public static Collection values() { + return values(MaxSizeUnit.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PartnerRegionInfo.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PartnerRegionInfo.java new file mode 100644 index 0000000000000..757aedc556ac6 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PartnerRegionInfo.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Partner region information for the failover group. + */ +public class PartnerRegionInfo { + /** + * Geo location of the partner managed instances. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Replication role of the partner managed instances. Possible values + * include: 'Primary', 'Secondary'. + */ + @JsonProperty(value = "replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private InstanceFailoverGroupReplicationRole replicationRole; + + /** + * Get geo location of the partner managed instances. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set geo location of the partner managed instances. + * + * @param location the location value to set + * @return the PartnerRegionInfo object itself. + */ + public PartnerRegionInfo withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get replication role of the partner managed instances. Possible values include: 'Primary', 'Secondary'. + * + * @return the replicationRole value + */ + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PerformanceLevelCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PerformanceLevelCapability.java new file mode 100644 index 0000000000000..c88d7bc274707 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PerformanceLevelCapability.java @@ -0,0 +1,48 @@ +/** + * 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_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The performance level capability. + */ +public class PerformanceLevelCapability { + /** + * Performance level value. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Double value; + + /** + * Unit type used to measure performance level. Possible values include: + * 'DTU', 'VCores'. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /** + * Get performance level value. + * + * @return the value value + */ + public Double value() { + return this.value; + } + + /** + * Get unit type used to measure performance level. Possible values include: 'DTU', 'VCores'. + * + * @return the unit value + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PerformanceLevelUnit.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PerformanceLevelUnit.java new file mode 100644 index 0000000000000..77876378f4b7d --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/PerformanceLevelUnit.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PerformanceLevelUnit. + */ +public final class PerformanceLevelUnit extends ExpandableStringEnum { + /** Static value DTU for PerformanceLevelUnit. */ + public static final PerformanceLevelUnit DTU = fromString("DTU"); + + /** Static value VCores for PerformanceLevelUnit. */ + public static final PerformanceLevelUnit VCORES = fromString("VCores"); + + /** + * Creates or finds a PerformanceLevelUnit from its string representation. + * @param name a name to look for + * @return the corresponding PerformanceLevelUnit + */ + @JsonCreator + public static PerformanceLevelUnit fromString(String name) { + return fromString(name, PerformanceLevelUnit.class); + } + + /** + * @return known PerformanceLevelUnit values + */ + public static Collection values() { + return values(PerformanceLevelUnit.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ReadOnlyEndpointFailoverPolicy.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ReadOnlyEndpointFailoverPolicy.java new file mode 100644 index 0000000000000..ffa4594e99fbb --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ReadOnlyEndpointFailoverPolicy.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReadOnlyEndpointFailoverPolicy. + */ +public final class ReadOnlyEndpointFailoverPolicy extends ExpandableStringEnum { + /** Static value Disabled for ReadOnlyEndpointFailoverPolicy. */ + public static final ReadOnlyEndpointFailoverPolicy DISABLED = fromString("Disabled"); + + /** Static value Enabled for ReadOnlyEndpointFailoverPolicy. */ + public static final ReadOnlyEndpointFailoverPolicy ENABLED = fromString("Enabled"); + + /** + * Creates or finds a ReadOnlyEndpointFailoverPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ReadOnlyEndpointFailoverPolicy + */ + @JsonCreator + public static ReadOnlyEndpointFailoverPolicy fromString(String name) { + return fromString(name, ReadOnlyEndpointFailoverPolicy.class); + } + + /** + * @return known ReadOnlyEndpointFailoverPolicy values + */ + public static Collection values() { + return values(ReadOnlyEndpointFailoverPolicy.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ReadWriteEndpointFailoverPolicy.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ReadWriteEndpointFailoverPolicy.java new file mode 100644 index 0000000000000..6997fa0ffa8af --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ReadWriteEndpointFailoverPolicy.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReadWriteEndpointFailoverPolicy. + */ +public final class ReadWriteEndpointFailoverPolicy extends ExpandableStringEnum { + /** Static value Manual for ReadWriteEndpointFailoverPolicy. */ + public static final ReadWriteEndpointFailoverPolicy MANUAL = fromString("Manual"); + + /** Static value Automatic for ReadWriteEndpointFailoverPolicy. */ + public static final ReadWriteEndpointFailoverPolicy AUTOMATIC = fromString("Automatic"); + + /** + * Creates or finds a ReadWriteEndpointFailoverPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ReadWriteEndpointFailoverPolicy + */ + @JsonCreator + public static ReadWriteEndpointFailoverPolicy fromString(String name) { + return fromString(name, ReadWriteEndpointFailoverPolicy.class); + } + + /** + * @return known ReadWriteEndpointFailoverPolicy values + */ + public static Collection values() { + return values(ReadWriteEndpointFailoverPolicy.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ResourceMoveDefinition.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ResourceMoveDefinition.java new file mode 100644 index 0000000000000..cd9239a5f310d --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ResourceMoveDefinition.java @@ -0,0 +1,43 @@ +/** + * 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_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains the information necessary to perform a resource move (rename). + */ +public class ResourceMoveDefinition { + /** + * The target ID for the resource. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the target ID for the resource. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the target ID for the resource. + * + * @param id the id value to set + * @return the ResourceMoveDefinition object itself. + */ + public ResourceMoveDefinition withId(String id) { + this.id = id; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/SampleName.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/SampleName.java new file mode 100644 index 0000000000000..a83caaba4d382 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/SampleName.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SampleName. + */ +public final class SampleName extends ExpandableStringEnum { + /** Static value AdventureWorksLT for SampleName. */ + public static final SampleName ADVENTURE_WORKS_LT = fromString("AdventureWorksLT"); + + /** Static value WideWorldImportersStd for SampleName. */ + public static final SampleName WIDE_WORLD_IMPORTERS_STD = fromString("WideWorldImportersStd"); + + /** Static value WideWorldImportersFull for SampleName. */ + public static final SampleName WIDE_WORLD_IMPORTERS_FULL = fromString("WideWorldImportersFull"); + + /** + * Creates or finds a SampleName from its string representation. + * @param name a name to look for + * @return the corresponding SampleName + */ + @JsonCreator + public static SampleName fromString(String name) { + return fromString(name, SampleName.class); + } + + /** + * @return known SampleName values + */ + public static Collection values() { + return values(SampleName.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVersionCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVersionCapability.java new file mode 100644 index 0000000000000..e3989fe0e1b12 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServerVersionCapability.java @@ -0,0 +1,105 @@ +/** + * 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_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The server capability. + */ +public class ServerVersionCapability { + /** + * The server version name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported database editions. + */ + @JsonProperty(value = "supportedEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedEditions; + + /** + * The list of supported elastic pool editions. + */ + @JsonProperty(value = "supportedElasticPoolEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedElasticPoolEditions; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the server version name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported database editions. + * + * @return the supportedEditions value + */ + public List supportedEditions() { + return this.supportedEditions; + } + + /** + * Get the list of supported elastic pool editions. + * + * @return the supportedElasticPoolEditions value + */ + public List supportedElasticPoolEditions() { + return this.supportedElasticPoolEditions; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ServerVersionCapability object itself. + */ + public ServerVersionCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServiceObjectiveCapability.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServiceObjectiveCapability.java new file mode 100644 index 0000000000000..69d8807c326ff --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ServiceObjectiveCapability.java @@ -0,0 +1,166 @@ +/** + * 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_10_01_preview; + +import java.util.UUID; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The service objectives capability. + */ +public class ServiceObjectiveCapability { + /** + * The unique ID of the service objective. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private UUID id; + + /** + * The service objective name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported maximum database sizes. + */ + @JsonProperty(value = "supportedMaxSizes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaxSizes; + + /** + * The performance level. + */ + @JsonProperty(value = "performanceLevel", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelCapability performanceLevel; + + /** + * The sku. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private Sku sku; + + /** + * List of supported license types. + */ + @JsonProperty(value = "supportedLicenseTypes", access = JsonProperty.Access.WRITE_ONLY) + private List supportedLicenseTypes; + + /** + * The included (free) max size. + */ + @JsonProperty(value = "includedMaxSize", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability includedMaxSize; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the unique ID of the service objective. + * + * @return the id value + */ + public UUID id() { + return this.id; + } + + /** + * Get the service objective name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported maximum database sizes. + * + * @return the supportedMaxSizes value + */ + public List supportedMaxSizes() { + return this.supportedMaxSizes; + } + + /** + * Get the performance level. + * + * @return the performanceLevel value + */ + public PerformanceLevelCapability performanceLevel() { + return this.performanceLevel; + } + + /** + * Get the sku. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Get list of supported license types. + * + * @return the supportedLicenseTypes value + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get the included (free) max size. + * + * @return the includedMaxSize value + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the ServiceObjectiveCapability object itself. + */ + public ServiceObjectiveCapability withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Sku.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Sku.java new file mode 100644 index 0000000000000..1e666f1e4dafc --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/Sku.java @@ -0,0 +1,152 @@ +/** + * 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_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource model definition representing SKU. + */ +public class Sku { + /** + * The name of the SKU. Ex - P3. It is typically a letter+number code. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * This field is required to be implemented by the Resource Provider if the + * service has more than one tier, but is not required on a PUT. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * The SKU size. When the name field is the combination of tier and some + * other value, this would be the standalone code. + */ + @JsonProperty(value = "size") + private String size; + + /** + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /** + * If the SKU supports scale out/in then the capacity integer should be + * included. If scale out/in is not possible for the resource this may be + * omitted. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set this field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @return the size value + */ + public String size() { + return this.size; + } + + /** + * Set the SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + * + * @param size the size value to set + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get if the service has different generations of hardware, for the same SKU, then that can be captured here. + * + * @return the family value + */ + public String family() { + return this.family; + } + + /** + * Set if the service has different generations of hardware, for the same SKU, then that can be captured here. + * + * @param family the family value to set + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set if the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + * + * @param capacity the capacity value to set + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/TdeCertificates.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/TdeCertificates.java new file mode 100644 index 0000000000000..ff1eaa617f9a8 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/TdeCertificates.java @@ -0,0 +1,31 @@ +/** + * 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_10_01_preview; + +import rx.Completable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.TdeCertificateInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.TdeCertificatesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing TdeCertificates. + */ +public interface TdeCertificates extends HasInner { + /** + * Creates a TDE certificate 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 serverName The name of the server. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable createAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentRecurringScansProperties.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentRecurringScansProperties.java new file mode 100644 index 0000000000000..71096e2cb5757 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentRecurringScansProperties.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_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a Vulnerability Assessment recurring scans. + */ +public class VulnerabilityAssessmentRecurringScansProperties { + /** + * Recurring scans state. + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /** + * Specifies that the schedule scan notification will be is sent to the + * subscription administrators. + */ + @JsonProperty(value = "emailSubscriptionAdmins") + private Boolean emailSubscriptionAdmins; + + /** + * Specifies an array of e-mail addresses to which the scan notification is + * sent. + */ + @JsonProperty(value = "emails") + private List emails; + + /** + * Get recurring scans state. + * + * @return the isEnabled value + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set recurring scans state. + * + * @param isEnabled the isEnabled value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get specifies that the schedule scan notification will be is sent to the subscription administrators. + * + * @return the emailSubscriptionAdmins value + */ + public Boolean emailSubscriptionAdmins() { + return this.emailSubscriptionAdmins; + } + + /** + * Set specifies that the schedule scan notification will be is sent to the subscription administrators. + * + * @param emailSubscriptionAdmins the emailSubscriptionAdmins value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmailSubscriptionAdmins(Boolean emailSubscriptionAdmins) { + this.emailSubscriptionAdmins = emailSubscriptionAdmins; + return this; + } + + /** + * Get specifies an array of e-mail addresses to which the scan notification is sent. + * + * @return the emails value + */ + public List emails() { + return this.emails; + } + + /** + * Set specifies an array of e-mail addresses to which the scan notification is sent. + * + * @param emails the emails value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmails(List emails) { + this.emails = emails; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanError.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanError.java new file mode 100644 index 0000000000000..7f58d77b33e59 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanError.java @@ -0,0 +1,47 @@ +/** + * 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_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a vulnerability assessment scan error. + */ +public class VulnerabilityAssessmentScanError { + /** + * The error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * The error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanRecord.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanRecord.java new file mode 100644 index 0000000000000..f575129cb8f49 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanRecord.java @@ -0,0 +1,79 @@ +/** + * 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_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.VulnerabilityAssessmentScanRecordInner; +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_10_01_preview.implementation.SqlManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing VulnerabilityAssessmentScanRecord. + */ +public interface VulnerabilityAssessmentScanRecord extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the errors value. + */ + List errors(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the numberOfFailedSecurityChecks value. + */ + Integer numberOfFailedSecurityChecks(); + + /** + * @return the scanId value. + */ + String scanId(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the state value. + */ + VulnerabilityAssessmentScanState state(); + + /** + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * @return the triggerType value. + */ + VulnerabilityAssessmentScanTriggerType triggerType(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanState.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanState.java new file mode 100644 index 0000000000000..fd896958ca6bb --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanState.java @@ -0,0 +1,47 @@ +/** + * 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_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for VulnerabilityAssessmentScanState. + */ +public final class VulnerabilityAssessmentScanState extends ExpandableStringEnum { + /** Static value Passed for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState PASSED = fromString("Passed"); + + /** Static value Failed for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState FAILED = fromString("Failed"); + + /** Static value FailedToRun for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState FAILED_TO_RUN = fromString("FailedToRun"); + + /** Static value InProgress for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState IN_PROGRESS = fromString("InProgress"); + + /** + * Creates or finds a VulnerabilityAssessmentScanState from its string representation. + * @param name a name to look for + * @return the corresponding VulnerabilityAssessmentScanState + */ + @JsonCreator + public static VulnerabilityAssessmentScanState fromString(String name) { + return fromString(name, VulnerabilityAssessmentScanState.class); + } + + /** + * @return known VulnerabilityAssessmentScanState values + */ + public static Collection values() { + return values(VulnerabilityAssessmentScanState.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanTriggerType.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanTriggerType.java new file mode 100644 index 0000000000000..722b5668a37f8 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/VulnerabilityAssessmentScanTriggerType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for VulnerabilityAssessmentScanTriggerType. + */ +public final class VulnerabilityAssessmentScanTriggerType extends ExpandableStringEnum { + /** Static value OnDemand for VulnerabilityAssessmentScanTriggerType. */ + public static final VulnerabilityAssessmentScanTriggerType ON_DEMAND = fromString("OnDemand"); + + /** Static value Recurring for VulnerabilityAssessmentScanTriggerType. */ + public static final VulnerabilityAssessmentScanTriggerType RECURRING = fromString("Recurring"); + + /** + * Creates or finds a VulnerabilityAssessmentScanTriggerType from its string representation. + * @param name a name to look for + * @return the corresponding VulnerabilityAssessmentScanTriggerType + */ + @JsonCreator + public static VulnerabilityAssessmentScanTriggerType fromString(String name) { + return fromString(name, VulnerabilityAssessmentScanTriggerType.class); + } + + /** + * @return known VulnerabilityAssessmentScanTriggerType values + */ + public static Collection values() { + return values(VulnerabilityAssessmentScanTriggerType.class); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..8fde97f0db81a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesImpl.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_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicy; + +class BackupShortTermRetentionPoliciesImpl extends WrapperImpl implements BackupShortTermRetentionPolicies { + private final SqlManager manager; + + BackupShortTermRetentionPoliciesImpl(SqlManager manager) { + super(manager.inner().backupShortTermRetentionPolicies()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public BackupShortTermRetentionPolicyImpl define(String name) { + return wrapModel(name); + } + + private BackupShortTermRetentionPolicyImpl wrapModel(BackupShortTermRetentionPolicyInner inner) { + return new BackupShortTermRetentionPolicyImpl(inner, manager()); + } + + private BackupShortTermRetentionPolicyImpl wrapModel(String name) { + return new BackupShortTermRetentionPolicyImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + BackupShortTermRetentionPoliciesInner 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 BackupShortTermRetentionPolicy call(BackupShortTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + BackupShortTermRetentionPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public BackupShortTermRetentionPolicy call(BackupShortTermRetentionPolicyInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java new file mode 100644 index 0000000000000..f0498bb847759 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.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_10_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 BackupShortTermRetentionPolicies. + */ +public class BackupShortTermRetentionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private BackupShortTermRetentionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of BackupShortTermRetentionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BackupShortTermRetentionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(BackupShortTermRetentionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for BackupShortTermRetentionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface BackupShortTermRetentionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BackupShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a 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 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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a database's 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 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 BackupShortTermRetentionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a 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 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 BackupShortTermRetentionPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + 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, serverName, databaseName, 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); + } + + /** + * Updates a 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 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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Updates a 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 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 createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a 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 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 + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a 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 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 + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + 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; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().last().body(); + } + + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 serverName, String databaseName, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 serverName, String databaseName, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 serverName, String databaseName, Integer retentionDays) { + 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 policyName = "default"; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a 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 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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Updates a 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 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a 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 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 BackupShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a 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 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 BackupShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + 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; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginCreateOrUpdate(resourceGroupName, serverName, databaseName, 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); + } + } + }); + } + + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().single().body(); + } + + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 serverName, String databaseName, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 BackupShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 BackupShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + 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 policyName = "default"; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginCreateOrUpdate(resourceGroupName, serverName, databaseName, 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); + } + + /** + * Updates a 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 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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner update(String resourceGroupName, String serverName, String databaseName) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Updates a 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 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 updateAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a 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 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 + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a 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 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 + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + 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; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.update(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner update(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().last().body(); + } + + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 serverName, String databaseName, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 serverName, String databaseName, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 serverName, String databaseName, Integer retentionDays) { + 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 policyName = "default"; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.update(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a 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 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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String serverName, String databaseName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Updates a 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 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 beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a 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 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 BackupShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a 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 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 BackupShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + 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; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginUpdate(resourceGroupName, serverName, databaseName, 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); + } + } + }); + } + + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 BackupShortTermRetentionPolicyInner object if successful. + */ + public BackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().single().body(); + } + + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 serverName, String databaseName, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 BackupShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, BackupShortTermRetentionPolicyInner>() { + @Override + public BackupShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a 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 serverName The name of the server. + * @param databaseName The name of the database. + * @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 BackupShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + 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 policyName = "default"; + BackupShortTermRetentionPolicyInner parameters = new BackupShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginUpdate(resourceGroupName, serverName, databaseName, 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 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 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<BackupShortTermRetentionPolicyInner> 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 a 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 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 a 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 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<BackupShortTermRetentionPolicyInner> 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 a 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 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<BackupShortTermRetentionPolicyInner> 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 a database's short term retention policy. + * + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BackupShortTermRetentionPolicyInner> 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."); + } + return service.listByDatabase(resourceGroupName, serverName, 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 database's short term retention policy. + * + * @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<BackupShortTermRetentionPolicyInner> 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 database's short term retention policy. + * + * @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 database's short term retention policy. + * + * @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<BackupShortTermRetentionPolicyInner> 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 database's short term retention policy. + * + * @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<BackupShortTermRetentionPolicyInner> 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 database's short term retention policy. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BackupShortTermRetentionPolicyInner> 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_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPolicyImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..386dd7a3b554e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPolicyImpl.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class BackupShortTermRetentionPolicyImpl extends CreatableUpdatableImpl implements BackupShortTermRetentionPolicy, BackupShortTermRetentionPolicy.Definition, BackupShortTermRetentionPolicy.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + + BackupShortTermRetentionPolicyImpl(String name, SqlManager manager) { + super(name, new BackupShortTermRetentionPolicyInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + } + + BackupShortTermRetentionPolicyImpl(BackupShortTermRetentionPolicyInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + BackupShortTermRetentionPoliciesInner client = this.manager().inner().backupShortTermRetentionPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + BackupShortTermRetentionPoliciesInner client = this.manager().inner().backupShortTermRetentionPolicies(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BackupShortTermRetentionPoliciesInner client = this.manager().inner().backupShortTermRetentionPolicies(); + return client.getAsync(this.resourceGroupName, this.serverName, 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 BackupShortTermRetentionPolicyImpl withExistingDatabasis(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPolicyInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..f1dde126ce62f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPolicyInner.java @@ -0,0 +1,47 @@ +/** + * 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_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A short term retention policy. + */ +@JsonFlatten +public class BackupShortTermRetentionPolicyInner extends ProxyResource { + /** + * The backup retention period in days. This is how many days Point-in-Time + * Restore will be supported. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Get the backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * + * @param retentionDays the retentionDays value to set + * @return the BackupShortTermRetentionPolicyInner object itself. + */ + public BackupShortTermRetentionPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesImpl.java new file mode 100644 index 0000000000000..18d7395ad1aff --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesImpl.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. + * abc + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.Capabilities; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.LocationCapabilities; + +class CapabilitiesImpl extends WrapperImpl implements Capabilities { + private final SqlManager manager; + + CapabilitiesImpl(SqlManager manager) { + super(manager.inner().capabilities()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable listByLocationAsync(String locationName) { + CapabilitiesInner client = this.inner(); + return client.listByLocationAsync(locationName) + .map(new Func1() { + @Override + public LocationCapabilities call(LocationCapabilitiesInner inner) { + return new LocationCapabilitiesImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesInner.java new file mode 100644 index 0000000000000..267b5e8d1fc03 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesInner.java @@ -0,0 +1,217 @@ +/** + * 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_10_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.v2017_10_01_preview.CapabilityGroup; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Capabilities. + */ +public class CapabilitiesInner { + /** The Retrofit service to perform REST calls. */ + private CapabilitiesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of CapabilitiesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CapabilitiesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(CapabilitiesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Capabilities to be + * used by Retrofit to perform actually REST calls. + */ + interface CapabilitiesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.Capabilities listByLocation" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities") + Observable> listByLocation(@Path("locationName") String locationName, @Path("subscriptionId") String subscriptionId, @Query("include") CapabilityGroup include, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @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 LocationCapabilitiesInner object if successful. + */ + public LocationCapabilitiesInner listByLocation(String locationName) { + return listByLocationWithServiceResponseAsync(locationName).toBlocking().single().body(); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @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(String locationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByLocationWithServiceResponseAsync(locationName), serviceCallback); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LocationCapabilitiesInner object + */ + public Observable listByLocationAsync(String locationName) { + return listByLocationWithServiceResponseAsync(locationName).map(new Func1, LocationCapabilitiesInner>() { + @Override + public LocationCapabilitiesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LocationCapabilitiesInner object + */ + public Observable> listByLocationWithServiceResponseAsync(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 CapabilityGroup include = null; + return service.listByLocation(locationName, this.client.subscriptionId(), include, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByLocationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' + * @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 LocationCapabilitiesInner object if successful. + */ + public LocationCapabilitiesInner listByLocation(String locationName, CapabilityGroup include) { + return listByLocationWithServiceResponseAsync(locationName, include).toBlocking().single().body(); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' + * @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(String locationName, CapabilityGroup include, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByLocationWithServiceResponseAsync(locationName, include), serviceCallback); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LocationCapabilitiesInner object + */ + public Observable listByLocationAsync(String locationName, CapabilityGroup include) { + return listByLocationWithServiceResponseAsync(locationName, include).map(new Func1, LocationCapabilitiesInner>() { + @Override + public LocationCapabilitiesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param locationName The location name whose capabilities are retrieved. + * @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LocationCapabilitiesInner object + */ + public Observable> listByLocationWithServiceResponseAsync(String locationName, CapabilityGroup include) { + 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(), include, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByLocationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByLocationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseImpl.java new file mode 100644 index 0000000000000..90eac77d4eb12 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseImpl.java @@ -0,0 +1,467 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.Database; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseUpdate; +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.sql.v2017_10_01_preview.Sku; +import com.microsoft.azure.management.sql.v2017_10_01_preview.CreateMode; +import com.microsoft.azure.management.sql.v2017_10_01_preview.SampleName; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseStatus; +import com.microsoft.azure.management.sql.v2017_10_01_preview.CatalogCollationType; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseLicenseType; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseReadScale; +import rx.functions.Func1; + +class DatabaseImpl extends CreatableUpdatableImpl implements Database, Database.Definition, Database.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private DatabaseUpdate updateParameter; + + DatabaseImpl(String name, SqlManager manager) { + super(name, new DatabaseInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + this.updateParameter = new DatabaseUpdate(); + } + + DatabaseImpl(DatabaseInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + this.updateParameter = new DatabaseUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.inner()) + .map(new Func1() { + @Override + public DatabaseInner call(DatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.databaseName, this.updateParameter) + .map(new Func1() { + @Override + public DatabaseInner call(DatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new DatabaseUpdate(); + } + + @Override + public CatalogCollationType catalogCollation() { + return this.inner().catalogCollation(); + } + + @Override + public String collation() { + return this.inner().collation(); + } + + @Override + public CreateMode createMode() { + return this.inner().createMode(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String currentServiceObjectiveName() { + return this.inner().currentServiceObjectiveName(); + } + + @Override + public Sku currentSku() { + return this.inner().currentSku(); + } + + @Override + public UUID databaseId() { + return this.inner().databaseId(); + } + + @Override + public String defaultSecondaryLocation() { + return this.inner().defaultSecondaryLocation(); + } + + @Override + public DateTime earliestRestoreDate() { + return this.inner().earliestRestoreDate(); + } + + @Override + public String elasticPoolId() { + return this.inner().elasticPoolId(); + } + + @Override + public String failoverGroupId() { + return this.inner().failoverGroupId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public DatabaseLicenseType licenseType() { + return this.inner().licenseType(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String longTermRetentionBackupResourceId() { + return this.inner().longTermRetentionBackupResourceId(); + } + + @Override + public String managedBy() { + return this.inner().managedBy(); + } + + @Override + public Long maxLogSizeBytes() { + return this.inner().maxLogSizeBytes(); + } + + @Override + public Long maxSizeBytes() { + return this.inner().maxSizeBytes(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DatabaseReadScale readScale() { + return this.inner().readScale(); + } + + @Override + public String recoverableDatabaseId() { + return this.inner().recoverableDatabaseId(); + } + + @Override + public String recoveryServicesRecoveryPointId() { + return this.inner().recoveryServicesRecoveryPointId(); + } + + @Override + public String requestedServiceObjectiveName() { + return this.inner().requestedServiceObjectiveName(); + } + + @Override + public String restorableDroppedDatabaseId() { + return this.inner().restorableDroppedDatabaseId(); + } + + @Override + public DateTime restorePointInTime() { + return this.inner().restorePointInTime(); + } + + @Override + public SampleName sampleName() { + return this.inner().sampleName(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public DateTime sourceDatabaseDeletionDate() { + return this.inner().sourceDatabaseDeletionDate(); + } + + @Override + public String sourceDatabaseId() { + return this.inner().sourceDatabaseId(); + } + + @Override + public DatabaseStatus status() { + return this.inner().status(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Boolean zoneRedundant() { + return this.inner().zoneRedundant(); + } + + @Override + public DatabaseImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public DatabaseImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public DatabaseImpl withCatalogCollation(CatalogCollationType catalogCollation) { + if (isInCreateMode()) { + this.inner().withCatalogCollation(catalogCollation); + } else { + this.updateParameter.withCatalogCollation(catalogCollation); + } + return this; + } + + @Override + public DatabaseImpl withCollation(String collation) { + if (isInCreateMode()) { + this.inner().withCollation(collation); + } else { + this.updateParameter.withCollation(collation); + } + return this; + } + + @Override + public DatabaseImpl withCreateMode(CreateMode createMode) { + if (isInCreateMode()) { + this.inner().withCreateMode(createMode); + } else { + this.updateParameter.withCreateMode(createMode); + } + return this; + } + + @Override + public DatabaseImpl withElasticPoolId(String elasticPoolId) { + if (isInCreateMode()) { + this.inner().withElasticPoolId(elasticPoolId); + } else { + this.updateParameter.withElasticPoolId(elasticPoolId); + } + return this; + } + + @Override + public DatabaseImpl withLicenseType(DatabaseLicenseType licenseType) { + if (isInCreateMode()) { + this.inner().withLicenseType(licenseType); + } else { + this.updateParameter.withLicenseType(licenseType); + } + return this; + } + + @Override + public DatabaseImpl withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + if (isInCreateMode()) { + this.inner().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + } else { + this.updateParameter.withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + } + return this; + } + + @Override + public DatabaseImpl withMaxSizeBytes(Long maxSizeBytes) { + if (isInCreateMode()) { + this.inner().withMaxSizeBytes(maxSizeBytes); + } else { + this.updateParameter.withMaxSizeBytes(maxSizeBytes); + } + return this; + } + + @Override + public DatabaseImpl withReadScale(DatabaseReadScale readScale) { + if (isInCreateMode()) { + this.inner().withReadScale(readScale); + } else { + this.updateParameter.withReadScale(readScale); + } + return this; + } + + @Override + public DatabaseImpl withRecoverableDatabaseId(String recoverableDatabaseId) { + if (isInCreateMode()) { + this.inner().withRecoverableDatabaseId(recoverableDatabaseId); + } else { + this.updateParameter.withRecoverableDatabaseId(recoverableDatabaseId); + } + return this; + } + + @Override + public DatabaseImpl withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + if (isInCreateMode()) { + this.inner().withRecoveryServicesRecoveryPointId(recoveryServicesRecoveryPointId); + } else { + this.updateParameter.withRecoveryServicesRecoveryPointId(recoveryServicesRecoveryPointId); + } + return this; + } + + @Override + public DatabaseImpl withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + if (isInCreateMode()) { + this.inner().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + } else { + this.updateParameter.withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + } + return this; + } + + @Override + public DatabaseImpl withRestorePointInTime(DateTime restorePointInTime) { + if (isInCreateMode()) { + this.inner().withRestorePointInTime(restorePointInTime); + } else { + this.updateParameter.withRestorePointInTime(restorePointInTime); + } + return this; + } + + @Override + public DatabaseImpl withSampleName(SampleName sampleName) { + if (isInCreateMode()) { + this.inner().withSampleName(sampleName); + } else { + this.updateParameter.withSampleName(sampleName); + } + return this; + } + + @Override + public DatabaseImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + + @Override + public DatabaseImpl withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + if (isInCreateMode()) { + this.inner().withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + } else { + this.updateParameter.withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + } + return this; + } + + @Override + public DatabaseImpl withSourceDatabaseId(String sourceDatabaseId) { + if (isInCreateMode()) { + this.inner().withSourceDatabaseId(sourceDatabaseId); + } else { + this.updateParameter.withSourceDatabaseId(sourceDatabaseId); + } + return this; + } + + @Override + public DatabaseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public DatabaseImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.inner().withZoneRedundant(zoneRedundant); + } else { + this.updateParameter.withZoneRedundant(zoneRedundant); + } + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseInner.java new file mode 100644 index 0000000000000..9c0e11f49b7f6 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseInner.java @@ -0,0 +1,723 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.Sku; +import com.microsoft.azure.management.sql.v2017_10_01_preview.CreateMode; +import com.microsoft.azure.management.sql.v2017_10_01_preview.SampleName; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseStatus; +import java.util.UUID; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_10_01_preview.CatalogCollationType; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseLicenseType; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseReadScale; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A database resource. + */ +@JsonFlatten +public class DatabaseInner extends Resource { + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Kind of database. This is metadata used for the Azure portal experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Resource that manages the database. + */ + @JsonProperty(value = "managedBy", access = JsonProperty.Access.WRITE_ONLY) + private String managedBy; + + /** + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * Secondary: creates a database as a secondary replica of an existing + * database. sourceDatabaseId must be specified as the resource ID of the + * existing primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported + * for DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /** + * The collation of the database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The name of the sample schema to apply when creating this database. + * Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', + * 'WideWorldImportersFull'. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /** + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "properties.elasticPoolId") + private String elasticPoolId; + + /** + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * The status of the database. Possible values include: 'Online', + * 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', + * 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', + * 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', + * 'Resuming', 'Scaling'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /** + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The current service level objective name of the database. + */ + @JsonProperty(value = "properties.currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /** + * The requested service level objective name of the database. + */ + @JsonProperty(value = "properties.requestedServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjectiveName; + + /** + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private DateTime sourceDatabaseDeletionDate; + + /** + * The resource identifier of the recovery point associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /** + * The resource identifier of the long term retention backup associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /** + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /** + * The resource identifier of the restorable dropped database associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /** + * Collation of the metadata catalog. Possible values include: + * 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /** + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * The license type to apply for this database. Possible values include: + * 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private DatabaseLicenseType licenseType; + + /** + * The max log size for this database. + */ + @JsonProperty(value = "properties.maxLogSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long maxLogSizeBytes; + + /** + * This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * The state of read-only routing. If enabled, connections that have + * application intent set to readonly in their connection string may be + * routed to a readonly secondary replica in the same region. Possible + * values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.readScale") + private DatabaseReadScale readScale; + + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "properties.currentSku", access = JsonProperty.Access.WRITE_ONLY) + private Sku currentSku; + + /** + * Get the name and tier of the SKU. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the name and tier of the SKU. + * + * @param sku the sku value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get kind of database. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get resource that manages the database. + * + * @return the managedBy value + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Get specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set specifies the mode of database creation. + Default: regular database creation. + Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. + Secondary: creates a database as a secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. + PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. + Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. + Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. + RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. + Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'Default', 'Copy', 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + * + * @param createMode the createMode value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the collation of the database. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation of the database. + * + * @param collation the collation value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the max size of the database expressed in bytes. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the max size of the database expressed in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @return the sampleName value + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set the name of the sample schema to apply when creating this database. Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull'. + * + * @param sampleName the sampleName value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get the resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value + */ + public String elasticPoolId() { + return this.elasticPoolId; + } + + /** + * Set the resource identifier of the elastic pool containing this database. + * + * @param elasticPoolId the elasticPoolId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withElasticPoolId(String elasticPoolId) { + this.elasticPoolId = elasticPoolId; + return this; + } + + /** + * Get the resource identifier of the source database associated with create operation of this database. + * + * @return the sourceDatabaseId value + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set the resource identifier of the source database associated with create operation of this database. + * + * @param sourceDatabaseId the sourceDatabaseId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the status of the database. Possible values include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling'. + * + * @return the status value + */ + public DatabaseStatus status() { + return this.status; + } + + /** + * Get the ID of the database. + * + * @return the databaseId value + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get the creation date of the database (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the current service level objective name of the database. + * + * @return the currentServiceObjectiveName value + */ + public String currentServiceObjectiveName() { + return this.currentServiceObjectiveName; + } + + /** + * Get the requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value + */ + public String requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Get the default secondary region for this database. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value + */ + public DateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get the resource identifier of the recovery point associated with create operation of this database. + * + * @return the recoveryServicesRecoveryPointId value + */ + public String recoveryServicesRecoveryPointId() { + return this.recoveryServicesRecoveryPointId; + } + + /** + * Set the resource identifier of the recovery point associated with create operation of this database. + * + * @param recoveryServicesRecoveryPointId the recoveryServicesRecoveryPointId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.recoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; + return this; + } + + /** + * Get the resource identifier of the long term retention backup associated with create operation of this database. + * + * @return the longTermRetentionBackupResourceId value + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the resource identifier of the long term retention backup associated with create operation of this database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * 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 DatabaseInner object itself. + */ + public DatabaseInner withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @return the restorableDroppedDatabaseId value + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the resource identifier of the restorable dropped database associated with create operation of this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * Get collation of the metadata catalog. Possible values include: 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + * + * @return the catalogCollation value + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set collation of the metadata catalog. Possible values include: 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + * + * @param catalogCollation the catalogCollation value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the license type to apply for this database. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public DatabaseLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type to apply for this database. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withLicenseType(DatabaseLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the max log size for this database. + * + * @return the maxLogSizeBytes value + */ + public Long maxLogSizeBytes() { + return this.maxLogSizeBytes; + } + + /** + * Get this records the earliest start date and time that restore is available for this database (ISO8601 format). + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'Enabled', 'Disabled'. + * + * @return the readScale value + */ + public DatabaseReadScale readScale() { + return this.readScale; + } + + /** + * Set the state of read-only routing. If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica in the same region. Possible values include: 'Enabled', 'Disabled'. + * + * @param readScale the readScale value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withReadScale(DatabaseReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get the name and tier of the SKU. + * + * @return the currentSku value + */ + public Sku currentSku() { + return this.currentSku; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationImpl.java new file mode 100644 index 0000000000000..27954dfb294ce --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationImpl.java @@ -0,0 +1,117 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseOperation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagementOperationState; + +class DatabaseOperationImpl extends WrapperImpl implements DatabaseOperation { + private final SqlManager manager; + + DatabaseOperationImpl(DatabaseOperationInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String databaseName() { + return this.inner().databaseName(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public Integer errorCode() { + return this.inner().errorCode(); + } + + @Override + public String errorDescription() { + return this.inner().errorDescription(); + } + + @Override + public Integer errorSeverity() { + return this.inner().errorSeverity(); + } + + @Override + public DateTime estimatedCompletionTime() { + return this.inner().estimatedCompletionTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isCancellable() { + return this.inner().isCancellable(); + } + + @Override + public Boolean isUserError() { + return this.inner().isUserError(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String operation() { + return this.inner().operation(); + } + + @Override + public String operationFriendlyName() { + return this.inner().operationFriendlyName(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public ManagementOperationState state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationInner.java new file mode 100644 index 0000000000000..1560c1b9b2ac6 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationInner.java @@ -0,0 +1,233 @@ +/** + * 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_10_01_preview.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database operation. + */ +@JsonFlatten +public class DatabaseOperationInner extends ProxyResource { + /** + * The name of the database the operation is being performed on. + */ + @JsonProperty(value = "properties.databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * The name of operation. + */ + @JsonProperty(value = "properties.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The friendly name of operation. + */ + @JsonProperty(value = "properties.operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /** + * The percentage of the operation completed. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /** + * The name of the server. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The operation start time. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The operation state. Possible values include: 'Pending', 'InProgress', + * 'Succeeded', 'Failed', 'CancelInProgress', 'Cancelled'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ManagementOperationState state; + + /** + * The operation error code. + */ + @JsonProperty(value = "properties.errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /** + * The operation error description. + */ + @JsonProperty(value = "properties.errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /** + * The operation error severity. + */ + @JsonProperty(value = "properties.errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /** + * Whether or not the error is a user error. + */ + @JsonProperty(value = "properties.isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /** + * The estimated completion time of the operation. + */ + @JsonProperty(value = "properties.estimatedCompletionTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime estimatedCompletionTime; + + /** + * The operation description. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Whether the operation can be cancelled. + */ + @JsonProperty(value = "properties.isCancellable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isCancellable; + + /** + * Get the name of the database the operation is being performed on. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the name of operation. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the friendly name of operation. + * + * @return the operationFriendlyName value + */ + public String operationFriendlyName() { + return this.operationFriendlyName; + } + + /** + * Get the percentage of the operation completed. + * + * @return the percentComplete value + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the name of the server. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the operation start time. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the operation state. Possible values include: 'Pending', 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', 'Cancelled'. + * + * @return the state value + */ + public ManagementOperationState state() { + return this.state; + } + + /** + * Get the operation error code. + * + * @return the errorCode value + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the operation error description. + * + * @return the errorDescription value + */ + public String errorDescription() { + return this.errorDescription; + } + + /** + * Get the operation error severity. + * + * @return the errorSeverity value + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get whether or not the error is a user error. + * + * @return the isUserError value + */ + public Boolean isUserError() { + return this.isUserError; + } + + /** + * Get the estimated completion time of the operation. + * + * @return the estimatedCompletionTime value + */ + public DateTime estimatedCompletionTime() { + return this.estimatedCompletionTime; + } + + /** + * Get the operation description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get whether the operation can be cancelled. + * + * @return the isCancellable value + */ + public Boolean isCancellable() { + return this.isCancellable; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationsImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationsImpl.java new file mode 100644 index 0000000000000..c8be8c8a6fef6 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationsImpl.java @@ -0,0 +1,61 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseOperations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseOperation; + +class DatabaseOperationsImpl extends WrapperImpl implements DatabaseOperations { + private final SqlManager manager; + + DatabaseOperationsImpl(SqlManager manager) { + super(manager.inner().databaseOperations()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private DatabaseOperationImpl wrapModel(DatabaseOperationInner inner) { + return new DatabaseOperationImpl(inner, manager()); + } + + @Override + public Completable cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + DatabaseOperationsInner client = this.inner(); + return client.cancelAsync(resourceGroupName, serverName, databaseName, operationId).toCompletable(); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + DatabaseOperationsInner 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 DatabaseOperation call(DatabaseOperationInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationsInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationsInner.java new file mode 100644 index 0000000000000..55ba5816ab202 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseOperationsInner.java @@ -0,0 +1,417 @@ +/** + * 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_10_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 java.util.UUID; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +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 DatabaseOperations. + */ +public class DatabaseOperationsInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseOperationsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseOperationsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseOperations cancel" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations/{operationId}/cancel") + Observable> cancel(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("operationId") UUID operationId, @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_10_01_preview.DatabaseOperations listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/operations") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseOperations listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Cancels the asynchronous operation on the 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 operationId The operation identifier. + * @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 cancel(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId).toBlocking().single().body(); + } + + /** + * Cancels the asynchronous operation on the 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 operationId The operation identifier. + * @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 cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId), serviceCallback); + } + + /** + * Cancels the asynchronous operation on the 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 operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + return cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels the asynchronous operation on the 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 operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + 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 (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.cancel(resourceGroupName, serverName, databaseName, operationId, 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 = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(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 operations performed on the 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<DatabaseOperationInner> 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 a list of operations performed on the 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 a list of operations performed on the 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<DatabaseOperationInner> 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 a list of operations performed on the 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<DatabaseOperationInner> 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 a list of operations performed on the 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseOperationInner> 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."); + } + return service.listByDatabase(resourceGroupName, serverName, 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 operations performed on the 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<DatabaseOperationInner> 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 operations performed on the 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 a list of operations performed on the 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<DatabaseOperationInner> 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 operations performed on the 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<DatabaseOperationInner> 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 operations performed on the 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<DatabaseOperationInner> 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_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java new file mode 100644 index 0000000000000..4a8a8a8aff3d1 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java @@ -0,0 +1,46 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScansExport; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class DatabaseVulnerabilityAssessmentScansExportImpl extends WrapperImpl implements DatabaseVulnerabilityAssessmentScansExport { + private final SqlManager manager; + DatabaseVulnerabilityAssessmentScansExportImpl(DatabaseVulnerabilityAssessmentScansExportInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String exportedReportLocation() { + return this.inner().exportedReportLocation(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java new file mode 100644 index 0000000000000..26a307dceb7e7 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java @@ -0,0 +1,36 @@ +/** + * 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_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A database Vulnerability Assessment scan export resource. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentScansExportInner extends ProxyResource { + /** + * Location of the exported report (e.g. + * https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + */ + @JsonProperty(value = "properties.exportedReportLocation", access = JsonProperty.Access.WRITE_ONLY) + private String exportedReportLocation; + + /** + * Get location of the exported report (e.g. https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + * + * @return the exportedReportLocation value + */ + public String exportedReportLocation() { + return this.exportedReportLocation; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java new file mode 100644 index 0000000000000..600bda466a785 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansImpl.java @@ -0,0 +1,94 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanRecord; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScansExport; + +class DatabaseVulnerabilityAssessmentScansImpl extends WrapperImpl implements DatabaseVulnerabilityAssessmentScans { + private final SqlManager manager; + + DatabaseVulnerabilityAssessmentScansImpl(SqlManager manager) { + super(manager.inner().databaseVulnerabilityAssessmentScans()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private VulnerabilityAssessmentScanRecordImpl wrapVulnerabilityAssessmentScanRecordModel(VulnerabilityAssessmentScanRecordInner inner) { + return new VulnerabilityAssessmentScanRecordImpl(inner, manager()); + } + + private Observable getVulnerabilityAssessmentScanRecordInnerUsingDatabaseVulnerabilityAssessmentScansInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String serverName = IdParsingUtils.getValueFromIdByName(id, "servers"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "databases"); + String scanId = IdParsingUtils.getValueFromIdByName(id, "scans"); + DatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, scanId); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + DatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName, scanId) + .map(new Func1() { + @Override + public VulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapVulnerabilityAssessmentScanRecordModel(inner); + } + }); + } + + @Override + public Observable listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + DatabaseVulnerabilityAssessmentScansInner 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 VulnerabilityAssessmentScanRecord call(VulnerabilityAssessmentScanRecordInner inner) { + return wrapVulnerabilityAssessmentScanRecordModel(inner); + } + }); + } + + @Override + public Completable initiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + DatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.initiateScanAsync(resourceGroupName, serverName, databaseName, scanId).toCompletable(); + } + + @Override + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + DatabaseVulnerabilityAssessmentScansInner client = this.inner(); + return client.exportAsync(resourceGroupName, serverName, databaseName, scanId) + .map(new Func1() { + @Override + public DatabaseVulnerabilityAssessmentScansExport call(DatabaseVulnerabilityAssessmentScansExportInner inner) { + return new DatabaseVulnerabilityAssessmentScansExportImpl(inner, manager()); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java new file mode 100644 index 0000000000000..e847f2a52385a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabaseVulnerabilityAssessmentScansInner.java @@ -0,0 +1,717 @@ +/** + * 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_10_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.POST; +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 DatabaseVulnerabilityAssessmentScans. + */ +public class DatabaseVulnerabilityAssessmentScansInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseVulnerabilityAssessmentScansService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentScansInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseVulnerabilityAssessmentScansInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseVulnerabilityAssessmentScansService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseVulnerabilityAssessmentScans to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseVulnerabilityAssessmentScansService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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_10_01_preview.DatabaseVulnerabilityAssessmentScans initiateScan" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + Observable> initiateScan(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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_10_01_preview.DatabaseVulnerabilityAssessmentScans beginInitiateScan" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + Observable> beginInitiateScan(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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_10_01_preview.DatabaseVulnerabilityAssessmentScans listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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_10_01_preview.DatabaseVulnerabilityAssessmentScans export" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export") + Observable> export(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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_10_01_preview.DatabaseVulnerabilityAssessmentScans listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a vulnerability assessment scan record of 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 VulnerabilityAssessmentScanRecordInner object if successful. + */ + public VulnerabilityAssessmentScanRecordInner get(String resourceGroupName, String serverName, String databaseName, String scanId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Gets a vulnerability assessment scan record of 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Gets a vulnerability assessment scan record of 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VulnerabilityAssessmentScanRecordInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, VulnerabilityAssessmentScanRecordInner>() { + @Override + public VulnerabilityAssessmentScanRecordInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a vulnerability assessment scan record of 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VulnerabilityAssessmentScanRecordInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, 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); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScan(String resourceGroupName, String serverName, String databaseName, String scanId) { + initiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().last().body(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 initiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(initiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable initiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return initiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> initiateScanWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + Observable> observable = service.initiateScan(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 beginInitiateScan(String resourceGroupName, String serverName, String databaseName, String scanId) { + beginInitiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 beginInitiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginInitiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginInitiateScanAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return beginInitiateScanWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The 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 scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginInitiateScanWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.beginInitiateScan(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, 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 = beginInitiateScanDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginInitiateScanDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the vulnerability assessment scans of 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 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<VulnerabilityAssessmentScanRecordInner> 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(); + } + }; + } + + /** + * Lists the vulnerability assessment scans of 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 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); + } + + /** + * Lists the vulnerability assessment scans of 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 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<VulnerabilityAssessmentScanRecordInner> 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(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of 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 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<VulnerabilityAssessmentScanRecordInner> 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)); + } + }); + } + + /** + * Lists the vulnerability assessment scans of 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 serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VulnerabilityAssessmentScanRecordInner> 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 String vulnerabilityAssessmentName = "default"; + return service.listByDatabase(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, 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); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @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 DatabaseVulnerabilityAssessmentScansExportInner object if successful. + */ + public DatabaseVulnerabilityAssessmentScansExportInner export(String resourceGroupName, String serverName, String databaseName, String scanId) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @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 exportAsync(String resourceGroupName, String serverName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object + */ + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, DatabaseVulnerabilityAssessmentScansExportInner>() { + @Override + public DatabaseVulnerabilityAssessmentScansExportInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The 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 scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object + */ + public Observable> exportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + 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 (scanId == null) { + throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default"; + return service.export(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, 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 = exportDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportDelegate(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); + } + + /** + * Lists the vulnerability assessment scans of 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<VulnerabilityAssessmentScanRecordInner> object if successful. + */ + public PagedList listByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the vulnerability assessment scans of 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<VulnerabilityAssessmentScanRecordInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of 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<VulnerabilityAssessmentScanRecordInner> object + */ + public Observable>> listByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the vulnerability assessment scans of 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<VulnerabilityAssessmentScanRecordInner> 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_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesImpl.java new file mode 100644 index 0000000000000..03664427619c3 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesImpl.java @@ -0,0 +1,135 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.Databases; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_10_01_preview.Database; + +class DatabasesImpl extends WrapperImpl implements Databases { + private final SqlManager manager; + + DatabasesImpl(SqlManager manager) { + super(manager.inner().databases()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public DatabaseImpl define(String name) { + return wrapModel(name); + } + + private DatabaseImpl wrapModel(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + + private DatabaseImpl wrapModel(String name) { + return new DatabaseImpl(name, this.manager()); + } + + @Override + public Completable upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.upgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + + @Override + public Observable listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + DatabasesInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable pauseAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.pauseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Observable resumeAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.resumeAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + }); + } + + @Override + public Completable renameAsync(String resourceGroupName, String serverName, String databaseName, String id) { + DatabasesInner client = this.inner(); + return client.renameAsync(resourceGroupName, serverName, databaseName, id).toCompletable(); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + DatabasesInner 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 Database call(DatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, databaseName) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + DatabasesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, databaseName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesInner.java new file mode 100644 index 0000000000000..ae43311abb3de --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/DatabasesInner.java @@ -0,0 +1,1862 @@ +/** + * 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_10_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_10_01_preview.DatabaseUpdate; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ResourceMoveDefinition; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.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 Databases. + */ +public class DatabasesInner { + /** The Retrofit service to perform REST calls. */ + private DatabasesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabasesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Databases to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.Databases upgradeDataWarehouse" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse") + Observable> upgradeDataWarehouse(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.Databases beginUpgradeDataWarehouse" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse") + Observable> beginUpgradeDataWarehouse(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.Databases listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases") + 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_10_01_preview.Databases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.Databases createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseInner 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_10_01_preview.Databases beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseInner 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_10_01_preview.Databases delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.Databases beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.Databases update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseUpdate 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_10_01_preview.Databases beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseUpdate 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_10_01_preview.Databases listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases") + Observable> listByElasticPool(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @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_10_01_preview.Databases pause" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause") + Observable> pause(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.Databases beginPause" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause") + Observable> beginPause(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.Databases resume" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume") + Observable> resume(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.Databases beginResume" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume") + Observable> beginResume(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.Databases rename" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move") + Observable> rename(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ResourceMoveDefinition parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.Databases listByServerNext" }) + @GET + Observable> listByServerNext(@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_10_01_preview.Databases listByElasticPoolNext" }) + @GET + Observable> listByElasticPoolNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 to be upgraded. + * @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 upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName) { + upgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 to be upgraded. + * @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 upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(upgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 to be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName) { + return upgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 to be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> upgradeDataWarehouseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.upgradeDataWarehouse(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 to be upgraded. + * @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 beginUpgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName) { + beginUpgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 to be upgraded. + * @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 beginUpgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 to be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginUpgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName) { + return beginUpgradeDataWarehouseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upgrades a data warehouse. + * + * @param resourceGroupName The 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 to be upgraded. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginUpgradeDataWarehouseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginUpgradeDataWarehouse(resourceGroupName, serverName, 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 clientResponse = beginUpgradeDataWarehouseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpgradeDataWarehouseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of 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 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<DatabaseInner> 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(); + } + }; + } + + /** + * Gets a list of 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 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); + } + + /** + * Gets a list of 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> 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(); + } + }); + } + + /** + * Gets a list of 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> 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)); + } + }); + } + + /** + * Gets a list of 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseInner> 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); + } + + /** + * Gets 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 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 DatabaseInner object if successful. + */ + public DatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a database. + * + * @param resourceGroupName The 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 DatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets 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 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 DatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, serverName, 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 clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabaseInner object if successful. + */ + public DatabaseInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabaseInner object if successful. + */ + public DatabaseInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, serverName, databaseName, 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(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes the 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 + */ + public void delete(String resourceGroupName, String serverName, String databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Deletes the 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 deleteAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Deletes the 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 + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the 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 + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the 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 + */ + public void beginDelete(String resourceGroupName, String serverName, String databaseName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Deletes the 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 beginDeleteAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Deletes the 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 {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String databaseName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the 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 {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, serverName, 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 clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabaseInner object if successful. + */ + public DatabaseInner update(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.update(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabaseInner object if successful. + */ + public DatabaseInner beginUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The requested database resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(resourceGroupName, serverName, databaseName, 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 = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @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<DatabaseInner> object if successful. + */ + public PagedList listByElasticPool(final String resourceGroupName, final String serverName, final String elasticPoolName) { + ServiceResponse> response = listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @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> listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> object + */ + public Observable> listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of databases in an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatabaseInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + return listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName) + .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(listByElasticPoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of databases in an elastic pool. + * + 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByElasticPoolSinglePageAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByElasticPool(resourceGroupName, serverName, elasticPoolName, 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 = listByElasticPoolDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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); + } + + /** + * Pauses 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 serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner pause(String resourceGroupName, String serverName, String databaseName) { + return pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Pauses 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 serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 pauseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Pauses 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 serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable pauseAsync(String resourceGroupName, String serverName, String databaseName) { + return pauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Pauses 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 serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> pauseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.pause(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Pauses 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 serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner beginPause(String resourceGroupName, String serverName, String databaseName) { + return beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Pauses 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 serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @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 beginPauseAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Pauses 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 serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginPauseAsync(String resourceGroupName, String serverName, String databaseName) { + return beginPauseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Pauses 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 serverName The name of the server. + * @param databaseName The name of the database to be paused. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginPauseWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginPause(resourceGroupName, serverName, 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 clientResponse = beginPauseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginPauseDelegate(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); + } + + /** + * Resumes 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 serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner resume(String resourceGroupName, String serverName, String databaseName) { + return resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Resumes 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 serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 resumeAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Resumes 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 serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable resumeAsync(String resourceGroupName, String serverName, String databaseName) { + return resumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Resumes 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 serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> resumeWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.resume(resourceGroupName, serverName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Resumes 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 serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 DatabaseInner object if successful. + */ + public DatabaseInner beginResume(String resourceGroupName, String serverName, String databaseName) { + return beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Resumes 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 serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @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 beginResumeAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Resumes 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 serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginResumeAsync(String resourceGroupName, String serverName, String databaseName) { + return beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Resumes 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 serverName The name of the server. + * @param databaseName The name of the database to be resumed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginResumeWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginResume(resourceGroupName, serverName, 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 clientResponse = beginResumeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginResumeDelegate(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); + } + + /** + * Renames 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 serverName The name of the server. + * @param databaseName The name of the database to rename. + * @param id The target ID for the 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 + */ + public void rename(String resourceGroupName, String serverName, String databaseName, String id) { + renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id).toBlocking().single().body(); + } + + /** + * Renames 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 serverName The name of the server. + * @param databaseName The name of the database to rename. + * @param id The target ID for the 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 renameAsync(String resourceGroupName, String serverName, String databaseName, String id, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id), serviceCallback); + } + + /** + * Renames 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 serverName The name of the server. + * @param databaseName The name of the database to rename. + * @param id The target ID for the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable renameAsync(String resourceGroupName, String serverName, String databaseName, String id) { + return renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Renames 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 serverName The name of the server. + * @param databaseName The name of the database to rename. + * @param id The target ID for the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> renameWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String id) { + 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."); + } + if (id == null) { + throw new IllegalArgumentException("Parameter id is required and cannot be null."); + } + ResourceMoveDefinition parameters = new ResourceMoveDefinition(); + parameters.withId(id); + return service.rename(resourceGroupName, serverName, databaseName, 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 = renameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse renameDelegate(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 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<DatabaseInner> 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(); + } + }; + } + + /** + * Gets a list of 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> 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); + } + + /** + * Gets a list of 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<DatabaseInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of 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<DatabaseInner> 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)); + } + }); + } + + /** + * Gets a list of 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<DatabaseInner> 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); + } + + /** + * Gets a list of databases in an elastic pool. + * + * @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<DatabaseInner> object if successful. + */ + public PagedList listByElasticPoolNext(final String nextPageLink) { + ServiceResponse> response = listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of databases in an elastic pool. + * + * @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> listByElasticPoolNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByElasticPoolNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of databases in an elastic pool. + * + * @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<DatabaseInner> object + */ + public Observable> listByElasticPoolNextAsync(final String nextPageLink) { + return listByElasticPoolNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of databases in an elastic pool. + * + * @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<DatabaseInner> object + */ + public Observable>> listByElasticPoolNextWithServiceResponseAsync(final String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(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(listByElasticPoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of databases in an elastic pool. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatabaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByElasticPoolNextSinglePageAsync(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.listByElasticPoolNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolNextDelegate(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_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolImpl.java new file mode 100644 index 0000000000000..88df7092bc8cc --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolImpl.java @@ -0,0 +1,238 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPool; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolUpdate; +import java.util.Map; +import com.microsoft.azure.management.sql.v2017_10_01_preview.Sku; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolState; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolPerDatabaseSettings; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolLicenseType; +import rx.functions.Func1; + +class ElasticPoolImpl extends CreatableUpdatableImpl implements ElasticPool, ElasticPool.Definition, ElasticPool.Update { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String elasticPoolName; + private ElasticPoolUpdate updateParameter; + + ElasticPoolImpl(String name, SqlManager manager) { + super(name, new ElasticPoolInner()); + this.manager = manager; + // Set resource name + this.elasticPoolName = name; + // + this.updateParameter = new ElasticPoolUpdate(); + } + + ElasticPoolImpl(ElasticPoolInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.elasticPoolName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.elasticPoolName = IdParsingUtils.getValueFromIdByName(inner.id(), "elasticPools"); + // + this.updateParameter = new ElasticPoolUpdate(); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serverName, this.elasticPoolName, this.inner()) + .map(new Func1() { + @Override + public ElasticPoolInner call(ElasticPoolInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.updateAsync(this.resourceGroupName, this.serverName, this.elasticPoolName, this.updateParameter) + .map(new Func1() { + @Override + public ElasticPoolInner call(ElasticPoolInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ElasticPoolsInner client = this.manager().inner().elasticPools(); + return client.getAsync(this.resourceGroupName, this.serverName, this.elasticPoolName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ElasticPoolUpdate(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public ElasticPoolLicenseType licenseType() { + return this.inner().licenseType(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public Long maxSizeBytes() { + return this.inner().maxSizeBytes(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.inner().perDatabaseSettings(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public ElasticPoolState state() { + return this.inner().state(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Boolean zoneRedundant() { + return this.inner().zoneRedundant(); + } + + @Override + public ElasticPoolImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + @Override + public ElasticPoolImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public ElasticPoolImpl withLicenseType(ElasticPoolLicenseType licenseType) { + if (isInCreateMode()) { + this.inner().withLicenseType(licenseType); + } else { + this.updateParameter.withLicenseType(licenseType); + } + return this; + } + + @Override + public ElasticPoolImpl withMaxSizeBytes(Long maxSizeBytes) { + if (isInCreateMode()) { + this.inner().withMaxSizeBytes(maxSizeBytes); + } else { + this.updateParameter.withMaxSizeBytes(maxSizeBytes); + } + return this; + } + + @Override + public ElasticPoolImpl withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + if (isInCreateMode()) { + this.inner().withPerDatabaseSettings(perDatabaseSettings); + } else { + this.updateParameter.withPerDatabaseSettings(perDatabaseSettings); + } + return this; + } + + @Override + public ElasticPoolImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + + @Override + public ElasticPoolImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public ElasticPoolImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.inner().withZoneRedundant(zoneRedundant); + } else { + this.updateParameter.withZoneRedundant(zoneRedundant); + } + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolInner.java new file mode 100644 index 0000000000000..e7e1135945e93 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolInner.java @@ -0,0 +1,205 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.Sku; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolState; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolPerDatabaseSettings; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolLicenseType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An elastic pool. + */ +@JsonFlatten +public class ElasticPoolInner extends Resource { + /** + * The sku property. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Kind of elastic pool. This is metadata used for the Azure portal + * experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * The state of the elastic pool. Possible values include: 'Creating', + * 'Ready', 'Disabled'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ElasticPoolState state; + + /** + * The creation date of the elastic pool (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The storage limit for the database elastic pool in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The per database settings for the elastic pool. + */ + @JsonProperty(value = "properties.perDatabaseSettings") + private ElasticPoolPerDatabaseSettings perDatabaseSettings; + + /** + * Whether or not this elastic pool is zone redundant, which means the + * replicas of this elastic pool will be spread across multiple + * availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * The license type to apply for this elastic pool. Possible values + * include: 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private ElasticPoolLicenseType licenseType; + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get kind of elastic pool. This is metadata used for the Azure portal experience. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get the state of the elastic pool. Possible values include: 'Creating', 'Ready', 'Disabled'. + * + * @return the state value + */ + public ElasticPoolState state() { + return this.state; + } + + /** + * Get the creation date of the elastic pool (ISO8601 format). + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the storage limit for the database elastic pool in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the per database settings for the elastic pool. + * + * @return the perDatabaseSettings value + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.perDatabaseSettings; + } + + /** + * Set the per database settings for the elastic pool. + * + * @param perDatabaseSettings the perDatabaseSettings value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + this.perDatabaseSettings = perDatabaseSettings; + return this; + } + + /** + * Get whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set whether or not this elastic pool is zone redundant, which means the replicas of this elastic pool will be spread across multiple availability zones. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the license type to apply for this elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @return the licenseType value + */ + public ElasticPoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the license type to apply for this elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice'. + * + * @param licenseType the licenseType value to set + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withLicenseType(ElasticPoolLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationImpl.java new file mode 100644 index 0000000000000..3729dc983f02c --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationImpl.java @@ -0,0 +1,116 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolOperation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class ElasticPoolOperationImpl extends WrapperImpl implements ElasticPoolOperation { + private final SqlManager manager; + + ElasticPoolOperationImpl(ElasticPoolOperationInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String elasticPoolName() { + return this.inner().elasticPoolName(); + } + + @Override + public Integer errorCode() { + return this.inner().errorCode(); + } + + @Override + public String errorDescription() { + return this.inner().errorDescription(); + } + + @Override + public Integer errorSeverity() { + return this.inner().errorSeverity(); + } + + @Override + public DateTime estimatedCompletionTime() { + return this.inner().estimatedCompletionTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isCancellable() { + return this.inner().isCancellable(); + } + + @Override + public Boolean isUserError() { + return this.inner().isUserError(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String operation() { + return this.inner().operation(); + } + + @Override + public String operationFriendlyName() { + return this.inner().operationFriendlyName(); + } + + @Override + public Integer percentComplete() { + return this.inner().percentComplete(); + } + + @Override + public String serverName() { + return this.inner().serverName(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String state() { + return this.inner().state(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationInner.java new file mode 100644 index 0000000000000..7f8909f84caca --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationInner.java @@ -0,0 +1,231 @@ +/** + * 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_10_01_preview.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A elastic pool operation. + */ +@JsonFlatten +public class ElasticPoolOperationInner extends ProxyResource { + /** + * The name of the elastic pool the operation is being performed on. + */ + @JsonProperty(value = "properties.elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /** + * The name of operation. + */ + @JsonProperty(value = "properties.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The friendly name of operation. + */ + @JsonProperty(value = "properties.operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /** + * The percentage of the operation completed. + */ + @JsonProperty(value = "properties.percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /** + * The name of the server. + */ + @JsonProperty(value = "properties.serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The operation start time. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The operation state. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The operation error code. + */ + @JsonProperty(value = "properties.errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /** + * The operation error description. + */ + @JsonProperty(value = "properties.errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /** + * The operation error severity. + */ + @JsonProperty(value = "properties.errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /** + * Whether or not the error is a user error. + */ + @JsonProperty(value = "properties.isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /** + * The estimated completion time of the operation. + */ + @JsonProperty(value = "properties.estimatedCompletionTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime estimatedCompletionTime; + + /** + * The operation description. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Whether the operation can be cancelled. + */ + @JsonProperty(value = "properties.isCancellable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isCancellable; + + /** + * Get the name of the elastic pool the operation is being performed on. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the name of operation. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the friendly name of operation. + * + * @return the operationFriendlyName value + */ + public String operationFriendlyName() { + return this.operationFriendlyName; + } + + /** + * Get the percentage of the operation completed. + * + * @return the percentComplete value + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the name of the server. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the operation start time. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the operation state. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the operation error code. + * + * @return the errorCode value + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the operation error description. + * + * @return the errorDescription value + */ + public String errorDescription() { + return this.errorDescription; + } + + /** + * Get the operation error severity. + * + * @return the errorSeverity value + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get whether or not the error is a user error. + * + * @return the isUserError value + */ + public Boolean isUserError() { + return this.isUserError; + } + + /** + * Get the estimated completion time of the operation. + * + * @return the estimatedCompletionTime value + */ + public DateTime estimatedCompletionTime() { + return this.estimatedCompletionTime; + } + + /** + * Get the operation description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get whether the operation can be cancelled. + * + * @return the isCancellable value + */ + public Boolean isCancellable() { + return this.isCancellable; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationsImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationsImpl.java new file mode 100644 index 0000000000000..6ec255b0558ae --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationsImpl.java @@ -0,0 +1,61 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolOperations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import java.util.UUID; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolOperation; + +class ElasticPoolOperationsImpl extends WrapperImpl implements ElasticPoolOperations { + private final SqlManager manager; + + ElasticPoolOperationsImpl(SqlManager manager) { + super(manager.inner().elasticPoolOperations()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + private ElasticPoolOperationImpl wrapModel(ElasticPoolOperationInner inner) { + return new ElasticPoolOperationImpl(inner, manager()); + } + + @Override + public Completable cancelAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + ElasticPoolOperationsInner client = this.inner(); + return client.cancelAsync(resourceGroupName, serverName, elasticPoolName, operationId).toCompletable(); + } + + @Override + public Observable listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + ElasticPoolOperationsInner client = this.inner(); + return client.listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ElasticPoolOperation call(ElasticPoolOperationInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationsInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationsInner.java new file mode 100644 index 0000000000000..0ef8ae480283b --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolOperationsInner.java @@ -0,0 +1,417 @@ +/** + * 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_10_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 java.util.UUID; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +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 ElasticPoolOperations. + */ +public class ElasticPoolOperationsInner { + /** The Retrofit service to perform REST calls. */ + private ElasticPoolOperationsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ElasticPoolOperationsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ElasticPoolOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ElasticPoolOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface ElasticPoolOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolOperations cancel" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations/{operationId}/cancel") + Observable> cancel(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("operationId") UUID operationId, @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_10_01_preview.ElasticPoolOperations listByElasticPool" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations") + Observable> listByElasticPool(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @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_10_01_preview.ElasticPoolOperations listByElasticPoolNext" }) + @GET + Observable> listByElasticPoolNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName the String value + * @param operationId The operation identifier. + * @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 cancel(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + cancelWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, operationId).toBlocking().single().body(); + } + + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName the String value + * @param operationId The operation identifier. + * @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 cancelAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, operationId), serviceCallback); + } + + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName the String value + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + return cancelWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, operationId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName the String value + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.cancel(resourceGroupName, serverName, elasticPoolName, operationId, 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 = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(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 operations performed on the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName 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<ElasticPoolOperationInner> object if successful. + */ + public PagedList listByElasticPool(final String resourceGroupName, final String serverName, final String elasticPoolName) { + ServiceResponse> response = listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName 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> listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ElasticPoolOperationInner> object + */ + public Observable> listByElasticPoolAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ElasticPoolOperationInner> object + */ + public Observable>> listByElasticPoolWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + return listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName) + .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(listByElasticPoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of operations performed on the elastic pool. + * + 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 elasticPoolName the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ElasticPoolOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByElasticPoolSinglePageAsync(final String resourceGroupName, final String serverName, final String elasticPoolName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByElasticPool(resourceGroupName, serverName, elasticPoolName, 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 = listByElasticPoolDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolDelegate(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 operations performed on the elastic pool. + * + * @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<ElasticPoolOperationInner> object if successful. + */ + public PagedList listByElasticPoolNext(final String nextPageLink) { + ServiceResponse> response = listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @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> listByElasticPoolNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByElasticPoolNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @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<ElasticPoolOperationInner> object + */ + public Observable> listByElasticPoolNextAsync(final String nextPageLink) { + return listByElasticPoolNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @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<ElasticPoolOperationInner> object + */ + public Observable>> listByElasticPoolNextWithServiceResponseAsync(final String nextPageLink) { + return listByElasticPoolNextSinglePageAsync(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(listByElasticPoolNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of operations performed on the elastic pool. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ElasticPoolOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByElasticPoolNextSinglePageAsync(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.listByElasticPoolNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByElasticPoolNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByElasticPoolNextDelegate(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_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolsImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolsImpl.java new file mode 100644 index 0000000000000..98ef70fe4456e --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolsImpl.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_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPools; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPool; + +class ElasticPoolsImpl extends WrapperImpl implements ElasticPools { + private final SqlManager manager; + + ElasticPoolsImpl(SqlManager manager) { + super(manager.inner().elasticPools()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public ElasticPoolImpl define(String name) { + return wrapModel(name); + } + + private ElasticPoolImpl wrapModel(ElasticPoolInner inner) { + return new ElasticPoolImpl(inner, manager()); + } + + private ElasticPoolImpl wrapModel(String name) { + return new ElasticPoolImpl(name, this.manager()); + } + + @Override + public Observable listByServerAsync(final String resourceGroupName, final String serverName) { + ElasticPoolsInner 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 ElasticPool call(ElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolsInner client = this.inner(); + return client.getAsync(resourceGroupName, serverName, elasticPoolName) + .map(new Func1() { + @Override + public ElasticPool call(ElasticPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, serverName, elasticPoolName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolsInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolsInner.java new file mode 100644 index 0000000000000..5dde96c7023bb --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ElasticPoolsInner.java @@ -0,0 +1,1095 @@ +/** + * 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_10_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_10_01_preview.ElasticPoolUpdate; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ElasticPools. + */ +public class ElasticPoolsInner { + /** The Retrofit service to perform REST calls. */ + private ElasticPoolsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ElasticPoolsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ElasticPoolsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ElasticPools to be + * used by Retrofit to perform actually REST calls. + */ + interface ElasticPoolsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPools listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools") + Observable> listByServer(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Query("$skip") Integer skip, @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_10_01_preview.ElasticPools get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @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_10_01_preview.ElasticPools createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolInner 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_10_01_preview.ElasticPools beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolInner 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_10_01_preview.ElasticPools delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @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_10_01_preview.ElasticPools beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @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_10_01_preview.ElasticPools update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolUpdate 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_10_01_preview.ElasticPools beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolUpdate 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_10_01_preview.ElasticPools listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all elastic pools in a 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 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<ElasticPoolInner> 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(); + } + }; + } + + /** + * Gets all elastic pools in a 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 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); + } + + /** + * Gets all elastic pools in a 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ElasticPoolInner> 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(); + } + }); + } + + /** + * Gets all elastic pools in a 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ElasticPoolInner> 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)); + } + }); + } + + /** + * Gets all elastic pools in a 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 serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ElasticPoolInner> 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."); + } + final Integer skip = null; + return service.listByServer(resourceGroupName, serverName, this.client.subscriptionId(), skip, 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); + } + } + }); + } + + /** + * Gets all elastic pools in a 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 serverName The name of the server. + * @param skip The number of elements in the collection to skip. + * @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<ElasticPoolInner> object if successful. + */ + public PagedList listByServer(final String resourceGroupName, final String serverName, final Integer skip) { + ServiceResponse> response = listByServerSinglePageAsync(resourceGroupName, serverName, skip).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all elastic pools in a 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 serverName The name of the server. + * @param skip The number of elements in the collection to skip. + * @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 Integer skip, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(resourceGroupName, serverName, skip), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all elastic pools in a 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 serverName The name of the server. + * @param skip The number of elements in the collection to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ElasticPoolInner> object + */ + public Observable> listByServerAsync(final String resourceGroupName, final String serverName, final Integer skip) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName, skip) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all elastic pools in a 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 serverName The name of the server. + * @param skip The number of elements in the collection to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ElasticPoolInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String resourceGroupName, final String serverName, final Integer skip) { + return listByServerSinglePageAsync(resourceGroupName, serverName, skip) + .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)); + } + }); + } + + /** + * Gets all elastic pools in a 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 serverName The name of the server. + ServiceResponse> * @param skip The number of elements in the collection to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ElasticPoolInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String resourceGroupName, final String serverName, final Integer skip) { + 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(), skip, 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); + } + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @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 ElasticPoolInner object if successful. + */ + public ElasticPoolInner get(String resourceGroupName, String serverName, String elasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @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 elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, serverName, elasticPoolName, 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 an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ElasticPoolInner object if successful. + */ + public ElasticPoolInner createOrUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (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); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, elasticPoolName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ElasticPoolInner object if successful. + */ + public ElasticPoolInner beginCreateOrUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (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); + return service.beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, 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(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @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 elasticPoolName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().last().body(); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @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 elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, serverName, elasticPoolName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String serverName, String elasticPoolName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body(); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String serverName, String elasticPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName), serviceCallback); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName) { + 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, serverName, elasticPoolName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ElasticPoolInner object if successful. + */ + public ElasticPoolInner update(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().last().body(); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (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); + Observable> observable = service.update(resourceGroupName, serverName, elasticPoolName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ElasticPoolInner object if successful. + */ + public ElasticPoolInner beginUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body(); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { + @Override + public ElasticPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an elastic pool. + * + * @param resourceGroupName The 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 elasticPoolName The name of the elastic pool. + * @param parameters The elastic pool update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ElasticPoolInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate 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 (elasticPoolName == null) { + throw new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (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); + return service.beginUpdate(resourceGroupName, serverName, elasticPoolName, 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 = 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 all elastic pools in a 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<ElasticPoolInner> 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(); + } + }; + } + + /** + * Gets all elastic pools in a server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByServerNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all elastic pools in a 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<ElasticPoolInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all elastic pools in a 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<ElasticPoolInner> 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)); + } + }); + } + + /** + * Gets all elastic pools in a 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<ElasticPoolInner> 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_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/IdParsingUtils.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..f3a451c596501 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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_10_01_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupImpl.java new file mode 100644 index 0000000000000..33052179c6996 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupImpl.java @@ -0,0 +1,154 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroupReadWriteEndpoint; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroupReadOnlyEndpoint; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroupReplicationRole; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.PartnerRegionInfo; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstancePairInfo; + +class InstanceFailoverGroupImpl extends CreatableUpdatableImpl implements InstanceFailoverGroup, InstanceFailoverGroup.Definition, InstanceFailoverGroup.Update { + private final SqlManager manager; + private String resourceGroupName; + private String locationName; + private String failoverGroupName; + + InstanceFailoverGroupImpl(String name, SqlManager manager) { + super(name, new InstanceFailoverGroupInner()); + this.manager = manager; + // Set resource name + this.failoverGroupName = name; + // + } + + InstanceFailoverGroupImpl(InstanceFailoverGroupInner inner, SqlManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.failoverGroupName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.locationName = IdParsingUtils.getValueFromIdByName(inner.id(), "locations"); + this.failoverGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "instanceFailoverGroups"); + // + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + InstanceFailoverGroupsInner client = this.manager().inner().instanceFailoverGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.locationName, this.failoverGroupName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + InstanceFailoverGroupsInner client = this.manager().inner().instanceFailoverGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.locationName, this.failoverGroupName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + InstanceFailoverGroupsInner client = this.manager().inner().instanceFailoverGroups(); + return client.getAsync(this.resourceGroupName, this.locationName, this.failoverGroupName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List managedInstancePairs() { + return this.inner().managedInstancePairs(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List partnerRegions() { + return this.inner().partnerRegions(); + } + + @Override + public InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.inner().readOnlyEndpoint(); + } + + @Override + public InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.inner().readWriteEndpoint(); + } + + @Override + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.inner().replicationRole(); + } + + @Override + public String replicationState() { + return this.inner().replicationState(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public InstanceFailoverGroupImpl withExistingLocation(String resourceGroupName, String locationName) { + this.resourceGroupName = resourceGroupName; + this.locationName = locationName; + return this; + } + + @Override + public InstanceFailoverGroupImpl withManagedInstancePairs(List managedInstancePairs) { + this.inner().withManagedInstancePairs(managedInstancePairs); + return this; + } + + @Override + public InstanceFailoverGroupImpl withPartnerRegions(List partnerRegions) { + this.inner().withPartnerRegions(partnerRegions); + return this; + } + + @Override + public InstanceFailoverGroupImpl withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.inner().withReadWriteEndpoint(readWriteEndpoint); + return this; + } + + @Override + public InstanceFailoverGroupImpl withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.inner().withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupInner.java new file mode 100644 index 0000000000000..2d21fd0ea3782 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupInner.java @@ -0,0 +1,161 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroupReadWriteEndpoint; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroupReadOnlyEndpoint; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroupReplicationRole; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.PartnerRegionInfo; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstancePairInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An instance failover group. + */ +@JsonFlatten +public class InstanceFailoverGroupInner extends ProxyResource { + /** + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readWriteEndpoint", required = true) + private InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint; + + /** + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readOnlyEndpoint") + private InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /** + * Local replication role of the failover group instance. Possible values + * include: 'Primary', 'Secondary'. + */ + @JsonProperty(value = "properties.replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private InstanceFailoverGroupReplicationRole replicationRole; + + /** + * Replication state of the failover group instance. + */ + @JsonProperty(value = "properties.replicationState", access = JsonProperty.Access.WRITE_ONLY) + private String replicationState; + + /** + * Partner region information for the failover group. + */ + @JsonProperty(value = "properties.partnerRegions", required = true) + private List partnerRegions; + + /** + * List of managed instance pairs in the failover group. + */ + @JsonProperty(value = "properties.managedInstancePairs", required = true) + private List managedInstancePairs; + + /** + * Get read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value + */ + public InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set read-write endpoint of the failover group instance. + * + * @param readWriteEndpoint the readWriteEndpoint value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value + */ + public InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set read-only endpoint of the failover group instance. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get local replication role of the failover group instance. Possible values include: 'Primary', 'Secondary'. + * + * @return the replicationRole value + */ + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Get replication state of the failover group instance. + * + * @return the replicationState value + */ + public String replicationState() { + return this.replicationState; + } + + /** + * Get partner region information for the failover group. + * + * @return the partnerRegions value + */ + public List partnerRegions() { + return this.partnerRegions; + } + + /** + * Set partner region information for the failover group. + * + * @param partnerRegions the partnerRegions value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withPartnerRegions(List partnerRegions) { + this.partnerRegions = partnerRegions; + return this; + } + + /** + * Get list of managed instance pairs in the failover group. + * + * @return the managedInstancePairs value + */ + public List managedInstancePairs() { + return this.managedInstancePairs; + } + + /** + * Set list of managed instance pairs in the failover group. + * + * @param managedInstancePairs the managedInstancePairs value to set + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withManagedInstancePairs(List managedInstancePairs) { + this.managedInstancePairs = managedInstancePairs; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsImpl.java new file mode 100644 index 0000000000000..1cb58ee5e90f3 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsImpl.java @@ -0,0 +1,105 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroup; + +class InstanceFailoverGroupsImpl extends WrapperImpl implements InstanceFailoverGroups { + private final SqlManager manager; + + InstanceFailoverGroupsImpl(SqlManager manager) { + super(manager.inner().instanceFailoverGroups()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public InstanceFailoverGroupImpl define(String name) { + return wrapModel(name); + } + + private InstanceFailoverGroupImpl wrapModel(InstanceFailoverGroupInner inner) { + return new InstanceFailoverGroupImpl(inner, manager()); + } + + private InstanceFailoverGroupImpl wrapModel(String name) { + return new InstanceFailoverGroupImpl(name, this.manager()); + } + + @Override + public Observable failoverAsync(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.failoverAsync(resourceGroupName, locationName, failoverGroupName) + .map(new Func1() { + @Override + public InstanceFailoverGroup call(InstanceFailoverGroupInner inner) { + return new InstanceFailoverGroupImpl(inner, manager()); + } + }); + } + + @Override + public Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.forceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName) + .map(new Func1() { + @Override + public InstanceFailoverGroup call(InstanceFailoverGroupInner inner) { + return new InstanceFailoverGroupImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByLocationAsync(final String resourceGroupName, final String locationName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.listByLocationAsync(resourceGroupName, locationName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InstanceFailoverGroup call(InstanceFailoverGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.getAsync(resourceGroupName, locationName, failoverGroupName) + .map(new Func1() { + @Override + public InstanceFailoverGroup call(InstanceFailoverGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, locationName, failoverGroupName).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java new file mode 100644 index 0000000000000..ccc3f136d597f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java @@ -0,0 +1,1134 @@ +/** + * 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_10_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.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in InstanceFailoverGroups. + */ +public class InstanceFailoverGroupsInner { + /** The Retrofit service to perform REST calls. */ + private InstanceFailoverGroupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of InstanceFailoverGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public InstanceFailoverGroupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(InstanceFailoverGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for InstanceFailoverGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface InstanceFailoverGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body InstanceFailoverGroupInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body InstanceFailoverGroupInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups listByLocation" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups") + Observable> listByLocation(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups failover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/failover") + Observable> failover(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups beginFailover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/failover") + Observable> beginFailover(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups forceFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + Observable> forceFailoverAllowDataLoss(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups beginForceFailoverAllowDataLoss" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + Observable> beginForceFailoverAllowDataLoss(@Path("resourceGroupName") String resourceGroupName, @Path("locationName") String locationName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups listByLocationNext" }) + @GET + Observable> listByLocationNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner get(String resourceGroupName, String locationName, String failoverGroupName) { + return getWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable getAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return getWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, locationName, failoverGroupName, 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 failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner createOrUpdate(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, locationName, failoverGroupName, 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 failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner beginCreateOrUpdate(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param parameters The failover group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, locationName, failoverGroupName, 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(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String locationName, String failoverGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, locationName, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String locationName, String failoverGroupName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a failover group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, locationName, failoverGroupName, 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()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InstanceFailoverGroupInner> object if successful. + */ + public PagedList listByLocation(final String resourceGroupName, final String locationName) { + ServiceResponse> response = listByLocationSinglePageAsync(resourceGroupName, locationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByLocationAsync(final String resourceGroupName, final String locationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationSinglePageAsync(resourceGroupName, locationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstanceFailoverGroupInner> object + */ + public Observable> listByLocationAsync(final String resourceGroupName, final String locationName) { + return listByLocationWithServiceResponseAsync(resourceGroupName, locationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the failover groups in a location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstanceFailoverGroupInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String resourceGroupName, final String locationName) { + return listByLocationSinglePageAsync(resourceGroupName, locationName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the failover groups in a location. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstanceFailoverGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(final String resourceGroupName, final String locationName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByLocation(resourceGroupName, locationName, 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 = listByLocationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner failover(String resourceGroupName, String locationName, String failoverGroupName) { + return failoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture failoverAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return failoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.failover(resourceGroupName, locationName, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner beginFailover(String resourceGroupName, String locationName, String failoverGroupName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginFailoverAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable beginFailoverAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> beginFailoverWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginFailover(resourceGroupName, locationName, failoverGroupName, 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 = beginFailoverDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginFailoverDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner forceFailoverAllowDataLoss(String resourceGroupName, String locationName, String failoverGroupName) { + return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().last().body(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> forceFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstanceFailoverGroupInner object if successful. + */ + public InstanceFailoverGroupInner beginForceFailoverAllowDataLoss(String resourceGroupName, String locationName, String failoverGroupName) { + return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginForceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName), serviceCallback); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable beginForceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1, InstanceFailoverGroupInner>() { + @Override + public InstanceFailoverGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param locationName The name of the region where the resource is located. + * @param failoverGroupName The name of the failover group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstanceFailoverGroupInner object + */ + public Observable> beginForceFailoverAllowDataLossWithServiceResponseAsync(String resourceGroupName, String locationName, String failoverGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName is required and cannot be null."); + } + if (failoverGroupName == null) { + throw new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginForceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, 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 = beginForceFailoverAllowDataLossDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginForceFailoverAllowDataLossDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the failover groups in a location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InstanceFailoverGroupInner> object if successful. + */ + public PagedList listByLocationNext(final String nextPageLink) { + ServiceResponse> response = listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the failover groups in a location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByLocationNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the failover groups in a location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstanceFailoverGroupInner> object + */ + public Observable> listByLocationNextAsync(final String nextPageLink) { + return listByLocationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the failover groups in a location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstanceFailoverGroupInner> object + */ + public Observable>> listByLocationNextWithServiceResponseAsync(final String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the failover groups in a location. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstanceFailoverGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByLocationNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/LocationCapabilitiesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/LocationCapabilitiesImpl.java new file mode 100644 index 0000000000000..b79a07299369d --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/LocationCapabilitiesImpl.java @@ -0,0 +1,55 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.LocationCapabilities; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.CapabilityStatus; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceVersionCapability; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ServerVersionCapability; + +class LocationCapabilitiesImpl extends WrapperImpl implements LocationCapabilities { + private final SqlManager manager; + LocationCapabilitiesImpl(LocationCapabilitiesInner inner, SqlManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reason() { + return this.inner().reason(); + } + + @Override + public CapabilityStatus status() { + return this.inner().status(); + } + + @Override + public List supportedManagedInstanceVersions() { + return this.inner().supportedManagedInstanceVersions(); + } + + @Override + public List supportedServerVersions() { + return this.inner().supportedServerVersions(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/LocationCapabilitiesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/LocationCapabilitiesInner.java new file mode 100644 index 0000000000000..b92c8fea2312a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/LocationCapabilitiesInner.java @@ -0,0 +1,108 @@ +/** + * 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_10_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ServerVersionCapability; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceVersionCapability; +import com.microsoft.azure.management.sql.v2017_10_01_preview.CapabilityStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The location capability. + */ +public class LocationCapabilitiesInner { + /** + * The location name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The list of supported server versions. + */ + @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedServerVersions; + + /** + * The list of supported managed instance versions. + */ + @JsonProperty(value = "supportedManagedInstanceVersions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedManagedInstanceVersions; + + /** + * The status of the capability. Possible values include: 'Visible', + * 'Available', 'Default', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityStatus status; + + /** + * The reason for the capability not being available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the location name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the list of supported server versions. + * + * @return the supportedServerVersions value + */ + public List supportedServerVersions() { + return this.supportedServerVersions; + } + + /** + * Get the list of supported managed instance versions. + * + * @return the supportedManagedInstanceVersions value + */ + public List supportedManagedInstanceVersions() { + return this.supportedManagedInstanceVersions; + } + + /** + * Get the status of the capability. Possible values include: 'Visible', 'Available', 'Default', 'Disabled'. + * + * @return the status value + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason for the capability not being available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason for the capability not being available. + * + * @param reason the reason value to set + * @return the LocationCapabilitiesInner object itself. + */ + public LocationCapabilitiesInner withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesImpl.java new file mode 100644 index 0000000000000..3d9b36512d2c4 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesImpl.java @@ -0,0 +1,34 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceTdeCertificates; +import rx.Completable; + +class ManagedInstanceTdeCertificatesImpl extends WrapperImpl implements ManagedInstanceTdeCertificates { + private final SqlManager manager; + + ManagedInstanceTdeCertificatesImpl(SqlManager manager) { + super(manager.inner().managedInstanceTdeCertificates()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Completable createAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + ManagedInstanceTdeCertificatesInner client = this.inner(); + return client.createAsync(resourceGroupName, managedInstanceName, parameters).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesInner.java new file mode 100644 index 0000000000000..c2a8ab92c68fe --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceTdeCertificatesInner.java @@ -0,0 +1,236 @@ +/** + * 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_10_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedInstanceTdeCertificates. + */ +public class ManagedInstanceTdeCertificatesInner { + /** The Retrofit service to perform REST calls. */ + private ManagedInstanceTdeCertificatesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceTdeCertificatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedInstanceTdeCertificatesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ManagedInstanceTdeCertificatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedInstanceTdeCertificates to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedInstanceTdeCertificatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceTdeCertificates create" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body TdeCertificateInner 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_10_01_preview.ManagedInstanceTdeCertificates beginCreate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body TdeCertificateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates a TDE certificate 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @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 create(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + createWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); + } + + /** + * Creates a TDE certificate 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @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 createAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates a TDE certificate 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + return createWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a TDE certificate 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner 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); + Observable> observable = service.create(resourceGroupName, managedInstanceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a TDE certificate 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @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 beginCreate(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + beginCreateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); + } + + /** + * Creates a TDE certificate 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @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 beginCreateAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); + } + + /** + * Creates a TDE certificate 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginCreateAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner parameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a TDE certificate 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 managedInstanceName The name of the managed instance. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, TdeCertificateInner 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); + return service.beginCreate(resourceGroupName, managedInstanceName, 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 = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(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); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/PageImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..aaa1dee8d9040 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java new file mode 100644 index 0000000000000..b432eec9c06a4 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManagementClientImpl.java @@ -0,0 +1,322 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.v2017_10_01_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the SqlManagementClientImpl class. + */ +public class SqlManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription ID that identifies an Azure subscription. */ + private String subscriptionId; + + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public SqlManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the request. */ + private String apiVersion; + + /** + * Gets The API version to use for the request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SqlManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public SqlManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SqlManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The DatabaseOperationsInner object to access its operations. + */ + private DatabaseOperationsInner databaseOperations; + + /** + * Gets the DatabaseOperationsInner object to access its operations. + * @return the DatabaseOperationsInner object. + */ + public DatabaseOperationsInner databaseOperations() { + return this.databaseOperations; + } + + /** + * The ElasticPoolOperationsInner object to access its operations. + */ + private ElasticPoolOperationsInner elasticPoolOperations; + + /** + * Gets the ElasticPoolOperationsInner object to access its operations. + * @return the ElasticPoolOperationsInner object. + */ + public ElasticPoolOperationsInner elasticPoolOperations() { + return this.elasticPoolOperations; + } + + /** + * The DatabaseVulnerabilityAssessmentScansInner object to access its operations. + */ + private DatabaseVulnerabilityAssessmentScansInner databaseVulnerabilityAssessmentScans; + + /** + * Gets the DatabaseVulnerabilityAssessmentScansInner object to access its operations. + * @return the DatabaseVulnerabilityAssessmentScansInner object. + */ + public DatabaseVulnerabilityAssessmentScansInner databaseVulnerabilityAssessmentScans() { + return this.databaseVulnerabilityAssessmentScans; + } + + /** + * The CapabilitiesInner object to access its operations. + */ + private CapabilitiesInner capabilities; + + /** + * Gets the CapabilitiesInner object to access its operations. + * @return the CapabilitiesInner object. + */ + public CapabilitiesInner capabilities() { + return this.capabilities; + } + + /** + * The DatabasesInner object to access its operations. + */ + private DatabasesInner databases; + + /** + * Gets the DatabasesInner object to access its operations. + * @return the DatabasesInner object. + */ + public DatabasesInner databases() { + return this.databases; + } + + /** + * The ElasticPoolsInner object to access its operations. + */ + private ElasticPoolsInner elasticPools; + + /** + * Gets the ElasticPoolsInner object to access its operations. + * @return the ElasticPoolsInner object. + */ + public ElasticPoolsInner elasticPools() { + return this.elasticPools; + } + + /** + * The InstanceFailoverGroupsInner object to access its operations. + */ + private InstanceFailoverGroupsInner instanceFailoverGroups; + + /** + * Gets the InstanceFailoverGroupsInner object to access its operations. + * @return the InstanceFailoverGroupsInner object. + */ + public InstanceFailoverGroupsInner instanceFailoverGroups() { + return this.instanceFailoverGroups; + } + + /** + * The BackupShortTermRetentionPoliciesInner object to access its operations. + */ + private BackupShortTermRetentionPoliciesInner backupShortTermRetentionPolicies; + + /** + * Gets the BackupShortTermRetentionPoliciesInner object to access its operations. + * @return the BackupShortTermRetentionPoliciesInner object. + */ + public BackupShortTermRetentionPoliciesInner backupShortTermRetentionPolicies() { + return this.backupShortTermRetentionPolicies; + } + + /** + * The TdeCertificatesInner object to access its operations. + */ + private TdeCertificatesInner tdeCertificates; + + /** + * Gets the TdeCertificatesInner object to access its operations. + * @return the TdeCertificatesInner object. + */ + public TdeCertificatesInner tdeCertificates() { + return this.tdeCertificates; + } + + /** + * The ManagedInstanceTdeCertificatesInner object to access its operations. + */ + private ManagedInstanceTdeCertificatesInner managedInstanceTdeCertificates; + + /** + * Gets the ManagedInstanceTdeCertificatesInner object to access its operations. + * @return the ManagedInstanceTdeCertificatesInner object. + */ + public ManagedInstanceTdeCertificatesInner managedInstanceTdeCertificates() { + return this.managedInstanceTdeCertificates; + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SqlManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SqlManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-10-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.databaseOperations = new DatabaseOperationsInner(restClient().retrofit(), this); + this.elasticPoolOperations = new ElasticPoolOperationsInner(restClient().retrofit(), this); + this.databaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansInner(restClient().retrofit(), this); + this.capabilities = new CapabilitiesInner(restClient().retrofit(), this); + this.databases = new DatabasesInner(restClient().retrofit(), this); + this.elasticPools = new ElasticPoolsInner(restClient().retrofit(), this); + this.instanceFailoverGroups = new InstanceFailoverGroupsInner(restClient().retrofit(), this); + this.backupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesInner(restClient().retrofit(), this); + this.tdeCertificates = new TdeCertificatesInner(restClient().retrofit(), this); + this.managedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "SqlManagementClient", "2017-10-01-preview"); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java new file mode 100644 index 0000000000000..b0ae252b7525a --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/SqlManager.java @@ -0,0 +1,207 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseOperations; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPoolOperations; +import com.microsoft.azure.management.sql.v2017_10_01_preview.DatabaseVulnerabilityAssessmentScans; +import com.microsoft.azure.management.sql.v2017_10_01_preview.Capabilities; +import com.microsoft.azure.management.sql.v2017_10_01_preview.Databases; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ElasticPools; +import com.microsoft.azure.management.sql.v2017_10_01_preview.InstanceFailoverGroups; +import com.microsoft.azure.management.sql.v2017_10_01_preview.BackupShortTermRetentionPolicies; +import com.microsoft.azure.management.sql.v2017_10_01_preview.TdeCertificates; +import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceTdeCertificates; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Sql resource management. + */ +public final class SqlManager extends ManagerCore { + private DatabaseOperations databaseOperations; + private ElasticPoolOperations elasticPoolOperations; + private DatabaseVulnerabilityAssessmentScans databaseVulnerabilityAssessmentScans; + private Capabilities capabilities; + private Databases databases; + private ElasticPools elasticPools; + private InstanceFailoverGroups instanceFailoverGroups; + private BackupShortTermRetentionPolicies backupShortTermRetentionPolicies; + private TdeCertificates tdeCertificates; + private ManagedInstanceTdeCertificates managedInstanceTdeCertificates; + /** + * Get a Configurable instance that can be used to create SqlManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SqlManager.ConfigurableImpl(); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SqlManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of SqlManager that exposes Sql resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SqlManager + */ + public static SqlManager authenticate(RestClient restClient, String subscriptionId) { + return new SqlManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SqlManager that exposes Sql management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Sql management API entry points that work across subscriptions + */ + SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage DatabaseOperations. + */ + public DatabaseOperations databaseOperations() { + if (this.databaseOperations == null) { + this.databaseOperations = new DatabaseOperationsImpl(this); + } + return this.databaseOperations; + } + + /** + * @return Entry point to manage ElasticPoolOperations. + */ + public ElasticPoolOperations elasticPoolOperations() { + if (this.elasticPoolOperations == null) { + this.elasticPoolOperations = new ElasticPoolOperationsImpl(this); + } + return this.elasticPoolOperations; + } + + /** + * @return Entry point to manage DatabaseVulnerabilityAssessmentScans. + */ + public DatabaseVulnerabilityAssessmentScans databaseVulnerabilityAssessmentScans() { + if (this.databaseVulnerabilityAssessmentScans == null) { + this.databaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansImpl(this); + } + return this.databaseVulnerabilityAssessmentScans; + } + + /** + * @return Entry point to manage Capabilities. + */ + public Capabilities capabilities() { + if (this.capabilities == null) { + this.capabilities = new CapabilitiesImpl(this); + } + return this.capabilities; + } + + /** + * @return Entry point to manage Databases. + */ + public Databases databases() { + if (this.databases == null) { + this.databases = new DatabasesImpl(this); + } + return this.databases; + } + + /** + * @return Entry point to manage ElasticPools. + */ + public ElasticPools elasticPools() { + if (this.elasticPools == null) { + this.elasticPools = new ElasticPoolsImpl(this); + } + return this.elasticPools; + } + + /** + * @return Entry point to manage InstanceFailoverGroups. + */ + public InstanceFailoverGroups instanceFailoverGroups() { + if (this.instanceFailoverGroups == null) { + this.instanceFailoverGroups = new InstanceFailoverGroupsImpl(this); + } + return this.instanceFailoverGroups; + } + + /** + * @return Entry point to manage BackupShortTermRetentionPolicies. + */ + public BackupShortTermRetentionPolicies backupShortTermRetentionPolicies() { + if (this.backupShortTermRetentionPolicies == null) { + this.backupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesImpl(this); + } + return this.backupShortTermRetentionPolicies; + } + + /** + * @return Entry point to manage TdeCertificates. + */ + public TdeCertificates tdeCertificates() { + if (this.tdeCertificates == null) { + this.tdeCertificates = new TdeCertificatesImpl(this); + } + return this.tdeCertificates; + } + + /** + * @return Entry point to manage ManagedInstanceTdeCertificates. + */ + public ManagedInstanceTdeCertificates managedInstanceTdeCertificates() { + if (this.managedInstanceTdeCertificates == null) { + this.managedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesImpl(this); + } + return this.managedInstanceTdeCertificates; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SqlManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SqlManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SqlManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SqlManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificateInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificateInner.java new file mode 100644 index 0000000000000..e027ce9d00efc --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificateInner.java @@ -0,0 +1,72 @@ +/** + * 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_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A TDE certificate that can be uploaded into a server. + */ +@JsonFlatten +public class TdeCertificateInner extends ProxyResource { + /** + * The base64 encoded certificate private blob. + */ + @JsonProperty(value = "properties.privateBlob", required = true) + private String privateBlob; + + /** + * The certificate password. + */ + @JsonProperty(value = "properties.certPassword") + private String certPassword; + + /** + * Get the base64 encoded certificate private blob. + * + * @return the privateBlob value + */ + public String privateBlob() { + return this.privateBlob; + } + + /** + * Set the base64 encoded certificate private blob. + * + * @param privateBlob the privateBlob value to set + * @return the TdeCertificateInner object itself. + */ + public TdeCertificateInner withPrivateBlob(String privateBlob) { + this.privateBlob = privateBlob; + return this; + } + + /** + * Get the certificate password. + * + * @return the certPassword value + */ + public String certPassword() { + return this.certPassword; + } + + /** + * Set the certificate password. + * + * @param certPassword the certPassword value to set + * @return the TdeCertificateInner object itself. + */ + public TdeCertificateInner withCertPassword(String certPassword) { + this.certPassword = certPassword; + return this; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificatesImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificatesImpl.java new file mode 100644 index 0000000000000..533f1c3abc3f2 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificatesImpl.java @@ -0,0 +1,34 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.sql.v2017_10_01_preview.TdeCertificates; +import rx.Completable; + +class TdeCertificatesImpl extends WrapperImpl implements TdeCertificates { + private final SqlManager manager; + + TdeCertificatesImpl(SqlManager manager) { + super(manager.inner().tdeCertificates()); + this.manager = manager; + } + + public SqlManager manager() { + return this.manager; + } + + @Override + public Completable createAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + TdeCertificatesInner client = this.inner(); + return client.createAsync(resourceGroupName, serverName, parameters).toCompletable(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificatesInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificatesInner.java new file mode 100644 index 0000000000000..054350745555f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/TdeCertificatesInner.java @@ -0,0 +1,236 @@ +/** + * 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_10_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in TdeCertificates. + */ +public class TdeCertificatesInner { + /** The Retrofit service to perform REST calls. */ + private TdeCertificatesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of TdeCertificatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TdeCertificatesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(TdeCertificatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for TdeCertificates to be + * used by Retrofit to perform actually REST calls. + */ + interface TdeCertificatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.TdeCertificates create" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/tdeCertificates") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body TdeCertificateInner 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_10_01_preview.TdeCertificates beginCreate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/tdeCertificates") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body TdeCertificateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates a TDE certificate 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 serverName The name of the server. + * @param parameters The requested TDE certificate to be created or updated. + * @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 create(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + createWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Creates a TDE certificate 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 serverName The name of the server. + * @param parameters The requested TDE certificate to be created or updated. + * @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 createAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates a TDE certificate 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 serverName The name of the server. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + return createWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a TDE certificate 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 serverName The name of the server. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String serverName, TdeCertificateInner 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 (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); + Observable> observable = service.create(resourceGroupName, serverName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a TDE certificate 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 serverName The name of the server. + * @param parameters The requested TDE certificate to be created or updated. + * @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 beginCreate(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates a TDE certificate 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 serverName The name of the server. + * @param parameters The requested TDE certificate to be created or updated. + * @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 beginCreateAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates a TDE certificate 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 serverName The name of the server. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginCreateAsync(String resourceGroupName, String serverName, TdeCertificateInner parameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a TDE certificate 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 serverName The name of the server. + * @param parameters The requested TDE certificate to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String serverName, TdeCertificateInner 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 (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); + return service.beginCreate(resourceGroupName, serverName, 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 = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(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); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/VulnerabilityAssessmentScanRecordImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/VulnerabilityAssessmentScanRecordImpl.java new file mode 100644 index 0000000000000..fdeb3a2d3dea3 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/VulnerabilityAssessmentScanRecordImpl.java @@ -0,0 +1,104 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanRecord; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanError; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanState; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanTriggerType; + +class VulnerabilityAssessmentScanRecordImpl extends IndexableRefreshableWrapperImpl implements VulnerabilityAssessmentScanRecord { + private final SqlManager manager; + private String resourceGroupName; + private String serverName; + private String databaseName; + private String scanId; + + VulnerabilityAssessmentScanRecordImpl(VulnerabilityAssessmentScanRecordInner inner, SqlManager manager) { + super(null, inner); + this.manager = manager; + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serverName = IdParsingUtils.getValueFromIdByName(inner.id(), "servers"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.scanId = IdParsingUtils.getValueFromIdByName(inner.id(), "scans"); + } + + @Override + public SqlManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + DatabaseVulnerabilityAssessmentScansInner client = this.manager().inner().databaseVulnerabilityAssessmentScans(); + return client.getAsync(this.resourceGroupName, this.serverName, this.databaseName, this.scanId); + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List errors() { + return this.inner().errors(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer numberOfFailedSecurityChecks() { + return this.inner().numberOfFailedSecurityChecks(); + } + + @Override + public String scanId() { + return this.inner().scanId(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public VulnerabilityAssessmentScanState state() { + return this.inner().state(); + } + + @Override + public String storageContainerPath() { + return this.inner().storageContainerPath(); + } + + @Override + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.inner().triggerType(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/VulnerabilityAssessmentScanRecordInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/VulnerabilityAssessmentScanRecordInner.java new file mode 100644 index 0000000000000..a5e6ea17fed97 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/VulnerabilityAssessmentScanRecordInner.java @@ -0,0 +1,146 @@ +/** + * 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_10_01_preview.implementation; + +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanTriggerType; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanState; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.v2017_10_01_preview.VulnerabilityAssessmentScanError; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A vulnerability assessment scan record. + */ +@JsonFlatten +public class VulnerabilityAssessmentScanRecordInner extends ProxyResource { + /** + * The scan ID. + */ + @JsonProperty(value = "properties.scanId", access = JsonProperty.Access.WRITE_ONLY) + private String scanId; + + /** + * The scan trigger type. Possible values include: 'OnDemand', 'Recurring'. + */ + @JsonProperty(value = "properties.triggerType", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanTriggerType triggerType; + + /** + * The scan status. Possible values include: 'Passed', 'Failed', + * 'FailedToRun', 'InProgress'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanState state; + + /** + * The scan start time (UTC). + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The scan end time (UTC). + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The scan errors. + */ + @JsonProperty(value = "properties.errors", access = JsonProperty.Access.WRITE_ONLY) + private List errors; + + /** + * The scan results storage container path. + */ + @JsonProperty(value = "properties.storageContainerPath", access = JsonProperty.Access.WRITE_ONLY) + private String storageContainerPath; + + /** + * The number of failed security checks. + */ + @JsonProperty(value = "properties.numberOfFailedSecurityChecks", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfFailedSecurityChecks; + + /** + * Get the scan ID. + * + * @return the scanId value + */ + public String scanId() { + return this.scanId; + } + + /** + * Get the scan trigger type. Possible values include: 'OnDemand', 'Recurring'. + * + * @return the triggerType value + */ + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.triggerType; + } + + /** + * Get the scan status. Possible values include: 'Passed', 'Failed', 'FailedToRun', 'InProgress'. + * + * @return the state value + */ + public VulnerabilityAssessmentScanState state() { + return this.state; + } + + /** + * Get the scan start time (UTC). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the scan end time (UTC). + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the scan errors. + * + * @return the errors value + */ + public List errors() { + return this.errors; + } + + /** + * Get the scan results storage container path. + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Get the number of failed security checks. + * + * @return the numberOfFailedSecurityChecks value + */ + public Integer numberOfFailedSecurityChecks() { + return this.numberOfFailedSecurityChecks; + } + +} diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/package-info.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/package-info.java new file mode 100644 index 0000000000000..e71fc9e7ca0a4 --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v2017_10_01_preview.implementation; diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/package-info.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/package-info.java new file mode 100644 index 0000000000000..113915f242e8f --- /dev/null +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for SqlManagementClient. + * The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. + */ +package com.microsoft.azure.management.sql.v2017_10_01_preview;