From 95a467e2015a8f524cfbac11d1e5693b89be130e Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 20 Mar 2018 09:21:36 -0700 Subject: [PATCH 1/2] Generated from 181e5c844e7d19a3138cc3635d0085a1ac3174bd (#346) Fix swagger->sdk tag for go --- .../management/mysql/GeoRedundantBackup.java | 41 + .../azure/management/mysql/Operation.java | 80 ++ .../management/mysql/OperationDisplay.java | 77 ++ .../management/mysql/OperationOrigin.java | 44 + ...PerformanceTierServiceLevelObjectives.java | 225 +++++ .../azure/management/mysql/ProxyResource.java | 62 ++ .../mysql/ServerPropertiesForCreate.java | 105 +++ .../ServerPropertiesForDefaultCreate.java | 74 ++ .../mysql/ServerPropertiesForRestore.java | 75 ++ .../azure/management/mysql/ServerState.java | 44 + .../azure/management/mysql/ServerVersion.java | 41 + .../microsoft/azure/management/mysql/Sku.java | 149 +++ .../azure/management/mysql/SkuTier.java | 44 + .../management/mysql/SslEnforcementEnum.java | 53 ++ .../management/mysql/StorageProfile.java | 96 ++ .../management/mysql/TrackedResource.java | 70 ++ .../CheckNameAvailabilitysInner.java | 142 +++ .../implementation/ConfigurationInner.java | 132 +++ .../implementation/ConfigurationsInner.java | 442 +++++++++ .../mysql/implementation/DatabaseInner.java | 72 ++ .../mysql/implementation/DatabasesInner.java | 621 +++++++++++++ .../implementation/FirewallRuleInner.java | 72 ++ .../implementation/FirewallRulesInner.java | 621 +++++++++++++ .../LocationBasedPerformanceTiersInner.java | 141 +++ .../mysql/implementation/LogFileInner.java | 129 +++ .../mysql/implementation/LogFilesInner.java | 148 +++ .../MySQLManagementClientImpl.java | 294 ++++++ .../implementation/NameAvailabilityInner.java | 95 ++ .../NameAvailabilityRequestInner.java | 69 ++ .../OperationListResultInner.java | 45 + .../mysql/implementation/OperationsInner.java | 128 +++ .../mysql/implementation/PageImpl.java | 75 ++ .../PerformanceTierPropertiesInner.java | 71 ++ .../implementation/ServerForCreateInner.java | 124 +++ .../mysql/implementation/ServerInner.java | 237 +++++ .../ServerUpdateParametersInner.java | 181 ++++ .../mysql/implementation/ServersInner.java | 850 ++++++++++++++++++ .../mysql/implementation/package-info.java | 11 + .../azure/management/mysql/package-info.java | 11 + 39 files changed, 5991 insertions(+) create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/GeoRedundantBackup.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/Operation.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/OperationDisplay.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/OperationOrigin.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/PerformanceTierServiceLevelObjectives.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ProxyResource.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForCreate.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForDefaultCreate.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForRestore.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerState.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerVersion.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/Sku.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/SkuTier.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/SslEnforcementEnum.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/StorageProfile.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/TrackedResource.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/CheckNameAvailabilitysInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationsInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabaseInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabasesInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRuleInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRulesInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LocationBasedPerformanceTiersInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFileInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFilesInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/MySQLManagementClientImpl.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/NameAvailabilityInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/NameAvailabilityRequestInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationListResultInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationsInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PageImpl.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PerformanceTierPropertiesInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerForCreateInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerUpdateParametersInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServersInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/package-info.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/package-info.java diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/GeoRedundantBackup.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/GeoRedundantBackup.java new file mode 100644 index 00000000000..c6c1daf5325 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/GeoRedundantBackup.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.mysql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for GeoRedundantBackup. + */ +public final class GeoRedundantBackup extends ExpandableStringEnum { + /** Static value Enabled for GeoRedundantBackup. */ + public static final GeoRedundantBackup ENABLED = fromString("Enabled"); + + /** Static value Disabled for GeoRedundantBackup. */ + public static final GeoRedundantBackup DISABLED = fromString("Disabled"); + + /** + * Creates or finds a GeoRedundantBackup from its string representation. + * @param name a name to look for + * @return the corresponding GeoRedundantBackup + */ + @JsonCreator + public static GeoRedundantBackup fromString(String name) { + return fromString(name, GeoRedundantBackup.class); + } + + /** + * @return known GeoRedundantBackup values + */ + public static Collection values() { + return values(GeoRedundantBackup.class); + } +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/Operation.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/Operation.java new file mode 100644 index 00000000000..f2d3dbb935d --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/Operation.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.mysql; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API operation definition. + */ +public class Operation { + /** + * The name of the operation being performed on this particular object. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The localized display information for this particular operation or + * action. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /** + * The intended executor of the operation. Possible values include: + * 'NotSpecified', 'user', 'system'. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private OperationOrigin origin; + + /** + * Additional descriptions for the operation. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private Map properties; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the display value. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin value. + * + * @return the origin value + */ + public OperationOrigin origin() { + return this.origin; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public Map properties() { + return this.properties; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/OperationDisplay.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/OperationDisplay.java new file mode 100644 index 00000000000..6dbc41d1bdf --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/OperationDisplay.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.mysql; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Display metadata associated with the operation. + */ +public class OperationDisplay { + /** + * Operation resource provider name. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Localized friendly name for the operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Operation description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the provider value. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource value. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation value. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/OperationOrigin.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/OperationOrigin.java new file mode 100644 index 00000000000..b4c782a1622 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/OperationOrigin.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.mysql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for OperationOrigin. + */ +public final class OperationOrigin extends ExpandableStringEnum { + /** Static value NotSpecified for OperationOrigin. */ + public static final OperationOrigin NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value user for OperationOrigin. */ + public static final OperationOrigin USER = fromString("user"); + + /** Static value system for OperationOrigin. */ + public static final OperationOrigin SYSTEM = fromString("system"); + + /** + * Creates or finds a OperationOrigin from its string representation. + * @param name a name to look for + * @return the corresponding OperationOrigin + */ + @JsonCreator + public static OperationOrigin fromString(String name) { + return fromString(name, OperationOrigin.class); + } + + /** + * @return known OperationOrigin values + */ + public static Collection values() { + return values(OperationOrigin.class); + } +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/PerformanceTierServiceLevelObjectives.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/PerformanceTierServiceLevelObjectives.java new file mode 100644 index 00000000000..d9c635fdc37 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/PerformanceTierServiceLevelObjectives.java @@ -0,0 +1,225 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Service level objectives for performance tier. + */ +public class PerformanceTierServiceLevelObjectives { + /** + * ID for the service level objective. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Edition of the performance tier. + */ + @JsonProperty(value = "edition") + private String edition; + + /** + * vCore associated with the service level objective. + */ + @JsonProperty(value = "vCore") + private Integer vCore; + + /** + * Hardware generation associated with the service level objective. + */ + @JsonProperty(value = "hardwareGeneration") + private String hardwareGeneration; + + /** + * Maximum Backup retention in days for the performance tier edition. + */ + @JsonProperty(value = "maxBackupRetentionDays") + private Integer maxBackupRetentionDays; + + /** + * Minimum Backup retention in days for the performance tier edition. + */ + @JsonProperty(value = "minBackupRetentionDays") + private Integer minBackupRetentionDays; + + /** + * Max storage allowed for a server. + */ + @JsonProperty(value = "maxStorageMB") + private Integer maxStorageMB; + + /** + * Max storage allowed for a server. + */ + @JsonProperty(value = "minStorageMB") + private Integer minStorageMB; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withId(String id) { + this.id = id; + return this; + } + + /** + * Get the edition value. + * + * @return the edition value + */ + public String edition() { + return this.edition; + } + + /** + * Set the edition value. + * + * @param edition the edition value to set + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withEdition(String edition) { + this.edition = edition; + return this; + } + + /** + * Get the vCore value. + * + * @return the vCore value + */ + public Integer vCore() { + return this.vCore; + } + + /** + * Set the vCore value. + * + * @param vCore the vCore value to set + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withVCore(Integer vCore) { + this.vCore = vCore; + return this; + } + + /** + * Get the hardwareGeneration value. + * + * @return the hardwareGeneration value + */ + public String hardwareGeneration() { + return this.hardwareGeneration; + } + + /** + * Set the hardwareGeneration value. + * + * @param hardwareGeneration the hardwareGeneration value to set + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withHardwareGeneration(String hardwareGeneration) { + this.hardwareGeneration = hardwareGeneration; + return this; + } + + /** + * Get the maxBackupRetentionDays value. + * + * @return the maxBackupRetentionDays value + */ + public Integer maxBackupRetentionDays() { + return this.maxBackupRetentionDays; + } + + /** + * Set the maxBackupRetentionDays value. + * + * @param maxBackupRetentionDays the maxBackupRetentionDays value to set + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMaxBackupRetentionDays(Integer maxBackupRetentionDays) { + this.maxBackupRetentionDays = maxBackupRetentionDays; + return this; + } + + /** + * Get the minBackupRetentionDays value. + * + * @return the minBackupRetentionDays value + */ + public Integer minBackupRetentionDays() { + return this.minBackupRetentionDays; + } + + /** + * Set the minBackupRetentionDays value. + * + * @param minBackupRetentionDays the minBackupRetentionDays value to set + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMinBackupRetentionDays(Integer minBackupRetentionDays) { + this.minBackupRetentionDays = minBackupRetentionDays; + return this; + } + + /** + * Get the maxStorageMB value. + * + * @return the maxStorageMB value + */ + public Integer maxStorageMB() { + return this.maxStorageMB; + } + + /** + * Set the maxStorageMB value. + * + * @param maxStorageMB the maxStorageMB value to set + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMaxStorageMB(Integer maxStorageMB) { + this.maxStorageMB = maxStorageMB; + return this; + } + + /** + * Get the minStorageMB value. + * + * @return the minStorageMB value + */ + public Integer minStorageMB() { + return this.minStorageMB; + } + + /** + * Set the minStorageMB value. + * + * @param minStorageMB the minStorageMB value to set + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMinStorageMB(Integer minStorageMB) { + this.minStorageMB = minStorageMB; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ProxyResource.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ProxyResource.java new file mode 100644 index 00000000000..7b203c26a76 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ProxyResource.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.mysql; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource properties. + */ +public class ProxyResource { + /** + * Resource ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForCreate.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForCreate.java new file mode 100644 index 00000000000..ee20cc7da3b --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForCreate.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.mysql; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The properties used to create a new server. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("ServerPropertiesForCreate") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Default", value = ServerPropertiesForDefaultCreate.class), + @JsonSubTypes.Type(name = "PointInTimeRestore", value = ServerPropertiesForRestore.class) +}) +public class ServerPropertiesForCreate { + /** + * Server version. Possible values include: '5.6', '5.7'. + */ + @JsonProperty(value = "version") + private ServerVersion version; + + /** + * Enable ssl enforcement or not when connect to server. Possible values + * include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "sslEnforcement") + private SslEnforcementEnum sslEnforcement; + + /** + * Storage profile of a server. + */ + @JsonProperty(value = "storageProfile") + private StorageProfile storageProfile; + + /** + * Get the version value. + * + * @return the version value + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version value. + * + * @param version the version value to set + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withVersion(ServerVersion version) { + this.version = version; + return this; + } + + /** + * Get the sslEnforcement value. + * + * @return the sslEnforcement value + */ + public SslEnforcementEnum sslEnforcement() { + return this.sslEnforcement; + } + + /** + * Set the sslEnforcement value. + * + * @param sslEnforcement the sslEnforcement value to set + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.sslEnforcement = sslEnforcement; + return this; + } + + /** + * Get the storageProfile value. + * + * @return the storageProfile value + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile value. + * + * @param storageProfile the storageProfile value to set + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForDefaultCreate.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForDefaultCreate.java new file mode 100644 index 00000000000..cf1b75fb122 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForDefaultCreate.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.mysql; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The properties used to create a new server. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("Default") +public class ServerPropertiesForDefaultCreate extends ServerPropertiesForCreate { + /** + * The administrator's login name of a server. Can only be specified when + * the server is being created (and is required for creation). + */ + @JsonProperty(value = "administratorLogin", required = true) + private String administratorLogin; + + /** + * The password of the administrator login. + */ + @JsonProperty(value = "administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /** + * Get the administratorLogin value. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin value. + * + * @param administratorLogin the administratorLogin value to set + * @return the ServerPropertiesForDefaultCreate object itself. + */ + public ServerPropertiesForDefaultCreate withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword value. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword value. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ServerPropertiesForDefaultCreate object itself. + */ + public ServerPropertiesForDefaultCreate withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForRestore.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForRestore.java new file mode 100644 index 00000000000..c30e7aadf46 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForRestore.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.mysql; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The properties to a new server by restoring from a backup. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("PointInTimeRestore") +public class ServerPropertiesForRestore extends ServerPropertiesForCreate { + /** + * The source server id to restore from. + */ + @JsonProperty(value = "sourceServerId", required = true) + private String sourceServerId; + + /** + * Restore point creation time (ISO8601 format), specifying the time to + * restore from. + */ + @JsonProperty(value = "restorePointInTime", required = true) + private DateTime restorePointInTime; + + /** + * Get the sourceServerId value. + * + * @return the sourceServerId value + */ + public String sourceServerId() { + return this.sourceServerId; + } + + /** + * Set the sourceServerId value. + * + * @param sourceServerId the sourceServerId value to set + * @return the ServerPropertiesForRestore object itself. + */ + public ServerPropertiesForRestore withSourceServerId(String sourceServerId) { + this.sourceServerId = sourceServerId; + return this; + } + + /** + * Get the restorePointInTime value. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime value. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the ServerPropertiesForRestore object itself. + */ + public ServerPropertiesForRestore withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerState.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerState.java new file mode 100644 index 00000000000..d1509748570 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerState.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.mysql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ServerState. + */ +public final class ServerState extends ExpandableStringEnum { + /** Static value Ready for ServerState. */ + public static final ServerState READY = fromString("Ready"); + + /** Static value Dropping for ServerState. */ + public static final ServerState DROPPING = fromString("Dropping"); + + /** Static value Disabled for ServerState. */ + public static final ServerState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a ServerState from its string representation. + * @param name a name to look for + * @return the corresponding ServerState + */ + @JsonCreator + public static ServerState fromString(String name) { + return fromString(name, ServerState.class); + } + + /** + * @return known ServerState values + */ + public static Collection values() { + return values(ServerState.class); + } +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerVersion.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerVersion.java new file mode 100644 index 00000000000..175a850b463 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerVersion.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.mysql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ServerVersion. + */ +public final class ServerVersion extends ExpandableStringEnum { + /** Static value 5.6 for ServerVersion. */ + public static final ServerVersion FIVE_FULL_STOP_SIX = fromString("5.6"); + + /** Static value 5.7 for ServerVersion. */ + public static final ServerVersion FIVE_FULL_STOP_SEVEN = fromString("5.7"); + + /** + * Creates or finds a ServerVersion from its string representation. + * @param name a name to look for + * @return the corresponding ServerVersion + */ + @JsonCreator + public static ServerVersion fromString(String name) { + return fromString(name, ServerVersion.class); + } + + /** + * @return known ServerVersion values + */ + public static Collection values() { + return values(ServerVersion.class); + } +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/Sku.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/Sku.java new file mode 100644 index 00000000000..753d9875ee6 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/Sku.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Billing information related properties of a server. + */ +public class Sku { + /** + * The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, + * GP_Gen5_8. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The tier of the particular SKU, e.g. Basic. Possible values include: + * 'Basic', 'GeneralPurpose', 'MemoryOptimized'. + */ + @JsonProperty(value = "tier") + private SkuTier tier; + + /** + * The scale up/out capacity, representing server's compute units. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * The size code, to be interpreted by resource as appropriate. + */ + @JsonProperty(value = "size") + private String size; + + /** + * The family of hardware. + */ + @JsonProperty(value = "family") + private String family; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier value. + * + * @return the tier value + */ + public SkuTier tier() { + return this.tier; + } + + /** + * Set the tier value. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(SkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Get the capacity value. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity value. + * + * @param capacity the capacity value to set + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the size value. + * + * @return the size value + */ + public String size() { + return this.size; + } + + /** + * Set the size value. + * + * @param size the size value to set + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the family value. + * + * @return the family value + */ + public String family() { + return this.family; + } + + /** + * Set the family value. + * + * @param family the family value to set + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/SkuTier.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/SkuTier.java new file mode 100644 index 00000000000..07218ac2468 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/SkuTier.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.mysql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SkuTier. + */ +public final class SkuTier extends ExpandableStringEnum { + /** Static value Basic for SkuTier. */ + public static final SkuTier BASIC = fromString("Basic"); + + /** Static value GeneralPurpose for SkuTier. */ + public static final SkuTier GENERAL_PURPOSE = fromString("GeneralPurpose"); + + /** Static value MemoryOptimized for SkuTier. */ + public static final SkuTier MEMORY_OPTIMIZED = fromString("MemoryOptimized"); + + /** + * Creates or finds a SkuTier from its string representation. + * @param name a name to look for + * @return the corresponding SkuTier + */ + @JsonCreator + public static SkuTier fromString(String name) { + return fromString(name, SkuTier.class); + } + + /** + * @return known SkuTier values + */ + public static Collection values() { + return values(SkuTier.class); + } +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/SslEnforcementEnum.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/SslEnforcementEnum.java new file mode 100644 index 00000000000..7a748196228 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/SslEnforcementEnum.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.mysql; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SslEnforcementEnum. + */ +public enum SslEnforcementEnum { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SslEnforcementEnum instance. */ + private String value; + + SslEnforcementEnum(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SslEnforcementEnum instance. + * + * @param value the serialized value to parse. + * @return the parsed SslEnforcementEnum object, or null if unable to parse. + */ + @JsonCreator + public static SslEnforcementEnum fromString(String value) { + SslEnforcementEnum[] items = SslEnforcementEnum.values(); + for (SslEnforcementEnum item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/StorageProfile.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/StorageProfile.java new file mode 100644 index 00000000000..8a7a1688cb1 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/StorageProfile.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Storage Profile properties of a server. + */ +public class StorageProfile { + /** + * Backup retention days for the server. + */ + @JsonProperty(value = "backupRetentionDays") + private Integer backupRetentionDays; + + /** + * Enable Geo-redundant or not for server backup. Possible values include: + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "geoRedundantBackup") + private GeoRedundantBackup geoRedundantBackup; + + /** + * Max storage allowed for a server. + */ + @JsonProperty(value = "storageMB") + private Integer storageMB; + + /** + * Get the backupRetentionDays value. + * + * @return the backupRetentionDays value + */ + public Integer backupRetentionDays() { + return this.backupRetentionDays; + } + + /** + * Set the backupRetentionDays value. + * + * @param backupRetentionDays the backupRetentionDays value to set + * @return the StorageProfile object itself. + */ + public StorageProfile withBackupRetentionDays(Integer backupRetentionDays) { + this.backupRetentionDays = backupRetentionDays; + return this; + } + + /** + * Get the geoRedundantBackup value. + * + * @return the geoRedundantBackup value + */ + public GeoRedundantBackup geoRedundantBackup() { + return this.geoRedundantBackup; + } + + /** + * Set the geoRedundantBackup value. + * + * @param geoRedundantBackup the geoRedundantBackup value to set + * @return the StorageProfile object itself. + */ + public StorageProfile withGeoRedundantBackup(GeoRedundantBackup geoRedundantBackup) { + this.geoRedundantBackup = geoRedundantBackup; + return this; + } + + /** + * Get the storageMB value. + * + * @return the storageMB value + */ + public Integer storageMB() { + return this.storageMB; + } + + /** + * Set the storageMB value. + * + * @param storageMB the storageMB value to set + * @return the StorageProfile object itself. + */ + public StorageProfile withStorageMB(Integer storageMB) { + this.storageMB = storageMB; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/TrackedResource.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/TrackedResource.java new file mode 100644 index 00000000000..90effffe583 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/TrackedResource.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource properties including location and tags for track resources. + */ +public class TrackedResource extends ProxyResource { + /** + * The location the resource resides in. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Application-specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the TrackedResource object itself. + */ + public TrackedResource withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the TrackedResource object itself. + */ + public TrackedResource withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/CheckNameAvailabilitysInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/CheckNameAvailabilitysInner.java new file mode 100644 index 00000000000..922cb25607f --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/CheckNameAvailabilitysInner.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.mysql.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 CheckNameAvailabilitys. + */ +public class CheckNameAvailabilitysInner { + /** The Retrofit service to perform REST calls. */ + private CheckNameAvailabilitysService service; + /** The service client containing this operation class. */ + private MySQLManagementClientImpl client; + + /** + * Initializes an instance of CheckNameAvailabilitysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CheckNameAvailabilitysInner(Retrofit retrofit, MySQLManagementClientImpl client) { + this.service = retrofit.create(CheckNameAvailabilitysService.class); + this.client = client; + } + + /** + * The interface defining all the services for CheckNameAvailabilitys to be + * used by Retrofit to perform actually REST calls. + */ + interface CheckNameAvailabilitysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.mysql.CheckNameAvailabilitys execute" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability") + Observable> execute(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body NameAvailabilityRequestInner nameAvailabilityRequest, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @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 NameAvailabilityInner object if successful. + */ + public NameAvailabilityInner execute(NameAvailabilityRequestInner nameAvailabilityRequest) { + return executeWithServiceResponseAsync(nameAvailabilityRequest).toBlocking().single().body(); + } + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @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 executeAsync(NameAvailabilityRequestInner nameAvailabilityRequest, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(executeWithServiceResponseAsync(nameAvailabilityRequest), serviceCallback); + } + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NameAvailabilityInner object + */ + public Observable executeAsync(NameAvailabilityRequestInner nameAvailabilityRequest) { + return executeWithServiceResponseAsync(nameAvailabilityRequest).map(new Func1, NameAvailabilityInner>() { + @Override + public NameAvailabilityInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NameAvailabilityInner object + */ + public Observable> executeWithServiceResponseAsync(NameAvailabilityRequestInner nameAvailabilityRequest) { + 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 (nameAvailabilityRequest == null) { + throw new IllegalArgumentException("Parameter nameAvailabilityRequest is required and cannot be null."); + } + Validator.validate(nameAvailabilityRequest); + return service.execute(this.client.subscriptionId(), this.client.apiVersion(), nameAvailabilityRequest, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = executeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse executeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationInner.java new file mode 100644 index 00000000000..541e605c6aa --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationInner.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.mysql.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.mysql.ProxyResource; + +/** + * Represents a Configuration. + */ +@JsonFlatten +public class ConfigurationInner extends ProxyResource { + /** + * Value of the configuration. + */ + @JsonProperty(value = "properties.value") + private String value; + + /** + * Description of the configuration. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Default value of the configuration. + */ + @JsonProperty(value = "properties.defaultValue", access = JsonProperty.Access.WRITE_ONLY) + private String defaultValue; + + /** + * Data type of the configuration. + */ + @JsonProperty(value = "properties.dataType", access = JsonProperty.Access.WRITE_ONLY) + private String dataType; + + /** + * Allowed values of the configuration. + */ + @JsonProperty(value = "properties.allowedValues", access = JsonProperty.Access.WRITE_ONLY) + private String allowedValues; + + /** + * Source of the configuration. + */ + @JsonProperty(value = "properties.source") + private String source; + + /** + * Get the value value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the ConfigurationInner object itself. + */ + public ConfigurationInner withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get the defaultValue value. + * + * @return the defaultValue value + */ + public String defaultValue() { + return this.defaultValue; + } + + /** + * Get the dataType value. + * + * @return the dataType value + */ + public String dataType() { + return this.dataType; + } + + /** + * Get the allowedValues value. + * + * @return the allowedValues value + */ + public String allowedValues() { + return this.allowedValues; + } + + /** + * Get the source value. + * + * @return the source value + */ + public String source() { + return this.source; + } + + /** + * Set the source value. + * + * @param source the source value to set + * @return the ConfigurationInner object itself. + */ + public ConfigurationInner withSource(String source) { + this.source = source; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationsInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationsInner.java new file mode 100644 index 00000000000..c2dafd51ada --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationsInner.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.mysql.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.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 Configurations. + */ +public class ConfigurationsInner { + /** The Retrofit service to perform REST calls. */ + private ConfigurationsService service; + /** The service client containing this operation class. */ + private MySQLManagementClientImpl client; + + /** + * Initializes an instance of ConfigurationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ConfigurationsInner(Retrofit retrofit, MySQLManagementClientImpl client) { + this.service = retrofit.create(ConfigurationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Configurations to be + * used by Retrofit to perform actually REST calls. + */ + interface ConfigurationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.mysql.Configurations createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations/{configurationName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("configurationName") String configurationName, @Query("api-version") String apiVersion, @Body ConfigurationInner 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.mysql.Configurations beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations/{configurationName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("configurationName") String configurationName, @Query("api-version") String apiVersion, @Body ConfigurationInner 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.mysql.Configurations get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations/{configurationName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("configurationName") String configurationName, @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.mysql.Configurations listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/configurations") + 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); + + } + + /** + * Updates a configuration of 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 configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @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 ConfigurationInner object if successful. + */ + public ConfigurationInner createOrUpdate(String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, configurationName, parameters).toBlocking().last().body(); + } + + /** + * Updates a configuration of 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 configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @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 configurationName, ConfigurationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, configurationName, parameters), serviceCallback); + } + + /** + * Updates a configuration of 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 configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, configurationName, parameters).map(new Func1, ConfigurationInner>() { + @Override + public ConfigurationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a configuration of 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 configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String configurationName, ConfigurationInner 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 (configurationName == null) { + throw new IllegalArgumentException("Parameter configurationName 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, configurationName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a configuration of 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 configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @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 ConfigurationInner object if successful. + */ + public ConfigurationInner beginCreateOrUpdate(String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, configurationName, parameters).toBlocking().single().body(); + } + + /** + * Updates a configuration of 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 configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @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 configurationName, ConfigurationInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, configurationName, parameters), serviceCallback); + } + + /** + * Updates a configuration of 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 configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, configurationName, parameters).map(new Func1, ConfigurationInner>() { + @Override + public ConfigurationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a configuration of 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 configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String configurationName, ConfigurationInner 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 (configurationName == null) { + throw new IllegalArgumentException("Parameter configurationName 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, configurationName, 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(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets information about a configuration of 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 configurationName The name of the server configuration. + * @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 ConfigurationInner object if successful. + */ + public ConfigurationInner get(String resourceGroupName, String serverName, String configurationName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, configurationName).toBlocking().single().body(); + } + + /** + * Gets information about a configuration of 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 configurationName The name of the server configuration. + * @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 configurationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, configurationName), serviceCallback); + } + + /** + * Gets information about a configuration of 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 configurationName The name of the server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String configurationName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, configurationName).map(new Func1, ConfigurationInner>() { + @Override + public ConfigurationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets information about a configuration of 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 configurationName The name of the server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ConfigurationInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String configurationName) { + 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 (configurationName == null) { + throw new IllegalArgumentException("Parameter configurationName 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, configurationName, 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); + } + + /** + * List all the configurations in 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. + * @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<ConfigurationInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * List all the configurations in 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 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); + } + + /** + * List all the configurations in 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ConfigurationInner> 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(); + } + }); + } + + /** + * List all the configurations in 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ConfigurationInner> 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); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().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/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabaseInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabaseInner.java new file mode 100644 index 00000000000..2bfdc1dbd2d --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabaseInner.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.mysql.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.mysql.ProxyResource; + +/** + * Represents a Database. + */ +@JsonFlatten +public class DatabaseInner extends ProxyResource { + /** + * The charset of the database. + */ + @JsonProperty(value = "properties.charset") + private String charset; + + /** + * The collation of the database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * Get the charset value. + * + * @return the charset value + */ + public String charset() { + return this.charset; + } + + /** + * Set the charset value. + * + * @param charset the charset value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCharset(String charset) { + this.charset = charset; + return this; + } + + /** + * Get the collation value. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation value. + * + * @param collation the collation value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCollation(String collation) { + this.collation = collation; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabasesInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabasesInner.java new file mode 100644 index 00000000000..d7ba345f587 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabasesInner.java @@ -0,0 +1,621 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql.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 Databases. + */ +public class DatabasesInner { + /** The Retrofit service to perform REST calls. */ + private DatabasesService service; + /** The service client containing this operation class. */ + private MySQLManagementClientImpl 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, MySQLManagementClientImpl 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.mysql.Databases createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/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.mysql.Databases beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/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.mysql.Databases delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/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.mysql.Databases beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.mysql.Databases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/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, @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.mysql.Databases listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/databases") + 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 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 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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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. + * @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); + } + + /** + * 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. + * @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 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 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. + * @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 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 + */ + 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."); + } + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, serverName, databaseName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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. + * @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 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 beginDeleteAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(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. + * @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 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 {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(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.beginDelete(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 = 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); + } + + /** + * Gets information about 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 information about 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 information about 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 information about 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 (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(), 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); + } + + /** + * List all the databases in 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. + * @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(); + } + + /** + * List all the databases in 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 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); + } + + /** + * List all the databases in 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. + * @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(); + } + }); + } + + /** + * List all the databases in 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. + * @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."); + } + 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); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().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/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRuleInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRuleInner.java new file mode 100644 index 00000000000..5269371f0ca --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRuleInner.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.mysql.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.mysql.ProxyResource; + +/** + * Represents a server firewall rule. + */ +@JsonFlatten +public class FirewallRuleInner extends ProxyResource { + /** + * The start IP address of the server firewall rule. Must be IPv4 format. + */ + @JsonProperty(value = "properties.startIpAddress", required = true) + private String startIpAddress; + + /** + * The end IP address of the server firewall rule. Must be IPv4 format. + */ + @JsonProperty(value = "properties.endIpAddress", required = true) + private String endIpAddress; + + /** + * Get the startIpAddress value. + * + * @return the startIpAddress value + */ + public String startIpAddress() { + return this.startIpAddress; + } + + /** + * Set the startIpAddress value. + * + * @param startIpAddress the startIpAddress value to set + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withStartIpAddress(String startIpAddress) { + this.startIpAddress = startIpAddress; + return this; + } + + /** + * Get the endIpAddress value. + * + * @return the endIpAddress value + */ + public String endIpAddress() { + return this.endIpAddress; + } + + /** + * Set the endIpAddress value. + * + * @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/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRulesInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRulesInner.java new file mode 100644 index 00000000000..2bc0d25566d --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRulesInner.java @@ -0,0 +1,621 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql.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 MySQLManagementClientImpl 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, MySQLManagementClientImpl 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.mysql.FirewallRules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/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.mysql.FirewallRules beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/firewallRules/{firewallRuleName}") + Observable> beginCreateOrUpdate(@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.mysql.FirewallRules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/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.mysql.FirewallRules beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/firewallRules/{firewallRuleName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.mysql.FirewallRules get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/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.mysql.FirewallRules listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/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 a new firewall rule or updates an existing 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 server 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().last().body(); + } + + /** + * Creates a new firewall rule or updates an existing 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 server 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 a new firewall rule or updates an existing 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 server 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 for the request + */ + 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 a new firewall rule or updates an existing 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 server 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 for the request + */ + 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); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, serverName, firewallRuleName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a new firewall rule or updates an existing 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 server 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 beginCreateOrUpdate(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).toBlocking().single().body(); + } + + /** + * Creates a new firewall rule or updates an existing 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 server 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters), serviceCallback); + } + + /** + * Creates a new firewall rule or updates an existing 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 server 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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).map(new Func1, FirewallRuleInner>() { + @Override + public FirewallRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new firewall rule or updates an existing 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 server 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> beginCreateOrUpdateWithServiceResponseAsync(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.beginCreateOrUpdate(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 = 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 server 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 server 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().last().body(); + } + + /** + * Deletes a server 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 server 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 server 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 server firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + 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 server 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 server firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + 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."); + } + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, serverName, firewallRuleName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a server 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 server 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 beginDelete(String resourceGroupName, String serverName, String firewallRuleName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).toBlocking().single().body(); + } + + /** + * Deletes a server 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 server 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 beginDeleteAsync(String resourceGroupName, String serverName, String firewallRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName), serviceCallback); + } + + /** + * Deletes a server 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 server firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a server 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 server firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(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.beginDelete(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 = 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); + } + + /** + * Gets information about a server 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 server 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 information about a server 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 server 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 information about a server 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 server 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 information about a server 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 server 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); + } + + /** + * List all the firewall rules in 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. + * @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(); + } + + /** + * List all the firewall rules in 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 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); + } + + /** + * List all the firewall rules in 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. + * @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(); + } + }); + } + + /** + * List all the firewall rules in 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. + * @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); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().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/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LocationBasedPerformanceTiersInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LocationBasedPerformanceTiersInner.java new file mode 100644 index 00000000000..bf0848b0674 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LocationBasedPerformanceTiersInner.java @@ -0,0 +1,141 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql.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 LocationBasedPerformanceTiers. + */ +public class LocationBasedPerformanceTiersInner { + /** The Retrofit service to perform REST calls. */ + private LocationBasedPerformanceTiersService service; + /** The service client containing this operation class. */ + private MySQLManagementClientImpl client; + + /** + * Initializes an instance of LocationBasedPerformanceTiersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LocationBasedPerformanceTiersInner(Retrofit retrofit, MySQLManagementClientImpl client) { + this.service = retrofit.create(LocationBasedPerformanceTiersService.class); + this.client = client; + } + + /** + * The interface defining all the services for LocationBasedPerformanceTiers to be + * used by Retrofit to perform actually REST calls. + */ + interface LocationBasedPerformanceTiersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.mysql.LocationBasedPerformanceTiers list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/performanceTiers") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("locationName") String locationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @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<PerformanceTierPropertiesInner> object if successful. + */ + public List list(String locationName) { + return listWithServiceResponseAsync(locationName).toBlocking().single().body(); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @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> listAsync(String locationName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(locationName), serviceCallback); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PerformanceTierPropertiesInner> object + */ + public Observable> listAsync(String locationName) { + return listWithServiceResponseAsync(locationName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PerformanceTierPropertiesInner> object + */ + public Observable>> listWithServiceResponseAsync(String locationName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName 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.list(this.client.subscriptionId(), locationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFileInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFileInner.java new file mode 100644 index 00000000000..3df2419be1b --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFileInner.java @@ -0,0 +1,129 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.mysql.ProxyResource; + +/** + * Represents a log file. + */ +@JsonFlatten +public class LogFileInner extends ProxyResource { + /** + * Size of the log file. + */ + @JsonProperty(value = "properties.sizeInKB") + private Long sizeInKB; + + /** + * Creation timestamp of the log file. + */ + @JsonProperty(value = "properties.createdTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdTime; + + /** + * Last modified timestamp of the log file. + */ + @JsonProperty(value = "properties.lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastModifiedTime; + + /** + * Type of the log file. + */ + @JsonProperty(value = "properties.type") + private String logFileType; + + /** + * The url to download the log file from. + */ + @JsonProperty(value = "properties.url") + private String url; + + /** + * Get the sizeInKB value. + * + * @return the sizeInKB value + */ + public Long sizeInKB() { + return this.sizeInKB; + } + + /** + * Set the sizeInKB value. + * + * @param sizeInKB the sizeInKB value to set + * @return the LogFileInner object itself. + */ + public LogFileInner withSizeInKB(Long sizeInKB) { + this.sizeInKB = sizeInKB; + return this; + } + + /** + * Get the createdTime value. + * + * @return the createdTime value + */ + public DateTime createdTime() { + return this.createdTime; + } + + /** + * Get the lastModifiedTime value. + * + * @return the lastModifiedTime value + */ + public DateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get the logFileType value. + * + * @return the logFileType value + */ + public String logFileType() { + return this.logFileType; + } + + /** + * Set the logFileType value. + * + * @param logFileType the logFileType value to set + * @return the LogFileInner object itself. + */ + public LogFileInner withLogFileType(String logFileType) { + this.logFileType = logFileType; + return this; + } + + /** + * Get the url value. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the url value. + * + * @param url the url value to set + * @return the LogFileInner object itself. + */ + public LogFileInner withUrl(String url) { + this.url = url; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFilesInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFilesInner.java new file mode 100644 index 00000000000..6d1f40062b7 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFilesInner.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.mysql.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 LogFiles. + */ +public class LogFilesInner { + /** The Retrofit service to perform REST calls. */ + private LogFilesService service; + /** The service client containing this operation class. */ + private MySQLManagementClientImpl client; + + /** + * Initializes an instance of LogFilesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LogFilesInner(Retrofit retrofit, MySQLManagementClientImpl client) { + this.service = retrofit.create(LogFilesService.class); + this.client = client; + } + + /** + * The interface defining all the services for LogFiles to be + * used by Retrofit to perform actually REST calls. + */ + interface LogFilesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.mysql.LogFiles listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/logFiles") + 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); + + } + + /** + * List all the log files in 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. + * @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<LogFileInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * List all the log files in 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 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); + } + + /** + * List all the log files in 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LogFileInner> 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(); + } + }); + } + + /** + * List all the log files in 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LogFileInner> 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); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().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/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/MySQLManagementClientImpl.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/MySQLManagementClientImpl.java new file mode 100644 index 00000000000..74be542dfad --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/MySQLManagementClientImpl.java @@ -0,0 +1,294 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql.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 MySQLManagementClientImpl class. + */ +public class MySQLManagementClientImpl 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 MySQLManagementClientImpl 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 MySQLManagementClientImpl 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 MySQLManagementClientImpl 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 MySQLManagementClientImpl 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 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 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 ConfigurationsInner object to access its operations. + */ + private ConfigurationsInner configurations; + + /** + * Gets the ConfigurationsInner object to access its operations. + * @return the ConfigurationsInner object. + */ + public ConfigurationsInner configurations() { + return this.configurations; + } + + /** + * The LogFilesInner object to access its operations. + */ + private LogFilesInner logFiles; + + /** + * Gets the LogFilesInner object to access its operations. + * @return the LogFilesInner object. + */ + public LogFilesInner logFiles() { + return this.logFiles; + } + + /** + * The LocationBasedPerformanceTiersInner object to access its operations. + */ + private LocationBasedPerformanceTiersInner locationBasedPerformanceTiers; + + /** + * Gets the LocationBasedPerformanceTiersInner object to access its operations. + * @return the LocationBasedPerformanceTiersInner object. + */ + public LocationBasedPerformanceTiersInner locationBasedPerformanceTiers() { + return this.locationBasedPerformanceTiers; + } + + /** + * The CheckNameAvailabilitysInner object to access its operations. + */ + private CheckNameAvailabilitysInner checkNameAvailabilitys; + + /** + * Gets the CheckNameAvailabilitysInner object to access its operations. + * @return the CheckNameAvailabilitysInner object. + */ + public CheckNameAvailabilitysInner checkNameAvailabilitys() { + return this.checkNameAvailabilitys; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * Initializes an instance of MySQLManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public MySQLManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of MySQLManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public MySQLManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of MySQLManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public MySQLManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-12-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.servers = new ServersInner(restClient().retrofit(), this); + this.firewallRules = new FirewallRulesInner(restClient().retrofit(), this); + this.databases = new DatabasesInner(restClient().retrofit(), this); + this.configurations = new ConfigurationsInner(restClient().retrofit(), this); + this.logFiles = new LogFilesInner(restClient().retrofit(), this); + this.locationBasedPerformanceTiers = new LocationBasedPerformanceTiersInner(restClient().retrofit(), this); + this.checkNameAvailabilitys = new CheckNameAvailabilitysInner(restClient().retrofit(), this); + this.operations = new OperationsInner(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(), "MySQLManagementClient", "2017-12-01"); + } +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/NameAvailabilityInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/NameAvailabilityInner.java new file mode 100644 index 00000000000..4784b024d90 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/NameAvailabilityInner.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a resource name availability. + */ +public class NameAvailabilityInner { + /** + * Error Message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Indicates whether the resource name is available. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /** + * Reason for name being unavailable. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the nameAvailable value. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable value. + * + * @param nameAvailable the nameAvailable value to set + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason value. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason value. + * + * @param reason the reason value to set + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withReason(String reason) { + this.reason = reason; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/NameAvailabilityRequestInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/NameAvailabilityRequestInner.java new file mode 100644 index 00000000000..15faeadd04d --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/NameAvailabilityRequestInner.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.mysql.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request from client to check resource name availability. + */ +public class NameAvailabilityRequestInner { + /** + * Resource name to verify. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Resource type used for verification. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the NameAvailabilityRequestInner object itself. + */ + public NameAvailabilityRequestInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the NameAvailabilityRequestInner object itself. + */ + public NameAvailabilityRequestInner withType(String type) { + this.type = type; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationListResultInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationListResultInner.java new file mode 100644 index 00000000000..3a72c2b8e70 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationListResultInner.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.mysql.implementation; + +import java.util.List; +import com.microsoft.azure.management.mysql.Operation; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A list of resource provider operations. + */ +public class OperationListResultInner { + /** + * The list of resource provider operations. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value value. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the OperationListResultInner object itself. + */ + public OperationListResultInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationsInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationsInner.java new file mode 100644 index 00000000000..d3426c48351 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationsInner.java @@ -0,0 +1,128 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql.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 okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +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 Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private MySQLManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, MySQLManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.mysql.Operations list" }) + @GET("providers/Microsoft.DBforMySQL/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available REST API operations. + * + * @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 OperationListResultInner object if successful. + */ + public OperationListResultInner list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Lists all of the available REST API operations. + * + * @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 listAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Lists all of the available REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationListResultInner object + */ + public Observable listAsync() { + return listWithServiceResponseAsync().map(new Func1, OperationListResultInner>() { + @Override + public OperationListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationListResultInner object + */ + public Observable> listWithServiceResponseAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PageImpl.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PageImpl.java new file mode 100644 index 00000000000..abfc4a7f4cc --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/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.mysql.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/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PerformanceTierPropertiesInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PerformanceTierPropertiesInner.java new file mode 100644 index 00000000000..50742afab1a --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PerformanceTierPropertiesInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql.implementation; + +import java.util.List; +import com.microsoft.azure.management.mysql.PerformanceTierServiceLevelObjectives; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Performance tier properties. + */ +public class PerformanceTierPropertiesInner { + /** + * ID of the performance tier. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Service level objectives associated with the performance tier. + */ + @JsonProperty(value = "serviceLevelObjectives") + private List serviceLevelObjectives; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the serviceLevelObjectives value. + * + * @return the serviceLevelObjectives value + */ + public List serviceLevelObjectives() { + return this.serviceLevelObjectives; + } + + /** + * Set the serviceLevelObjectives value. + * + * @param serviceLevelObjectives the serviceLevelObjectives value to set + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withServiceLevelObjectives(List serviceLevelObjectives) { + this.serviceLevelObjectives = serviceLevelObjectives; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerForCreateInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerForCreateInner.java new file mode 100644 index 00000000000..1b59698b1ce --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerForCreateInner.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql.implementation; + +import com.microsoft.azure.management.mysql.Sku; +import com.microsoft.azure.management.mysql.ServerPropertiesForCreate; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a server to be created. + */ +public class ServerForCreateInner { + /** + * The SKU (pricing tier) of the server. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Properties of the server. + */ + @JsonProperty(value = "properties", required = true) + private ServerPropertiesForCreate properties; + + /** + * The location the resource resides in. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Application-specific metadata in the form of key-value pairs. + */ + @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 ServerForCreateInner object itself. + */ + public ServerForCreateInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public ServerPropertiesForCreate properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the ServerForCreateInner object itself. + */ + public ServerForCreateInner withProperties(ServerPropertiesForCreate properties) { + this.properties = properties; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the ServerForCreateInner object itself. + */ + public ServerForCreateInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the ServerForCreateInner object itself. + */ + public ServerForCreateInner withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerInner.java new file mode 100644 index 00000000000..0d7272022ff --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerInner.java @@ -0,0 +1,237 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql.implementation; + +import com.microsoft.azure.management.mysql.Sku; +import com.microsoft.azure.management.mysql.ServerVersion; +import com.microsoft.azure.management.mysql.SslEnforcementEnum; +import com.microsoft.azure.management.mysql.ServerState; +import org.joda.time.DateTime; +import com.microsoft.azure.management.mysql.StorageProfile; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.mysql.TrackedResource; + +/** + * Represents a server. + */ +@JsonFlatten +public class ServerInner extends TrackedResource { + /** + * The SKU (pricing tier) of the server. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * The administrator's login name of a server. Can only be specified when + * the server is being created (and is required for creation). + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /** + * Server version. Possible values include: '5.6', '5.7'. + */ + @JsonProperty(value = "properties.version") + private ServerVersion version; + + /** + * Enable ssl enforcement or not when connect to server. Possible values + * include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.sslEnforcement") + private SslEnforcementEnum sslEnforcement; + + /** + * A state of a server that is visible to user. Possible values include: + * 'Ready', 'Dropping', 'Disabled'. + */ + @JsonProperty(value = "properties.userVisibleState") + private ServerState userVisibleState; + + /** + * The fully qualified domain name of a server. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName") + private String fullyQualifiedDomainName; + + /** + * Earliest restore point creation time (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate") + private DateTime earliestRestoreDate; + + /** + * Storage profile of a server. + */ + @JsonProperty(value = "properties.storageProfile") + private StorageProfile storageProfile; + + /** + * 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 ServerInner object itself. + */ + public ServerInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the administratorLogin value. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin value. + * + * @param administratorLogin the administratorLogin value to set + * @return the ServerInner object itself. + */ + public ServerInner withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the version value. + * + * @return the version value + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version value. + * + * @param version the version value to set + * @return the ServerInner object itself. + */ + public ServerInner withVersion(ServerVersion version) { + this.version = version; + return this; + } + + /** + * Get the sslEnforcement value. + * + * @return the sslEnforcement value + */ + public SslEnforcementEnum sslEnforcement() { + return this.sslEnforcement; + } + + /** + * Set the sslEnforcement value. + * + * @param sslEnforcement the sslEnforcement value to set + * @return the ServerInner object itself. + */ + public ServerInner withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.sslEnforcement = sslEnforcement; + return this; + } + + /** + * Get the userVisibleState value. + * + * @return the userVisibleState value + */ + public ServerState userVisibleState() { + return this.userVisibleState; + } + + /** + * Set the userVisibleState value. + * + * @param userVisibleState the userVisibleState value to set + * @return the ServerInner object itself. + */ + public ServerInner withUserVisibleState(ServerState userVisibleState) { + this.userVisibleState = userVisibleState; + return this; + } + + /** + * Get the fullyQualifiedDomainName value. + * + * @return the fullyQualifiedDomainName value + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Set the fullyQualifiedDomainName value. + * + * @param fullyQualifiedDomainName the fullyQualifiedDomainName value to set + * @return the ServerInner object itself. + */ + public ServerInner withFullyQualifiedDomainName(String fullyQualifiedDomainName) { + this.fullyQualifiedDomainName = fullyQualifiedDomainName; + return this; + } + + /** + * Get the earliestRestoreDate value. + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Set the earliestRestoreDate value. + * + * @param earliestRestoreDate the earliestRestoreDate value to set + * @return the ServerInner object itself. + */ + public ServerInner withEarliestRestoreDate(DateTime earliestRestoreDate) { + this.earliestRestoreDate = earliestRestoreDate; + return this; + } + + /** + * Get the storageProfile value. + * + * @return the storageProfile value + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile value. + * + * @param storageProfile the storageProfile value to set + * @return the ServerInner object itself. + */ + public ServerInner withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerUpdateParametersInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerUpdateParametersInner.java new file mode 100644 index 00000000000..2e94dbe5b6c --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerUpdateParametersInner.java @@ -0,0 +1,181 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql.implementation; + +import com.microsoft.azure.management.mysql.Sku; +import com.microsoft.azure.management.mysql.StorageProfile; +import com.microsoft.azure.management.mysql.ServerVersion; +import com.microsoft.azure.management.mysql.SslEnforcementEnum; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters allowd to update for a server. + */ +@JsonFlatten +public class ServerUpdateParametersInner { + /** + * The SKU (pricing tier) of the server. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Storage profile of a server. + */ + @JsonProperty(value = "properties.storageProfile") + private StorageProfile storageProfile; + + /** + * The password of the administrator login. + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /** + * The version of a server. Possible values include: '5.6', '5.7'. + */ + @JsonProperty(value = "properties.version") + private ServerVersion version; + + /** + * Enable ssl enforcement or not when connect to server. Possible values + * include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.sslEnforcement") + private SslEnforcementEnum sslEnforcement; + + /** + * Application-specific metadata in the form of key-value pairs. + */ + @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 ServerUpdateParametersInner object itself. + */ + public ServerUpdateParametersInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the storageProfile value. + * + * @return the storageProfile value + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile value. + * + * @param storageProfile the storageProfile value to set + * @return the ServerUpdateParametersInner object itself. + */ + public ServerUpdateParametersInner withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the administratorLoginPassword value. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword value. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ServerUpdateParametersInner object itself. + */ + public ServerUpdateParametersInner withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the version value. + * + * @return the version value + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version value. + * + * @param version the version value to set + * @return the ServerUpdateParametersInner object itself. + */ + public ServerUpdateParametersInner withVersion(ServerVersion version) { + this.version = version; + return this; + } + + /** + * Get the sslEnforcement value. + * + * @return the sslEnforcement value + */ + public SslEnforcementEnum sslEnforcement() { + return this.sslEnforcement; + } + + /** + * Set the sslEnforcement value. + * + * @param sslEnforcement the sslEnforcement value to set + * @return the ServerUpdateParametersInner object itself. + */ + public ServerUpdateParametersInner withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.sslEnforcement = sslEnforcement; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the ServerUpdateParametersInner object itself. + */ + public ServerUpdateParametersInner withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServersInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServersInner.java new file mode 100644 index 00000000000..bd709b75f82 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServersInner.java @@ -0,0 +1,850 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql.implementation; + +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsGet; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsDelete; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +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.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 implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ServersService service; + /** The service client containing this operation class. */ + private MySQLManagementClientImpl 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, MySQLManagementClientImpl 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.mysql.Servers create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}") + Observable> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerForCreateInner 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.mysql.Servers beginCreate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}") + Observable> beginCreate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerForCreateInner 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.mysql.Servers update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerUpdateParametersInner 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.mysql.Servers beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerUpdateParametersInner 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.mysql.Servers delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}", method = "DELETE", hasBody = true) + Observable> delete(@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.mysql.Servers beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.mysql.Servers getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}") + Observable> getByResourceGroup(@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.mysql.Servers listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.mysql.Servers list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/servers") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing 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 required parameters for creating or updating a 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 ServerInner object if successful. + */ + public ServerInner create(String resourceGroupName, String serverName, ServerForCreateInner parameters) { + return createWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing 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 required parameters for creating or updating a 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 createAsync(String resourceGroupName, String serverName, ServerForCreateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing 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 required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String serverName, ServerForCreateInner parameters) { + return createWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing 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 required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String serverName, ServerForCreateInner 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.create(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing 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 required parameters for creating or updating a 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 ServerInner object if successful. + */ + public ServerInner beginCreate(String resourceGroupName, String serverName, ServerForCreateInner parameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing 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 required parameters for creating or updating a 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 beginCreateAsync(String resourceGroupName, String serverName, ServerForCreateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing 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 required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String serverName, ServerForCreateInner parameters) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing 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 required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerForCreateInner 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.beginCreate(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 = 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(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal server definition. + * + * @param resourceGroupName The name of the resource group that contains 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 updating a 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 ServerInner object if successful. + */ + public ServerInner update(String resourceGroupName, String serverName, ServerUpdateParametersInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal server definition. + * + * @param resourceGroupName The name of the resource group that contains 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 updating a 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 updateAsync(String resourceGroupName, String serverName, ServerUpdateParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal server definition. + * + * @param resourceGroupName The name of the resource group that contains 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 updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, ServerUpdateParametersInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal server definition. + * + * @param resourceGroupName The name of the resource group that contains 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 updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdateParametersInner 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.update(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal server definition. + * + * @param resourceGroupName The name of the resource group that contains 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 updating a 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 ServerInner object if successful. + */ + public ServerInner beginUpdate(String resourceGroupName, String serverName, ServerUpdateParametersInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal server definition. + * + * @param resourceGroupName The name of the resource group that contains 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 updating a 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 beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdateParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal server definition. + * + * @param resourceGroupName The name of the resource group that contains 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 updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdateParametersInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal server definition. + * + * @param resourceGroupName The name of the resource group that contains 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 updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServerInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdateParametersInner 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.beginUpdate(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 = 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 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 + */ + public void delete(String resourceGroupName, String serverName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().last().body(); + } + + /** + * Deletes 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 deleteAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Deletes 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 + */ + public Observable deleteAsync(String resourceGroupName, String serverName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes 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 + */ + public Observable> deleteWithServiceResponseAsync(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."); + } + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, serverName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes 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 + */ + public void beginDelete(String resourceGroupName, String serverName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Deletes 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 beginDeleteAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Deletes 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 {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes 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 {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(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.beginDelete(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 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); + } + + /** + * Gets information about 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 ServerInner object if successful. + */ + public ServerInner getByResourceGroup(String resourceGroupName, String serverName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * Gets information about 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 getByResourceGroupAsync(String resourceGroupName, String serverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName), serviceCallback); + } + + /** + * Gets information about 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 ServerInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String serverName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1, ServerInner>() { + @Override + public ServerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets information about 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 ServerInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(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.getByResourceGroup(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 clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List all the servers in a given resource 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. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List all the servers in a given resource 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * List all the servers in a given resource 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. + * @return the observable to the List<ServerInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List all the servers in a given resource 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. + * @return the observable to the List<ServerInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + 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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(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); + } + + /** + * List all the servers in a given subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List all the servers in a given subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * List all the servers in a given subscription. + * + * @return the observable to the List<ServerInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List all the servers in a given subscription. + * + * @return the observable to the List<ServerInner> object + */ + public Observable>> listWithServiceResponseAsync() { + 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.list(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 = listDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/package-info.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/package-info.java new file mode 100644 index 00000000000..6f2c80f498d --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/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 MySQLManagementClient. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, log files and configurations with new business model. + */ +package com.microsoft.azure.management.mysql.implementation; diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/package-info.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/package-info.java new file mode 100644 index 00000000000..29884a80476 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/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 MySQLManagementClient. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, log files and configurations with new business model. + */ +package com.microsoft.azure.management.mysql; From acb1952727c9743ea123d38b084b884fae87fc54 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 10 Oct 2018 09:48:11 -0700 Subject: [PATCH 2/2] Generated from 9ee547a1c8f8c180abb7487eb50ea17d5cd48ef2 (#245) Add mysql replica APIs into spec --- .../mysql/NameAvailabilityRequest.java | 69 ++ .../management/mysql/OperationDisplay.java | 8 +- ...PerformanceTierServiceLevelObjectives.java | 32 +- .../management/mysql/ServerForCreate.java | 122 +++ .../mysql/ServerPropertiesForCreate.java | 16 +- .../ServerPropertiesForDefaultCreate.java | 8 +- .../mysql/ServerPropertiesForGeoRestore.java | 48 ++ .../mysql/ServerPropertiesForReplica.java | 47 ++ .../mysql/ServerPropertiesForRestore.java | 10 +- .../mysql/ServerUpdateParameters.java | 203 +++++ .../microsoft/azure/management/mysql/Sku.java | 20 +- .../management/mysql/StorageProfile.java | 12 +- .../mysql/VirtualNetworkRuleState.java | 50 ++ .../CheckNameAvailabilitysInner.java | 11 +- .../implementation/ConfigurationInner.java | 18 +- .../implementation/ConfigurationsInner.java | 6 +- .../mysql/implementation/DatabaseInner.java | 10 +- .../mysql/implementation/DatabasesInner.java | 6 +- .../implementation/FirewallRuleInner.java | 10 +- .../implementation/FirewallRulesInner.java | 6 +- .../LocationBasedPerformanceTiersInner.java | 6 +- .../mysql/implementation/LogFileInner.java | 18 +- .../mysql/implementation/LogFilesInner.java | 6 +- .../MySQLManagementClientImpl.java | 28 + .../implementation/NameAvailabilityInner.java | 12 +- .../mysql/implementation/OperationInner.java | 82 ++ .../OperationListResultInner.java | 11 +- .../mysql/implementation/PageImpl1.java | 75 ++ .../PerformanceTierPropertiesInner.java | 8 +- .../mysql/implementation/ReplicasInner.java | 152 ++++ .../mysql/implementation/ServerInner.java | 113 ++- .../mysql/implementation/ServersInner.java | 54 +- .../implementation/TrackedResourceInner.java | 71 ++ .../VirtualNetworkRuleInner.java | 90 ++ .../VirtualNetworkRulesInner.java | 777 ++++++++++++++++++ .../mysql/implementation/package-info.java | 2 +- .../azure/management/mysql/package-info.java | 2 +- 37 files changed, 2071 insertions(+), 148 deletions(-) create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/NameAvailabilityRequest.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerForCreate.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForGeoRestore.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForReplica.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerUpdateParameters.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/VirtualNetworkRuleState.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PageImpl1.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ReplicasInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/TrackedResourceInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/VirtualNetworkRuleInner.java create mode 100644 azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/VirtualNetworkRulesInner.java diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/NameAvailabilityRequest.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/NameAvailabilityRequest.java new file mode 100644 index 00000000000..5be700ec822 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/NameAvailabilityRequest.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.mysql; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request from client to check resource name availability. + */ +public class NameAvailabilityRequest { + /** + * Resource name to verify. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Resource type used for verification. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get resource name to verify. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set resource name to verify. + * + * @param name the name value to set + * @return the NameAvailabilityRequest object itself. + */ + public NameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get resource type used for verification. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set resource type used for verification. + * + * @param type the type value to set + * @return the NameAvailabilityRequest object itself. + */ + public NameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/OperationDisplay.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/OperationDisplay.java index 6dbc41d1bdf..138b72f1956 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/OperationDisplay.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/OperationDisplay.java @@ -39,7 +39,7 @@ public class OperationDisplay { private String description; /** - * Get the provider value. + * Get operation resource provider name. * * @return the provider value */ @@ -48,7 +48,7 @@ public String provider() { } /** - * Get the resource value. + * Get resource on which the operation is performed. * * @return the resource value */ @@ -57,7 +57,7 @@ public String resource() { } /** - * Get the operation value. + * Get localized friendly name for the operation. * * @return the operation value */ @@ -66,7 +66,7 @@ public String operation() { } /** - * Get the description value. + * Get operation description. * * @return the description value */ diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/PerformanceTierServiceLevelObjectives.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/PerformanceTierServiceLevelObjectives.java index d9c635fdc37..44c6ac1f9e3 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/PerformanceTierServiceLevelObjectives.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/PerformanceTierServiceLevelObjectives.java @@ -63,7 +63,7 @@ public class PerformanceTierServiceLevelObjectives { private Integer minStorageMB; /** - * Get the id value. + * Get iD for the service level objective. * * @return the id value */ @@ -72,7 +72,7 @@ public String id() { } /** - * Set the id value. + * Set iD for the service level objective. * * @param id the id value to set * @return the PerformanceTierServiceLevelObjectives object itself. @@ -83,7 +83,7 @@ public PerformanceTierServiceLevelObjectives withId(String id) { } /** - * Get the edition value. + * Get edition of the performance tier. * * @return the edition value */ @@ -92,7 +92,7 @@ public String edition() { } /** - * Set the edition value. + * Set edition of the performance tier. * * @param edition the edition value to set * @return the PerformanceTierServiceLevelObjectives object itself. @@ -103,7 +103,7 @@ public PerformanceTierServiceLevelObjectives withEdition(String edition) { } /** - * Get the vCore value. + * Get vCore associated with the service level objective. * * @return the vCore value */ @@ -112,7 +112,7 @@ public Integer vCore() { } /** - * Set the vCore value. + * Set vCore associated with the service level objective. * * @param vCore the vCore value to set * @return the PerformanceTierServiceLevelObjectives object itself. @@ -123,7 +123,7 @@ public PerformanceTierServiceLevelObjectives withVCore(Integer vCore) { } /** - * Get the hardwareGeneration value. + * Get hardware generation associated with the service level objective. * * @return the hardwareGeneration value */ @@ -132,7 +132,7 @@ public String hardwareGeneration() { } /** - * Set the hardwareGeneration value. + * Set hardware generation associated with the service level objective. * * @param hardwareGeneration the hardwareGeneration value to set * @return the PerformanceTierServiceLevelObjectives object itself. @@ -143,7 +143,7 @@ public PerformanceTierServiceLevelObjectives withHardwareGeneration(String hardw } /** - * Get the maxBackupRetentionDays value. + * Get maximum Backup retention in days for the performance tier edition. * * @return the maxBackupRetentionDays value */ @@ -152,7 +152,7 @@ public Integer maxBackupRetentionDays() { } /** - * Set the maxBackupRetentionDays value. + * Set maximum Backup retention in days for the performance tier edition. * * @param maxBackupRetentionDays the maxBackupRetentionDays value to set * @return the PerformanceTierServiceLevelObjectives object itself. @@ -163,7 +163,7 @@ public PerformanceTierServiceLevelObjectives withMaxBackupRetentionDays(Integer } /** - * Get the minBackupRetentionDays value. + * Get minimum Backup retention in days for the performance tier edition. * * @return the minBackupRetentionDays value */ @@ -172,7 +172,7 @@ public Integer minBackupRetentionDays() { } /** - * Set the minBackupRetentionDays value. + * Set minimum Backup retention in days for the performance tier edition. * * @param minBackupRetentionDays the minBackupRetentionDays value to set * @return the PerformanceTierServiceLevelObjectives object itself. @@ -183,7 +183,7 @@ public PerformanceTierServiceLevelObjectives withMinBackupRetentionDays(Integer } /** - * Get the maxStorageMB value. + * Get max storage allowed for a server. * * @return the maxStorageMB value */ @@ -192,7 +192,7 @@ public Integer maxStorageMB() { } /** - * Set the maxStorageMB value. + * Set max storage allowed for a server. * * @param maxStorageMB the maxStorageMB value to set * @return the PerformanceTierServiceLevelObjectives object itself. @@ -203,7 +203,7 @@ public PerformanceTierServiceLevelObjectives withMaxStorageMB(Integer maxStorage } /** - * Get the minStorageMB value. + * Get max storage allowed for a server. * * @return the minStorageMB value */ @@ -212,7 +212,7 @@ public Integer minStorageMB() { } /** - * Set the minStorageMB value. + * Set max storage allowed for a server. * * @param minStorageMB the minStorageMB value to set * @return the PerformanceTierServiceLevelObjectives object itself. diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerForCreate.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerForCreate.java new file mode 100644 index 00000000000..f1ffd5db80f --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerForCreate.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a server to be created. + */ +public class ServerForCreate { + /** + * The SKU (pricing tier) of the server. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Properties of the server. + */ + @JsonProperty(value = "properties", required = true) + private ServerPropertiesForCreate properties; + + /** + * The location the resource resides in. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Application-specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the SKU (pricing tier) of the server. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the SKU (pricing tier) of the server. + * + * @param sku the sku value to set + * @return the ServerForCreate object itself. + */ + public ServerForCreate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get properties of the server. + * + * @return the properties value + */ + public ServerPropertiesForCreate properties() { + return this.properties; + } + + /** + * Set properties of the server. + * + * @param properties the properties value to set + * @return the ServerForCreate object itself. + */ + public ServerForCreate withProperties(ServerPropertiesForCreate properties) { + this.properties = properties; + return this; + } + + /** + * Get the location the resource resides in. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location the resource resides in. + * + * @param location the location value to set + * @return the ServerForCreate object itself. + */ + public ServerForCreate withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get application-specific metadata in the form of key-value pairs. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set application-specific metadata in the form of key-value pairs. + * + * @param tags the tags value to set + * @return the ServerForCreate object itself. + */ + public ServerForCreate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForCreate.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForCreate.java index ee20cc7da3b..8c5feb6c22c 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForCreate.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForCreate.java @@ -20,7 +20,9 @@ @JsonTypeName("ServerPropertiesForCreate") @JsonSubTypes({ @JsonSubTypes.Type(name = "Default", value = ServerPropertiesForDefaultCreate.class), - @JsonSubTypes.Type(name = "PointInTimeRestore", value = ServerPropertiesForRestore.class) + @JsonSubTypes.Type(name = "PointInTimeRestore", value = ServerPropertiesForRestore.class), + @JsonSubTypes.Type(name = "GeoRestore", value = ServerPropertiesForGeoRestore.class), + @JsonSubTypes.Type(name = "Replica", value = ServerPropertiesForReplica.class) }) public class ServerPropertiesForCreate { /** @@ -43,7 +45,7 @@ public class ServerPropertiesForCreate { private StorageProfile storageProfile; /** - * Get the version value. + * Get server version. Possible values include: '5.6', '5.7'. * * @return the version value */ @@ -52,7 +54,7 @@ public ServerVersion version() { } /** - * Set the version value. + * Set server version. Possible values include: '5.6', '5.7'. * * @param version the version value to set * @return the ServerPropertiesForCreate object itself. @@ -63,7 +65,7 @@ public ServerPropertiesForCreate withVersion(ServerVersion version) { } /** - * Get the sslEnforcement value. + * Get enable ssl enforcement or not when connect to server. Possible values include: 'Enabled', 'Disabled'. * * @return the sslEnforcement value */ @@ -72,7 +74,7 @@ public SslEnforcementEnum sslEnforcement() { } /** - * Set the sslEnforcement value. + * Set enable ssl enforcement or not when connect to server. Possible values include: 'Enabled', 'Disabled'. * * @param sslEnforcement the sslEnforcement value to set * @return the ServerPropertiesForCreate object itself. @@ -83,7 +85,7 @@ public ServerPropertiesForCreate withSslEnforcement(SslEnforcementEnum sslEnforc } /** - * Get the storageProfile value. + * Get storage profile of a server. * * @return the storageProfile value */ @@ -92,7 +94,7 @@ public StorageProfile storageProfile() { } /** - * Set the storageProfile value. + * Set storage profile of a server. * * @param storageProfile the storageProfile value to set * @return the ServerPropertiesForCreate object itself. diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForDefaultCreate.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForDefaultCreate.java index cf1b75fb122..b315999f534 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForDefaultCreate.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForDefaultCreate.java @@ -32,7 +32,7 @@ public class ServerPropertiesForDefaultCreate extends ServerPropertiesForCreate private String administratorLoginPassword; /** - * Get the administratorLogin value. + * Get the administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). * * @return the administratorLogin value */ @@ -41,7 +41,7 @@ public String administratorLogin() { } /** - * Set the administratorLogin value. + * Set the administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). * * @param administratorLogin the administratorLogin value to set * @return the ServerPropertiesForDefaultCreate object itself. @@ -52,7 +52,7 @@ public ServerPropertiesForDefaultCreate withAdministratorLogin(String administra } /** - * Get the administratorLoginPassword value. + * Get the password of the administrator login. * * @return the administratorLoginPassword value */ @@ -61,7 +61,7 @@ public String administratorLoginPassword() { } /** - * Set the administratorLoginPassword value. + * Set the password of the administrator login. * * @param administratorLoginPassword the administratorLoginPassword value to set * @return the ServerPropertiesForDefaultCreate object itself. diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForGeoRestore.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForGeoRestore.java new file mode 100644 index 00000000000..ebc4de04bc7 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForGeoRestore.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.mysql; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The properties used to create a new server by restoring to a different + * region from a geo replicated backup. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("GeoRestore") +public class ServerPropertiesForGeoRestore extends ServerPropertiesForCreate { + /** + * The source server id to restore from. + */ + @JsonProperty(value = "sourceServerId", required = true) + private String sourceServerId; + + /** + * Get the source server id to restore from. + * + * @return the sourceServerId value + */ + public String sourceServerId() { + return this.sourceServerId; + } + + /** + * Set the source server id to restore from. + * + * @param sourceServerId the sourceServerId value to set + * @return the ServerPropertiesForGeoRestore object itself. + */ + public ServerPropertiesForGeoRestore withSourceServerId(String sourceServerId) { + this.sourceServerId = sourceServerId; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForReplica.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForReplica.java new file mode 100644 index 00000000000..5e439b47422 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForReplica.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.mysql; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The properties to create a new replica. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("Replica") +public class ServerPropertiesForReplica extends ServerPropertiesForCreate { + /** + * The primary server id to create replica from. + */ + @JsonProperty(value = "sourceServerId", required = true) + private String sourceServerId; + + /** + * Get the primary server id to create replica from. + * + * @return the sourceServerId value + */ + public String sourceServerId() { + return this.sourceServerId; + } + + /** + * Set the primary server id to create replica from. + * + * @param sourceServerId the sourceServerId value to set + * @return the ServerPropertiesForReplica object itself. + */ + public ServerPropertiesForReplica withSourceServerId(String sourceServerId) { + this.sourceServerId = sourceServerId; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForRestore.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForRestore.java index c30e7aadf46..c65a419f7f7 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForRestore.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerPropertiesForRestore.java @@ -14,7 +14,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; /** - * The properties to a new server by restoring from a backup. + * The properties used to create a new server by restoring from a backup. */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") @JsonTypeName("PointInTimeRestore") @@ -33,7 +33,7 @@ public class ServerPropertiesForRestore extends ServerPropertiesForCreate { private DateTime restorePointInTime; /** - * Get the sourceServerId value. + * Get the source server id to restore from. * * @return the sourceServerId value */ @@ -42,7 +42,7 @@ public String sourceServerId() { } /** - * Set the sourceServerId value. + * Set the source server id to restore from. * * @param sourceServerId the sourceServerId value to set * @return the ServerPropertiesForRestore object itself. @@ -53,7 +53,7 @@ public ServerPropertiesForRestore withSourceServerId(String sourceServerId) { } /** - * Get the restorePointInTime value. + * Get restore point creation time (ISO8601 format), specifying the time to restore from. * * @return the restorePointInTime value */ @@ -62,7 +62,7 @@ public DateTime restorePointInTime() { } /** - * Set the restorePointInTime value. + * Set restore point creation time (ISO8601 format), specifying the time to restore from. * * @param restorePointInTime the restorePointInTime value to set * @return the ServerPropertiesForRestore object itself. diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerUpdateParameters.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerUpdateParameters.java new file mode 100644 index 00000000000..994f42a33f7 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/ServerUpdateParameters.java @@ -0,0 +1,203 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters allowd to update for a server. + */ +@JsonFlatten +public class ServerUpdateParameters { + /** + * The SKU (pricing tier) of the server. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Storage profile of a server. + */ + @JsonProperty(value = "properties.storageProfile") + private StorageProfile storageProfile; + + /** + * The password of the administrator login. + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /** + * The version of a server. Possible values include: '5.6', '5.7'. + */ + @JsonProperty(value = "properties.version") + private ServerVersion version; + + /** + * Enable ssl enforcement or not when connect to server. Possible values + * include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.sslEnforcement") + private SslEnforcementEnum sslEnforcement; + + /** + * The replication role of the server. + */ + @JsonProperty(value = "properties.replicationRole") + private String replicationRole; + + /** + * Application-specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the SKU (pricing tier) of the server. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the SKU (pricing tier) of the server. + * + * @param sku the sku value to set + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get storage profile of a server. + * + * @return the storageProfile value + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set storage profile of a server. + * + * @param storageProfile the storageProfile value to set + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the password of the administrator login. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the password of the administrator login. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the version of a server. Possible values include: '5.6', '5.7'. + * + * @return the version value + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version of a server. Possible values include: '5.6', '5.7'. + * + * @param version the version value to set + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withVersion(ServerVersion version) { + this.version = version; + return this; + } + + /** + * Get enable ssl enforcement or not when connect to server. Possible values include: 'Enabled', 'Disabled'. + * + * @return the sslEnforcement value + */ + public SslEnforcementEnum sslEnforcement() { + return this.sslEnforcement; + } + + /** + * Set enable ssl enforcement or not when connect to server. Possible values include: 'Enabled', 'Disabled'. + * + * @param sslEnforcement the sslEnforcement value to set + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.sslEnforcement = sslEnforcement; + return this; + } + + /** + * Get the replication role of the server. + * + * @return the replicationRole value + */ + public String replicationRole() { + return this.replicationRole; + } + + /** + * Set the replication role of the server. + * + * @param replicationRole the replicationRole value to set + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withReplicationRole(String replicationRole) { + this.replicationRole = replicationRole; + return this; + } + + /** + * Get application-specific metadata in the form of key-value pairs. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set application-specific metadata in the form of key-value pairs. + * + * @param tags the tags value to set + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/Sku.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/Sku.java index 753d9875ee6..3564d010564 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/Sku.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/Sku.java @@ -47,7 +47,7 @@ public class Sku { private String family; /** - * Get the name value. + * Get the name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8. * * @return the name value */ @@ -56,7 +56,7 @@ public String name() { } /** - * Set the name value. + * Set the name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8. * * @param name the name value to set * @return the Sku object itself. @@ -67,7 +67,7 @@ public Sku withName(String name) { } /** - * Get the tier value. + * Get the tier of the particular SKU, e.g. Basic. Possible values include: 'Basic', 'GeneralPurpose', 'MemoryOptimized'. * * @return the tier value */ @@ -76,7 +76,7 @@ public SkuTier tier() { } /** - * Set the tier value. + * Set the tier of the particular SKU, e.g. Basic. Possible values include: 'Basic', 'GeneralPurpose', 'MemoryOptimized'. * * @param tier the tier value to set * @return the Sku object itself. @@ -87,7 +87,7 @@ public Sku withTier(SkuTier tier) { } /** - * Get the capacity value. + * Get the scale up/out capacity, representing server's compute units. * * @return the capacity value */ @@ -96,7 +96,7 @@ public Integer capacity() { } /** - * Set the capacity value. + * Set the scale up/out capacity, representing server's compute units. * * @param capacity the capacity value to set * @return the Sku object itself. @@ -107,7 +107,7 @@ public Sku withCapacity(Integer capacity) { } /** - * Get the size value. + * Get the size code, to be interpreted by resource as appropriate. * * @return the size value */ @@ -116,7 +116,7 @@ public String size() { } /** - * Set the size value. + * Set the size code, to be interpreted by resource as appropriate. * * @param size the size value to set * @return the Sku object itself. @@ -127,7 +127,7 @@ public Sku withSize(String size) { } /** - * Get the family value. + * Get the family of hardware. * * @return the family value */ @@ -136,7 +136,7 @@ public String family() { } /** - * Set the family value. + * Set the family of hardware. * * @param family the family value to set * @return the Sku object itself. diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/StorageProfile.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/StorageProfile.java index 8a7a1688cb1..916004bd98d 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/StorageProfile.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/StorageProfile.java @@ -34,7 +34,7 @@ public class StorageProfile { private Integer storageMB; /** - * Get the backupRetentionDays value. + * Get backup retention days for the server. * * @return the backupRetentionDays value */ @@ -43,7 +43,7 @@ public Integer backupRetentionDays() { } /** - * Set the backupRetentionDays value. + * Set backup retention days for the server. * * @param backupRetentionDays the backupRetentionDays value to set * @return the StorageProfile object itself. @@ -54,7 +54,7 @@ public StorageProfile withBackupRetentionDays(Integer backupRetentionDays) { } /** - * Get the geoRedundantBackup value. + * Get enable Geo-redundant or not for server backup. Possible values include: 'Enabled', 'Disabled'. * * @return the geoRedundantBackup value */ @@ -63,7 +63,7 @@ public GeoRedundantBackup geoRedundantBackup() { } /** - * Set the geoRedundantBackup value. + * Set enable Geo-redundant or not for server backup. Possible values include: 'Enabled', 'Disabled'. * * @param geoRedundantBackup the geoRedundantBackup value to set * @return the StorageProfile object itself. @@ -74,7 +74,7 @@ public StorageProfile withGeoRedundantBackup(GeoRedundantBackup geoRedundantBack } /** - * Get the storageMB value. + * Get max storage allowed for a server. * * @return the storageMB value */ @@ -83,7 +83,7 @@ public Integer storageMB() { } /** - * Set the storageMB value. + * Set max storage allowed for a server. * * @param storageMB the storageMB value to set * @return the StorageProfile object itself. diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/VirtualNetworkRuleState.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/VirtualNetworkRuleState.java new file mode 100644 index 00000000000..b52cbd6ed70 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/VirtualNetworkRuleState.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.mysql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for VirtualNetworkRuleState. + */ +public final class VirtualNetworkRuleState extends ExpandableStringEnum { + /** Static value Initializing for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState INITIALIZING = fromString("Initializing"); + + /** Static value InProgress for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState IN_PROGRESS = fromString("InProgress"); + + /** Static value Ready for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState READY = fromString("Ready"); + + /** Static value Deleting for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState DELETING = fromString("Deleting"); + + /** Static value Unknown for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a VirtualNetworkRuleState from its string representation. + * @param name a name to look for + * @return the corresponding VirtualNetworkRuleState + */ + @JsonCreator + public static VirtualNetworkRuleState fromString(String name) { + return fromString(name, VirtualNetworkRuleState.class); + } + + /** + * @return known VirtualNetworkRuleState values + */ + public static Collection values() { + return values(VirtualNetworkRuleState.class); + } +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/CheckNameAvailabilitysInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/CheckNameAvailabilitysInner.java index 922cb25607f..b3b35578e8d 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/CheckNameAvailabilitysInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/CheckNameAvailabilitysInner.java @@ -11,6 +11,7 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.mysql.NameAvailabilityRequest; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; @@ -55,7 +56,7 @@ public CheckNameAvailabilitysInner(Retrofit retrofit, MySQLManagementClientImpl interface CheckNameAvailabilitysService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.mysql.CheckNameAvailabilitys execute" }) @POST("subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/checkNameAvailability") - Observable> execute(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body NameAvailabilityRequestInner nameAvailabilityRequest, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> execute(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body NameAvailabilityRequest nameAvailabilityRequest, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -68,7 +69,7 @@ interface CheckNameAvailabilitysService { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the NameAvailabilityInner object if successful. */ - public NameAvailabilityInner execute(NameAvailabilityRequestInner nameAvailabilityRequest) { + public NameAvailabilityInner execute(NameAvailabilityRequest nameAvailabilityRequest) { return executeWithServiceResponseAsync(nameAvailabilityRequest).toBlocking().single().body(); } @@ -80,7 +81,7 @@ public NameAvailabilityInner execute(NameAvailabilityRequestInner nameAvailabili * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture executeAsync(NameAvailabilityRequestInner nameAvailabilityRequest, final ServiceCallback serviceCallback) { + public ServiceFuture executeAsync(NameAvailabilityRequest nameAvailabilityRequest, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(executeWithServiceResponseAsync(nameAvailabilityRequest), serviceCallback); } @@ -91,7 +92,7 @@ public ServiceFuture executeAsync(NameAvailabilityRequest * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the NameAvailabilityInner object */ - public Observable executeAsync(NameAvailabilityRequestInner nameAvailabilityRequest) { + public Observable executeAsync(NameAvailabilityRequest nameAvailabilityRequest) { return executeWithServiceResponseAsync(nameAvailabilityRequest).map(new Func1, NameAvailabilityInner>() { @Override public NameAvailabilityInner call(ServiceResponse response) { @@ -107,7 +108,7 @@ public NameAvailabilityInner call(ServiceResponse respons * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the NameAvailabilityInner object */ - public Observable> executeWithServiceResponseAsync(NameAvailabilityRequestInner nameAvailabilityRequest) { + public Observable> executeWithServiceResponseAsync(NameAvailabilityRequest nameAvailabilityRequest) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationInner.java index 541e605c6aa..363d492ed9f 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationInner.java @@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; -import com.microsoft.azure.management.mysql.ProxyResource; +import com.microsoft.azure.ProxyResource; /** * Represents a Configuration. @@ -54,7 +54,7 @@ public class ConfigurationInner extends ProxyResource { private String source; /** - * Get the value value. + * Get value of the configuration. * * @return the value value */ @@ -63,7 +63,7 @@ public String value() { } /** - * Set the value value. + * Set value of the configuration. * * @param value the value value to set * @return the ConfigurationInner object itself. @@ -74,7 +74,7 @@ public ConfigurationInner withValue(String value) { } /** - * Get the description value. + * Get description of the configuration. * * @return the description value */ @@ -83,7 +83,7 @@ public String description() { } /** - * Get the defaultValue value. + * Get default value of the configuration. * * @return the defaultValue value */ @@ -92,7 +92,7 @@ public String defaultValue() { } /** - * Get the dataType value. + * Get data type of the configuration. * * @return the dataType value */ @@ -101,7 +101,7 @@ public String dataType() { } /** - * Get the allowedValues value. + * Get allowed values of the configuration. * * @return the allowedValues value */ @@ -110,7 +110,7 @@ public String allowedValues() { } /** - * Get the source value. + * Get source of the configuration. * * @return the source value */ @@ -119,7 +119,7 @@ public String source() { } /** - * Set the source value. + * Set source of the configuration. * * @param source the source value to set * @return the ConfigurationInner object itself. diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationsInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationsInner.java index c2dafd51ada..bc2a8fee5de 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationsInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ConfigurationsInner.java @@ -423,7 +423,11 @@ public Observable>> listByServerWithSer public Observable>> call(Response response) { try { ServiceResponse> result = listByServerDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabaseInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabaseInner.java index 2bfdc1dbd2d..9189f3deb3d 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabaseInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabaseInner.java @@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; -import com.microsoft.azure.management.mysql.ProxyResource; +import com.microsoft.azure.ProxyResource; /** * Represents a Database. @@ -30,7 +30,7 @@ public class DatabaseInner extends ProxyResource { private String collation; /** - * Get the charset value. + * Get the charset of the database. * * @return the charset value */ @@ -39,7 +39,7 @@ public String charset() { } /** - * Set the charset value. + * Set the charset of the database. * * @param charset the charset value to set * @return the DatabaseInner object itself. @@ -50,7 +50,7 @@ public DatabaseInner withCharset(String charset) { } /** - * Get the collation value. + * Get the collation of the database. * * @return the collation value */ @@ -59,7 +59,7 @@ public String collation() { } /** - * Set the collation value. + * Set the collation of the database. * * @param collation the collation value to set * @return the DatabaseInner object itself. diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabasesInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabasesInner.java index d7ba345f587..54550ac5527 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabasesInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/DatabasesInner.java @@ -602,7 +602,11 @@ public Observable>> listByServerWithServiceR public Observable>> call(Response response) { try { ServiceResponse> result = listByServerDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRuleInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRuleInner.java index 5269371f0ca..f09ac1da1d2 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRuleInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRuleInner.java @@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; -import com.microsoft.azure.management.mysql.ProxyResource; +import com.microsoft.azure.ProxyResource; /** * Represents a server firewall rule. @@ -30,7 +30,7 @@ public class FirewallRuleInner extends ProxyResource { private String endIpAddress; /** - * Get the startIpAddress value. + * Get the start IP address of the server firewall rule. Must be IPv4 format. * * @return the startIpAddress value */ @@ -39,7 +39,7 @@ public String startIpAddress() { } /** - * Set the startIpAddress value. + * Set the start IP address of the server firewall rule. Must be IPv4 format. * * @param startIpAddress the startIpAddress value to set * @return the FirewallRuleInner object itself. @@ -50,7 +50,7 @@ public FirewallRuleInner withStartIpAddress(String startIpAddress) { } /** - * Get the endIpAddress value. + * Get the end IP address of the server firewall rule. Must be IPv4 format. * * @return the endIpAddress value */ @@ -59,7 +59,7 @@ public String endIpAddress() { } /** - * Set the endIpAddress value. + * Set the end IP address of the server firewall rule. Must be IPv4 format. * * @param endIpAddress the endIpAddress value to set * @return the FirewallRuleInner object itself. diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRulesInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRulesInner.java index 2bc0d25566d..ac1ac0a051e 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRulesInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/FirewallRulesInner.java @@ -602,7 +602,11 @@ public Observable>> listByServerWithServ public Observable>> call(Response response) { try { ServiceResponse> result = listByServerDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LocationBasedPerformanceTiersInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LocationBasedPerformanceTiersInner.java index bf0848b0674..3dfc78212db 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LocationBasedPerformanceTiersInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LocationBasedPerformanceTiersInner.java @@ -122,7 +122,11 @@ public Observable>> listWit public Observable>> call(Response response) { try { ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFileInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFileInner.java index 3df2419be1b..e7662192e27 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFileInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFileInner.java @@ -11,7 +11,7 @@ import org.joda.time.DateTime; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; -import com.microsoft.azure.management.mysql.ProxyResource; +import com.microsoft.azure.ProxyResource; /** * Represents a log file. @@ -49,7 +49,7 @@ public class LogFileInner extends ProxyResource { private String url; /** - * Get the sizeInKB value. + * Get size of the log file. * * @return the sizeInKB value */ @@ -58,7 +58,7 @@ public Long sizeInKB() { } /** - * Set the sizeInKB value. + * Set size of the log file. * * @param sizeInKB the sizeInKB value to set * @return the LogFileInner object itself. @@ -69,7 +69,7 @@ public LogFileInner withSizeInKB(Long sizeInKB) { } /** - * Get the createdTime value. + * Get creation timestamp of the log file. * * @return the createdTime value */ @@ -78,7 +78,7 @@ public DateTime createdTime() { } /** - * Get the lastModifiedTime value. + * Get last modified timestamp of the log file. * * @return the lastModifiedTime value */ @@ -87,7 +87,7 @@ public DateTime lastModifiedTime() { } /** - * Get the logFileType value. + * Get type of the log file. * * @return the logFileType value */ @@ -96,7 +96,7 @@ public String logFileType() { } /** - * Set the logFileType value. + * Set type of the log file. * * @param logFileType the logFileType value to set * @return the LogFileInner object itself. @@ -107,7 +107,7 @@ public LogFileInner withLogFileType(String logFileType) { } /** - * Get the url value. + * Get the url to download the log file from. * * @return the url value */ @@ -116,7 +116,7 @@ public String url() { } /** - * Set the url value. + * Set the url to download the log file from. * * @param url the url value to set * @return the LogFileInner object itself. diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFilesInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFilesInner.java index 6d1f40062b7..e509b465d71 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFilesInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/LogFilesInner.java @@ -129,7 +129,11 @@ public Observable>> listByServerWithServiceRe public Observable>> call(Response response) { try { ServiceResponse> result = listByServerDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/MySQLManagementClientImpl.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/MySQLManagementClientImpl.java index 74be542dfad..5a68a9ae3e8 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/MySQLManagementClientImpl.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/MySQLManagementClientImpl.java @@ -145,6 +145,19 @@ public ServersInner servers() { return this.servers; } + /** + * The ReplicasInner object to access its operations. + */ + private ReplicasInner replicas; + + /** + * Gets the ReplicasInner object to access its operations. + * @return the ReplicasInner object. + */ + public ReplicasInner replicas() { + return this.replicas; + } + /** * The FirewallRulesInner object to access its operations. */ @@ -158,6 +171,19 @@ public FirewallRulesInner firewallRules() { return this.firewallRules; } + /** + * The VirtualNetworkRulesInner object to access its operations. + */ + private VirtualNetworkRulesInner virtualNetworkRules; + + /** + * Gets the VirtualNetworkRulesInner object to access its operations. + * @return the VirtualNetworkRulesInner object. + */ + public VirtualNetworkRulesInner virtualNetworkRules() { + return this.virtualNetworkRules; + } + /** * The DatabasesInner object to access its operations. */ @@ -272,7 +298,9 @@ protected void initialize() { this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; this.servers = new ServersInner(restClient().retrofit(), this); + this.replicas = new ReplicasInner(restClient().retrofit(), this); this.firewallRules = new FirewallRulesInner(restClient().retrofit(), this); + this.virtualNetworkRules = new VirtualNetworkRulesInner(restClient().retrofit(), this); this.databases = new DatabasesInner(restClient().retrofit(), this); this.configurations = new ConfigurationsInner(restClient().retrofit(), this); this.logFiles = new LogFilesInner(restClient().retrofit(), this); diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/NameAvailabilityInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/NameAvailabilityInner.java index 4784b024d90..3d9fa131eb4 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/NameAvailabilityInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/NameAvailabilityInner.java @@ -33,7 +33,7 @@ public class NameAvailabilityInner { private String reason; /** - * Get the message value. + * Get error Message. * * @return the message value */ @@ -42,7 +42,7 @@ public String message() { } /** - * Set the message value. + * Set error Message. * * @param message the message value to set * @return the NameAvailabilityInner object itself. @@ -53,7 +53,7 @@ public NameAvailabilityInner withMessage(String message) { } /** - * Get the nameAvailable value. + * Get indicates whether the resource name is available. * * @return the nameAvailable value */ @@ -62,7 +62,7 @@ public Boolean nameAvailable() { } /** - * Set the nameAvailable value. + * Set indicates whether the resource name is available. * * @param nameAvailable the nameAvailable value to set * @return the NameAvailabilityInner object itself. @@ -73,7 +73,7 @@ public NameAvailabilityInner withNameAvailable(Boolean nameAvailable) { } /** - * Get the reason value. + * Get reason for name being unavailable. * * @return the reason value */ @@ -82,7 +82,7 @@ public String reason() { } /** - * Set the reason value. + * Set reason for name being unavailable. * * @param reason the reason value to set * @return the NameAvailabilityInner object itself. diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationInner.java new file mode 100644 index 00000000000..d718c67021a --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationInner.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.mysql.implementation; + +import com.microsoft.azure.management.mysql.OperationDisplay; +import com.microsoft.azure.management.mysql.OperationOrigin; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API operation definition. + */ +public class OperationInner { + /** + * The name of the operation being performed on this particular object. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The localized display information for this particular operation or + * action. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /** + * The intended executor of the operation. Possible values include: + * 'NotSpecified', 'user', 'system'. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private OperationOrigin origin; + + /** + * Additional descriptions for the operation. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private Map properties; + + /** + * Get the name of the operation being performed on this particular object. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the localized display information for this particular operation or action. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the intended executor of the operation. Possible values include: 'NotSpecified', 'user', 'system'. + * + * @return the origin value + */ + public OperationOrigin origin() { + return this.origin; + } + + /** + * Get additional descriptions for the operation. + * + * @return the properties value + */ + public Map properties() { + return this.properties; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationListResultInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationListResultInner.java index 3a72c2b8e70..ccad003e962 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationListResultInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/OperationListResultInner.java @@ -9,7 +9,6 @@ package com.microsoft.azure.management.mysql.implementation; import java.util.List; -import com.microsoft.azure.management.mysql.Operation; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -20,24 +19,24 @@ public class OperationListResultInner { * The list of resource provider operations. */ @JsonProperty(value = "value") - private List value; + private List value; /** - * Get the value value. + * Get the list of resource provider operations. * * @return the value value */ - public List value() { + public List value() { return this.value; } /** - * Set the value value. + * Set the list of resource provider operations. * * @param value the value value to set * @return the OperationListResultInner object itself. */ - public OperationListResultInner withValue(List value) { + public OperationListResultInner withValue(List value) { this.value = value; return this; } diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PageImpl1.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PageImpl1.java new file mode 100644 index 00000000000..f4fa002a2cc --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PageImpl1.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.mysql.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 PageImpl1 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 PageImpl1 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 PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PerformanceTierPropertiesInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PerformanceTierPropertiesInner.java index 50742afab1a..a2a8fabfdde 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PerformanceTierPropertiesInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/PerformanceTierPropertiesInner.java @@ -29,7 +29,7 @@ public class PerformanceTierPropertiesInner { private List serviceLevelObjectives; /** - * Get the id value. + * Get iD of the performance tier. * * @return the id value */ @@ -38,7 +38,7 @@ public String id() { } /** - * Set the id value. + * Set iD of the performance tier. * * @param id the id value to set * @return the PerformanceTierPropertiesInner object itself. @@ -49,7 +49,7 @@ public PerformanceTierPropertiesInner withId(String id) { } /** - * Get the serviceLevelObjectives value. + * Get service level objectives associated with the performance tier. * * @return the serviceLevelObjectives value */ @@ -58,7 +58,7 @@ public List serviceLevelObjectives() { } /** - * Set the serviceLevelObjectives value. + * Set service level objectives associated with the performance tier. * * @param serviceLevelObjectives the serviceLevelObjectives value to set * @return the PerformanceTierPropertiesInner object itself. diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ReplicasInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ReplicasInner.java new file mode 100644 index 00000000000..b9846968cf4 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ReplicasInner.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.mysql.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 Replicas. + */ +public class ReplicasInner { + /** The Retrofit service to perform REST calls. */ + private ReplicasService service; + /** The service client containing this operation class. */ + private MySQLManagementClientImpl client; + + /** + * Initializes an instance of ReplicasInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReplicasInner(Retrofit retrofit, MySQLManagementClientImpl client) { + this.service = retrofit.create(ReplicasService.class); + this.client = client; + } + + /** + * The interface defining all the services for Replicas to be + * used by Retrofit to perform actually REST calls. + */ + interface ReplicasService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.mysql.Replicas listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/Replicas") + 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); + + } + + /** + * List all the replicas 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. + * @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<ServerInner> object if successful. + */ + public List listByServer(String resourceGroupName, String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); + } + + /** + * List all the replicas 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 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); + } + + /** + * List all the replicas 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ServerInner> 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(); + } + }); + } + + /** + * List all the replicas 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ServerInner> 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/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerInner.java index 0d7272022ff..68f904a32a0 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServerInner.java @@ -16,13 +16,12 @@ import com.microsoft.azure.management.mysql.StorageProfile; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; -import com.microsoft.azure.management.mysql.TrackedResource; /** * Represents a server. */ @JsonFlatten -public class ServerInner extends TrackedResource { +public class ServerInner extends TrackedResourceInner { /** * The SKU (pricing tier) of the server. */ @@ -75,7 +74,25 @@ public class ServerInner extends TrackedResource { private StorageProfile storageProfile; /** - * Get the sku value. + * The replication role of the server. + */ + @JsonProperty(value = "properties.replicationRole") + private String replicationRole; + + /** + * The primary server id of a relica server. + */ + @JsonProperty(value = "properties.primaryServerId") + private String primaryServerId; + + /** + * The maximum number of replicas that a primary server can have. + */ + @JsonProperty(value = "properties.replicaCapacity") + private Integer replicaCapacity; + + /** + * Get the SKU (pricing tier) of the server. * * @return the sku value */ @@ -84,7 +101,7 @@ public Sku sku() { } /** - * Set the sku value. + * Set the SKU (pricing tier) of the server. * * @param sku the sku value to set * @return the ServerInner object itself. @@ -95,7 +112,7 @@ public ServerInner withSku(Sku sku) { } /** - * Get the administratorLogin value. + * Get the administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). * * @return the administratorLogin value */ @@ -104,7 +121,7 @@ public String administratorLogin() { } /** - * Set the administratorLogin value. + * Set the administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). * * @param administratorLogin the administratorLogin value to set * @return the ServerInner object itself. @@ -115,7 +132,7 @@ public ServerInner withAdministratorLogin(String administratorLogin) { } /** - * Get the version value. + * Get server version. Possible values include: '5.6', '5.7'. * * @return the version value */ @@ -124,7 +141,7 @@ public ServerVersion version() { } /** - * Set the version value. + * Set server version. Possible values include: '5.6', '5.7'. * * @param version the version value to set * @return the ServerInner object itself. @@ -135,7 +152,7 @@ public ServerInner withVersion(ServerVersion version) { } /** - * Get the sslEnforcement value. + * Get enable ssl enforcement or not when connect to server. Possible values include: 'Enabled', 'Disabled'. * * @return the sslEnforcement value */ @@ -144,7 +161,7 @@ public SslEnforcementEnum sslEnforcement() { } /** - * Set the sslEnforcement value. + * Set enable ssl enforcement or not when connect to server. Possible values include: 'Enabled', 'Disabled'. * * @param sslEnforcement the sslEnforcement value to set * @return the ServerInner object itself. @@ -155,7 +172,7 @@ public ServerInner withSslEnforcement(SslEnforcementEnum sslEnforcement) { } /** - * Get the userVisibleState value. + * Get a state of a server that is visible to user. Possible values include: 'Ready', 'Dropping', 'Disabled'. * * @return the userVisibleState value */ @@ -164,7 +181,7 @@ public ServerState userVisibleState() { } /** - * Set the userVisibleState value. + * Set a state of a server that is visible to user. Possible values include: 'Ready', 'Dropping', 'Disabled'. * * @param userVisibleState the userVisibleState value to set * @return the ServerInner object itself. @@ -175,7 +192,7 @@ public ServerInner withUserVisibleState(ServerState userVisibleState) { } /** - * Get the fullyQualifiedDomainName value. + * Get the fully qualified domain name of a server. * * @return the fullyQualifiedDomainName value */ @@ -184,7 +201,7 @@ public String fullyQualifiedDomainName() { } /** - * Set the fullyQualifiedDomainName value. + * Set the fully qualified domain name of a server. * * @param fullyQualifiedDomainName the fullyQualifiedDomainName value to set * @return the ServerInner object itself. @@ -195,7 +212,7 @@ public ServerInner withFullyQualifiedDomainName(String fullyQualifiedDomainName) } /** - * Get the earliestRestoreDate value. + * Get earliest restore point creation time (ISO8601 format). * * @return the earliestRestoreDate value */ @@ -204,7 +221,7 @@ public DateTime earliestRestoreDate() { } /** - * Set the earliestRestoreDate value. + * Set earliest restore point creation time (ISO8601 format). * * @param earliestRestoreDate the earliestRestoreDate value to set * @return the ServerInner object itself. @@ -215,7 +232,7 @@ public ServerInner withEarliestRestoreDate(DateTime earliestRestoreDate) { } /** - * Get the storageProfile value. + * Get storage profile of a server. * * @return the storageProfile value */ @@ -224,7 +241,7 @@ public StorageProfile storageProfile() { } /** - * Set the storageProfile value. + * Set storage profile of a server. * * @param storageProfile the storageProfile value to set * @return the ServerInner object itself. @@ -234,4 +251,64 @@ public ServerInner withStorageProfile(StorageProfile storageProfile) { return this; } + /** + * Get the replication role of the server. + * + * @return the replicationRole value + */ + public String replicationRole() { + return this.replicationRole; + } + + /** + * Set the replication role of the server. + * + * @param replicationRole the replicationRole value to set + * @return the ServerInner object itself. + */ + public ServerInner withReplicationRole(String replicationRole) { + this.replicationRole = replicationRole; + return this; + } + + /** + * Get the primary server id of a relica server. + * + * @return the primaryServerId value + */ + public String primaryServerId() { + return this.primaryServerId; + } + + /** + * Set the primary server id of a relica server. + * + * @param primaryServerId the primaryServerId value to set + * @return the ServerInner object itself. + */ + public ServerInner withPrimaryServerId(String primaryServerId) { + this.primaryServerId = primaryServerId; + return this; + } + + /** + * Get the maximum number of replicas that a primary server can have. + * + * @return the replicaCapacity value + */ + public Integer replicaCapacity() { + return this.replicaCapacity; + } + + /** + * Set the maximum number of replicas that a primary server can have. + * + * @param replicaCapacity the replicaCapacity value to set + * @return the ServerInner object itself. + */ + public ServerInner withReplicaCapacity(Integer replicaCapacity) { + this.replicaCapacity = replicaCapacity; + return this; + } + } diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServersInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServersInner.java index bd709b75f82..97218535da7 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServersInner.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/ServersInner.java @@ -14,6 +14,8 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.mysql.ServerForCreate; +import com.microsoft.azure.management.mysql.ServerUpdateParameters; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -64,19 +66,19 @@ public ServersInner(Retrofit retrofit, MySQLManagementClientImpl client) { interface ServersService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.mysql.Servers create" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}") - Observable> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerForCreateInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerForCreate 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.mysql.Servers beginCreate" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}") - Observable> beginCreate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerForCreateInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginCreate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerForCreate 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.mysql.Servers update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}") - Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerUpdateParametersInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerUpdateParameters 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.mysql.Servers beginUpdate" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}") - Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerUpdateParametersInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ServerUpdateParameters 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.mysql.Servers delete" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}", method = "DELETE", hasBody = true) @@ -111,7 +113,7 @@ interface ServersService { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ServerInner object if successful. */ - public ServerInner create(String resourceGroupName, String serverName, ServerForCreateInner parameters) { + public ServerInner create(String resourceGroupName, String serverName, ServerForCreate parameters) { return createWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); } @@ -125,7 +127,7 @@ public ServerInner create(String resourceGroupName, String serverName, ServerFor * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture createAsync(String resourceGroupName, String serverName, ServerForCreateInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture createAsync(String resourceGroupName, String serverName, ServerForCreate parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); } @@ -138,7 +140,7 @@ public ServiceFuture createAsync(String resourceGroupName, String s * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable createAsync(String resourceGroupName, String serverName, ServerForCreateInner parameters) { + public Observable createAsync(String resourceGroupName, String serverName, ServerForCreate parameters) { return createWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { @Override public ServerInner call(ServiceResponse response) { @@ -156,7 +158,7 @@ public ServerInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> createWithServiceResponseAsync(String resourceGroupName, String serverName, ServerForCreateInner parameters) { + public Observable> createWithServiceResponseAsync(String resourceGroupName, String serverName, ServerForCreate parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -188,7 +190,7 @@ public Observable> createWithServiceResponseAsync(S * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ServerInner object if successful. */ - public ServerInner beginCreate(String resourceGroupName, String serverName, ServerForCreateInner parameters) { + public ServerInner beginCreate(String resourceGroupName, String serverName, ServerForCreate parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); } @@ -202,7 +204,7 @@ public ServerInner beginCreate(String resourceGroupName, String serverName, Serv * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginCreateAsync(String resourceGroupName, String serverName, ServerForCreateInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture beginCreateAsync(String resourceGroupName, String serverName, ServerForCreate parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); } @@ -215,7 +217,7 @@ public ServiceFuture beginCreateAsync(String resourceGroupName, Str * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ServerInner object */ - public Observable beginCreateAsync(String resourceGroupName, String serverName, ServerForCreateInner parameters) { + public Observable beginCreateAsync(String resourceGroupName, String serverName, ServerForCreate parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { @Override public ServerInner call(ServiceResponse response) { @@ -233,7 +235,7 @@ public ServerInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ServerInner object */ - public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerForCreateInner parameters) { + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerForCreate parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -284,7 +286,7 @@ private ServiceResponse beginCreateDelegate(Response * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ServerInner object if successful. */ - public ServerInner update(String resourceGroupName, String serverName, ServerUpdateParametersInner parameters) { + public ServerInner update(String resourceGroupName, String serverName, ServerUpdateParameters parameters) { return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); } @@ -298,7 +300,7 @@ public ServerInner update(String resourceGroupName, String serverName, ServerUpd * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String resourceGroupName, String serverName, ServerUpdateParametersInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture updateAsync(String resourceGroupName, String serverName, ServerUpdateParameters parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); } @@ -311,7 +313,7 @@ public ServiceFuture updateAsync(String resourceGroupName, String s * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable updateAsync(String resourceGroupName, String serverName, ServerUpdateParametersInner parameters) { + public Observable updateAsync(String resourceGroupName, String serverName, ServerUpdateParameters parameters) { return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { @Override public ServerInner call(ServiceResponse response) { @@ -329,7 +331,7 @@ public ServerInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdateParametersInner parameters) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdateParameters parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -361,7 +363,7 @@ public Observable> updateWithServiceResponseAsync(S * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ServerInner object if successful. */ - public ServerInner beginUpdate(String resourceGroupName, String serverName, ServerUpdateParametersInner parameters) { + public ServerInner beginUpdate(String resourceGroupName, String serverName, ServerUpdateParameters parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); } @@ -375,7 +377,7 @@ public ServerInner beginUpdate(String resourceGroupName, String serverName, Serv * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdateParametersInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdateParameters parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); } @@ -388,7 +390,7 @@ public ServiceFuture beginUpdateAsync(String resourceGroupName, Str * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ServerInner object */ - public Observable beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdateParametersInner parameters) { + public Observable beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdateParameters parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { @Override public ServerInner call(ServiceResponse response) { @@ -406,7 +408,7 @@ public ServerInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ServerInner object */ - public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdateParametersInner parameters) { + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdateParameters parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -754,7 +756,11 @@ public Observable>> listByResourceGroupWithSer public Observable>> call(Response response) { try { ServiceResponse> result = listByResourceGroupDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); @@ -831,7 +837,11 @@ public Observable>> listWithServiceResponseAsy public Observable>> call(Response response) { try { ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/TrackedResourceInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/TrackedResourceInner.java new file mode 100644 index 00000000000..7af9e738952 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/TrackedResourceInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql.implementation; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.ProxyResource; + +/** + * Resource properties including location and tags for track resources. + */ +public class TrackedResourceInner extends ProxyResource { + /** + * The location the resource resides in. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Application-specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the location the resource resides in. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location the resource resides in. + * + * @param location the location value to set + * @return the TrackedResourceInner object itself. + */ + public TrackedResourceInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get application-specific metadata in the form of key-value pairs. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set application-specific metadata in the form of key-value pairs. + * + * @param tags the tags value to set + * @return the TrackedResourceInner object itself. + */ + public TrackedResourceInner withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/VirtualNetworkRuleInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/VirtualNetworkRuleInner.java new file mode 100644 index 00000000000..28b54226711 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/VirtualNetworkRuleInner.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.mysql.implementation; + +import com.microsoft.azure.management.mysql.VirtualNetworkRuleState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A virtual network rule. + */ +@JsonFlatten +public class VirtualNetworkRuleInner extends ProxyResource { + /** + * The ARM resource id of the virtual network subnet. + */ + @JsonProperty(value = "properties.virtualNetworkSubnetId", required = true) + private String virtualNetworkSubnetId; + + /** + * Create firewall rule before the virtual network has vnet service + * endpoint enabled. + */ + @JsonProperty(value = "properties.ignoreMissingVnetServiceEndpoint") + private Boolean ignoreMissingVnetServiceEndpoint; + + /** + * Virtual Network Rule State. Possible values include: 'Initializing', + * 'InProgress', 'Ready', 'Deleting', 'Unknown'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private VirtualNetworkRuleState state; + + /** + * Get the ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value + */ + public String virtualNetworkSubnetId() { + return this.virtualNetworkSubnetId; + } + + /** + * Set the ARM resource id of the virtual network subnet. + * + * @param virtualNetworkSubnetId the virtualNetworkSubnetId value to set + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.virtualNetworkSubnetId = virtualNetworkSubnetId; + return this; + } + + /** + * Get create firewall rule before the virtual network has vnet service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.ignoreMissingVnetServiceEndpoint; + } + + /** + * Set create firewall rule before the virtual network has vnet service endpoint enabled. + * + * @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + return this; + } + + /** + * Get virtual Network Rule State. Possible values include: 'Initializing', 'InProgress', 'Ready', 'Deleting', 'Unknown'. + * + * @return the state value + */ + public VirtualNetworkRuleState state() { + return this.state; + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/VirtualNetworkRulesInner.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/VirtualNetworkRulesInner.java new file mode 100644 index 00000000000..63558d39366 --- /dev/null +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/VirtualNetworkRulesInner.java @@ -0,0 +1,777 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.mysql.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.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 VirtualNetworkRules. + */ +public class VirtualNetworkRulesInner { + /** The Retrofit service to perform REST calls. */ + private VirtualNetworkRulesService service; + /** The service client containing this operation class. */ + private MySQLManagementClientImpl client; + + /** + * Initializes an instance of VirtualNetworkRulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public VirtualNetworkRulesInner(Retrofit retrofit, MySQLManagementClientImpl client) { + this.service = retrofit.create(VirtualNetworkRulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for VirtualNetworkRules to be + * used by Retrofit to perform actually REST calls. + */ + interface VirtualNetworkRulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.mysql.VirtualNetworkRules get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @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.mysql.VirtualNetworkRules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @Query("api-version") String apiVersion, @Body VirtualNetworkRuleInner 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.mysql.VirtualNetworkRules beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @Query("api-version") String apiVersion, @Body VirtualNetworkRuleInner 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.mysql.VirtualNetworkRules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @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.mysql.VirtualNetworkRules beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @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.mysql.VirtualNetworkRules listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/virtualNetworkRules") + 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.mysql.VirtualNetworkRules listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a virtual network 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 virtualNetworkRuleName The name of the virtual network 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 VirtualNetworkRuleInner object if successful. + */ + public VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).toBlocking().single().body(); + } + + /** + * Gets a virtual network 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 virtualNetworkRuleName The name of the virtual network 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 virtualNetworkRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName), serviceCallback); + } + + /** + * Gets a virtual network 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).map(new Func1, VirtualNetworkRuleInner>() { + @Override + public VirtualNetworkRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a virtual network 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 virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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, this.client.subscriptionId(), virtualNetworkRuleName, 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 existing virtual network 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule 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 VirtualNetworkRuleInner object if successful. + */ + public VirtualNetworkRuleInner createOrUpdate(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an existing virtual network 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule 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 virtualNetworkRuleName, VirtualNetworkRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters), serviceCallback); + } + + /** + * Creates or updates an existing virtual network 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).map(new Func1, VirtualNetworkRuleInner>() { + @Override + public VirtualNetworkRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an existing virtual network 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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(resourceGroupName, serverName, this.client.subscriptionId(), virtualNetworkRuleName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates an existing virtual network 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule 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 VirtualNetworkRuleInner object if successful. + */ + public VirtualNetworkRuleInner beginCreateOrUpdate(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an existing virtual network 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule 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 virtualNetworkRuleName, VirtualNetworkRuleInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters), serviceCallback); + } + + /** + * Creates or updates an existing virtual network 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).map(new Func1, VirtualNetworkRuleInner>() { + @Override + public VirtualNetworkRuleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an existing virtual network 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 virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkRuleInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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(resourceGroupName, serverName, this.client.subscriptionId(), virtualNetworkRuleName, 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); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 virtualNetworkRuleName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).toBlocking().last().body(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 virtualNetworkRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName), serviceCallback); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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, virtualNetworkRuleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 beginDelete(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).toBlocking().single().body(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 beginDeleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName), serviceCallback); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + 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 (virtualNetworkRuleName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkRuleName 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, virtualNetworkRuleName, 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); + } + + /** + * Gets a list of virtual network rules 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<VirtualNetworkRuleInner> 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 virtual network rules 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 a list of virtual network rules 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<VirtualNetworkRuleInner> 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 virtual network rules 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<VirtualNetworkRuleInner> 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 virtual network rules 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualNetworkRuleInner> 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 list of virtual network rules 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<VirtualNetworkRuleInner> 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 virtual network rules 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 a list of virtual network rules 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<VirtualNetworkRuleInner> 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 virtual network rules 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<VirtualNetworkRuleInner> 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 virtual network rules 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<VirtualNetworkRuleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByServerNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServerNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/package-info.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/package-info.java index 6f2c80f498d..af66f21dbed 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/package-info.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/implementation/package-info.java @@ -6,6 +6,6 @@ /** * This package contains the implementation classes for MySQLManagementClient. - * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, log files and configurations with new business model. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations with new business model. */ package com.microsoft.azure.management.mysql.implementation; diff --git a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/package-info.java b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/package-info.java index 29884a80476..368d90602f7 100644 --- a/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/package-info.java +++ b/azure-mgmt-mysql/src/main/java/com/microsoft/azure/management/mysql/package-info.java @@ -6,6 +6,6 @@ /** * This package contains the classes for MySQLManagementClient. - * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, log files and configurations with new business model. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, log files and configurations with new business model. */ package com.microsoft.azure.management.mysql;