diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/CredentialDataFormat.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/CredentialDataFormat.java new file mode 100644 index 00000000000..65f04a470dd --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/CredentialDataFormat.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.servermanagement; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CredentialDataFormat. + */ +public enum CredentialDataFormat { + /** Enum value RsaEncrypted. */ + RSA_ENCRYPTED("RsaEncrypted"); + + /** The actual serialized value for a CredentialDataFormat instance. */ + private String value; + + CredentialDataFormat(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CredentialDataFormat instance. + * + * @param value the serialized value to parse. + * @return the parsed CredentialDataFormat object, or null if unable to parse. + */ + @JsonCreator + public static CredentialDataFormat fromString(String value) { + CredentialDataFormat[] items = CredentialDataFormat.values(); + for (CredentialDataFormat item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/EncryptionJwkResource.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/EncryptionJwkResource.java new file mode 100644 index 00000000000..5c6324a8846 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/EncryptionJwkResource.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The public key of the gateway. + */ +public class EncryptionJwkResource { + /** + * The kty property. + */ + @JsonProperty(value = "kty") + private String kty; + + /** + * The alg property. + */ + @JsonProperty(value = "alg") + private String alg; + + /** + * The e property. + */ + @JsonProperty(value = "e") + private String e; + + /** + * The n property. + */ + @JsonProperty(value = "n") + private String n; + + /** + * Get the kty value. + * + * @return the kty value + */ + public String kty() { + return this.kty; + } + + /** + * Set the kty value. + * + * @param kty the kty value to set + * @return the EncryptionJwkResource object itself. + */ + public EncryptionJwkResource withKty(String kty) { + this.kty = kty; + return this; + } + + /** + * Get the alg value. + * + * @return the alg value + */ + public String alg() { + return this.alg; + } + + /** + * Set the alg value. + * + * @param alg the alg value to set + * @return the EncryptionJwkResource object itself. + */ + public EncryptionJwkResource withAlg(String alg) { + this.alg = alg; + return this; + } + + /** + * Get the e value. + * + * @return the e value + */ + public String e() { + return this.e; + } + + /** + * Set the e value. + * + * @param e the e value to set + * @return the EncryptionJwkResource object itself. + */ + public EncryptionJwkResource withE(String e) { + this.e = e; + return this; + } + + /** + * Get the n value. + * + * @return the n value + */ + public String n() { + return this.n; + } + + /** + * Set the n value. + * + * @param n the n value to set + * @return the EncryptionJwkResource object itself. + */ + public EncryptionJwkResource withN(String n) { + this.n = n; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/Error.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/Error.java new file mode 100644 index 00000000000..9185f9a0de2 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/Error.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.servermanagement; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error message. + */ +public class Error { + /** + * The code property. + */ + @JsonProperty(value = "code") + private Integer code; + + /** + * The message property. + */ + @JsonProperty(value = "message") + private String message; + + /** + * The fields property. + */ + @JsonProperty(value = "fields") + private String fields; + + /** + * Get the code value. + * + * @return the code value + */ + public Integer code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the Error object itself. + */ + public Error withCode(Integer code) { + this.code = code; + return this; + } + + /** + * 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 Error object itself. + */ + public Error withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the fields value. + * + * @return the fields value + */ + public String fields() { + return this.fields; + } + + /** + * Set the fields value. + * + * @param fields the fields value to set + * @return the Error object itself. + */ + public Error withFields(String fields) { + this.fields = fields; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/ErrorException.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/ErrorException.java new file mode 100644 index 00000000000..b26afaa3147 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/ErrorException.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.servermanagement; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with Error information. + */ +public class ErrorException extends RestException { + /** + * Initializes a new instance of the ErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorException(final String message, final Response response, final Error body) { + super(message, response, body); + } + + @Override + public Error body() { + return (Error) super.body(); + } +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/GatewayExpandOption.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/GatewayExpandOption.java new file mode 100644 index 00000000000..ea0deccd564 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/GatewayExpandOption.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.servermanagement; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for GatewayExpandOption. + */ +public enum GatewayExpandOption { + /** Enum value status. */ + STATUS("status"), + + /** Enum value download. */ + DOWNLOAD("download"); + + /** The actual serialized value for a GatewayExpandOption instance. */ + private String value; + + GatewayExpandOption(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a GatewayExpandOption instance. + * + * @param value the serialized value to parse. + * @return the parsed GatewayExpandOption object, or null if unable to parse. + */ + @JsonCreator + public static GatewayExpandOption fromString(String value) { + GatewayExpandOption[] items = GatewayExpandOption.values(); + for (GatewayExpandOption item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/GatewayParameters.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/GatewayParameters.java new file mode 100644 index 00000000000..735119fd854 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/GatewayParameters.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Collection of parameters for operations on a gateway resource. + */ +@JsonFlatten +public class GatewayParameters { + /** + * Location of the resource. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Object tags; + + /** + * The upgradeMode property gives the flexibility to gateway to auto + * upgrade itself. If properties value not specified, then we assume + * upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic'. + */ + @JsonProperty(value = "properties.upgradeMode") + private UpgradeMode upgradeMode; + + /** + * Get location of the resource. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location of the resource. + * + * @param location the location value to set + * @return the GatewayParameters object itself. + */ + public GatewayParameters withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Object tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the GatewayParameters object itself. + */ + public GatewayParameters withTags(Object tags) { + this.tags = tags; + return this; + } + + /** + * Get the upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic'. + * + * @return the upgradeMode value + */ + public UpgradeMode upgradeMode() { + return this.upgradeMode; + } + + /** + * Set the upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic'. + * + * @param upgradeMode the upgradeMode value to set + * @return the GatewayParameters object itself. + */ + public GatewayParameters withUpgradeMode(UpgradeMode upgradeMode) { + this.upgradeMode = upgradeMode; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/GatewayStatus.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/GatewayStatus.java new file mode 100644 index 00000000000..34bdff34ee8 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/GatewayStatus.java @@ -0,0 +1,565 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Expanded gateway status information. + */ +public class GatewayStatus { + /** + * The available memory on the gateway host machine in megabytes. + */ + @JsonProperty(value = "availableMemoryMByte") + private Double availableMemoryMByte; + + /** + * The CPU utilization of the gateway process (numeric value between 0 and + * 100). + */ + @JsonProperty(value = "gatewayCpuUtilizationPercent") + private Double gatewayCpuUtilizationPercent; + + /** + * CPU Utilization of the whole system. + */ + @JsonProperty(value = "totalCpuUtilizationPercent") + private Double totalCpuUtilizationPercent; + + /** + * The version of the gateway that is installed on the system. + */ + @JsonProperty(value = "gatewayVersion") + private String gatewayVersion; + + /** + * The Plaintext description of the OS on the gateway. + */ + @JsonProperty(value = "friendlyOsName") + private String friendlyOsName; + + /** + * The date the gateway was installed. + */ + @JsonProperty(value = "installedDate") + private DateTime installedDate; + + /** + * Number of logical processors in the gateway system. + */ + @JsonProperty(value = "logicalProcessorCount") + private Integer logicalProcessorCount; + + /** + * The computer name of the gateway system. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The gateway resource ID. + */ + @JsonProperty(value = "gatewayId") + private String gatewayId; + + /** + * The working set size of the gateway process in megabytes. + */ + @JsonProperty(value = "gatewayWorkingSetMByte") + private Double gatewayWorkingSetMByte; + + /** + * UTC date and time when gateway status was last updated. + */ + @JsonProperty(value = "statusUpdated") + private DateTime statusUpdated; + + /** + * The group policy error. + */ + @JsonProperty(value = "groupPolicyError") + private String groupPolicyError; + + /** + * Status of the allowGatewayGroupPolicy setting. + */ + @JsonProperty(value = "allowGatewayGroupPolicyStatus") + private Boolean allowGatewayGroupPolicyStatus; + + /** + * Status of the requireMfaGroupPolicy setting. + */ + @JsonProperty(value = "requireMfaGroupPolicyStatus") + private Boolean requireMfaGroupPolicyStatus; + + /** + * Thumbprint of the encryption certificate. + */ + @JsonProperty(value = "encryptionCertificateThumbprint") + private String encryptionCertificateThumbprint; + + /** + * Secondary thumbprint of the encryption certificate. + */ + @JsonProperty(value = "secondaryEncryptionCertificateThumbprint") + private String secondaryEncryptionCertificateThumbprint; + + /** + * The encryption certificate key. + */ + @JsonProperty(value = "encryptionJwk") + private EncryptionJwkResource encryptionJwk; + + /** + * The secondary encryption certificate key. + */ + @JsonProperty(value = "secondaryEncryptionJwk") + private EncryptionJwkResource secondaryEncryptionJwk; + + /** + * Active message count. + */ + @JsonProperty(value = "activeMessageCount") + private Integer activeMessageCount; + + /** + * Latest published version of the gateway install MSI. + */ + @JsonProperty(value = "latestPublishedMsiVersion") + private String latestPublishedMsiVersion; + + /** + * Gateway install MSI published time. + */ + @JsonProperty(value = "publishedTimeUtc") + private DateTime publishedTimeUtc; + + /** + * Get the available memory on the gateway host machine in megabytes. + * + * @return the availableMemoryMByte value + */ + public Double availableMemoryMByte() { + return this.availableMemoryMByte; + } + + /** + * Set the available memory on the gateway host machine in megabytes. + * + * @param availableMemoryMByte the availableMemoryMByte value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withAvailableMemoryMByte(Double availableMemoryMByte) { + this.availableMemoryMByte = availableMemoryMByte; + return this; + } + + /** + * Get the CPU utilization of the gateway process (numeric value between 0 and 100). + * + * @return the gatewayCpuUtilizationPercent value + */ + public Double gatewayCpuUtilizationPercent() { + return this.gatewayCpuUtilizationPercent; + } + + /** + * Set the CPU utilization of the gateway process (numeric value between 0 and 100). + * + * @param gatewayCpuUtilizationPercent the gatewayCpuUtilizationPercent value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withGatewayCpuUtilizationPercent(Double gatewayCpuUtilizationPercent) { + this.gatewayCpuUtilizationPercent = gatewayCpuUtilizationPercent; + return this; + } + + /** + * Get cPU Utilization of the whole system. + * + * @return the totalCpuUtilizationPercent value + */ + public Double totalCpuUtilizationPercent() { + return this.totalCpuUtilizationPercent; + } + + /** + * Set cPU Utilization of the whole system. + * + * @param totalCpuUtilizationPercent the totalCpuUtilizationPercent value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withTotalCpuUtilizationPercent(Double totalCpuUtilizationPercent) { + this.totalCpuUtilizationPercent = totalCpuUtilizationPercent; + return this; + } + + /** + * Get the version of the gateway that is installed on the system. + * + * @return the gatewayVersion value + */ + public String gatewayVersion() { + return this.gatewayVersion; + } + + /** + * Set the version of the gateway that is installed on the system. + * + * @param gatewayVersion the gatewayVersion value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withGatewayVersion(String gatewayVersion) { + this.gatewayVersion = gatewayVersion; + return this; + } + + /** + * Get the Plaintext description of the OS on the gateway. + * + * @return the friendlyOsName value + */ + public String friendlyOsName() { + return this.friendlyOsName; + } + + /** + * Set the Plaintext description of the OS on the gateway. + * + * @param friendlyOsName the friendlyOsName value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withFriendlyOsName(String friendlyOsName) { + this.friendlyOsName = friendlyOsName; + return this; + } + + /** + * Get the date the gateway was installed. + * + * @return the installedDate value + */ + public DateTime installedDate() { + return this.installedDate; + } + + /** + * Set the date the gateway was installed. + * + * @param installedDate the installedDate value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withInstalledDate(DateTime installedDate) { + this.installedDate = installedDate; + return this; + } + + /** + * Get number of logical processors in the gateway system. + * + * @return the logicalProcessorCount value + */ + public Integer logicalProcessorCount() { + return this.logicalProcessorCount; + } + + /** + * Set number of logical processors in the gateway system. + * + * @param logicalProcessorCount the logicalProcessorCount value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withLogicalProcessorCount(Integer logicalProcessorCount) { + this.logicalProcessorCount = logicalProcessorCount; + return this; + } + + /** + * Get the computer name of the gateway system. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the computer name of the gateway system. + * + * @param name the name value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withName(String name) { + this.name = name; + return this; + } + + /** + * Get the gateway resource ID. + * + * @return the gatewayId value + */ + public String gatewayId() { + return this.gatewayId; + } + + /** + * Set the gateway resource ID. + * + * @param gatewayId the gatewayId value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + return this; + } + + /** + * Get the working set size of the gateway process in megabytes. + * + * @return the gatewayWorkingSetMByte value + */ + public Double gatewayWorkingSetMByte() { + return this.gatewayWorkingSetMByte; + } + + /** + * Set the working set size of the gateway process in megabytes. + * + * @param gatewayWorkingSetMByte the gatewayWorkingSetMByte value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withGatewayWorkingSetMByte(Double gatewayWorkingSetMByte) { + this.gatewayWorkingSetMByte = gatewayWorkingSetMByte; + return this; + } + + /** + * Get uTC date and time when gateway status was last updated. + * + * @return the statusUpdated value + */ + public DateTime statusUpdated() { + return this.statusUpdated; + } + + /** + * Set uTC date and time when gateway status was last updated. + * + * @param statusUpdated the statusUpdated value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withStatusUpdated(DateTime statusUpdated) { + this.statusUpdated = statusUpdated; + return this; + } + + /** + * Get the group policy error. + * + * @return the groupPolicyError value + */ + public String groupPolicyError() { + return this.groupPolicyError; + } + + /** + * Set the group policy error. + * + * @param groupPolicyError the groupPolicyError value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withGroupPolicyError(String groupPolicyError) { + this.groupPolicyError = groupPolicyError; + return this; + } + + /** + * Get status of the allowGatewayGroupPolicy setting. + * + * @return the allowGatewayGroupPolicyStatus value + */ + public Boolean allowGatewayGroupPolicyStatus() { + return this.allowGatewayGroupPolicyStatus; + } + + /** + * Set status of the allowGatewayGroupPolicy setting. + * + * @param allowGatewayGroupPolicyStatus the allowGatewayGroupPolicyStatus value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withAllowGatewayGroupPolicyStatus(Boolean allowGatewayGroupPolicyStatus) { + this.allowGatewayGroupPolicyStatus = allowGatewayGroupPolicyStatus; + return this; + } + + /** + * Get status of the requireMfaGroupPolicy setting. + * + * @return the requireMfaGroupPolicyStatus value + */ + public Boolean requireMfaGroupPolicyStatus() { + return this.requireMfaGroupPolicyStatus; + } + + /** + * Set status of the requireMfaGroupPolicy setting. + * + * @param requireMfaGroupPolicyStatus the requireMfaGroupPolicyStatus value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withRequireMfaGroupPolicyStatus(Boolean requireMfaGroupPolicyStatus) { + this.requireMfaGroupPolicyStatus = requireMfaGroupPolicyStatus; + return this; + } + + /** + * Get thumbprint of the encryption certificate. + * + * @return the encryptionCertificateThumbprint value + */ + public String encryptionCertificateThumbprint() { + return this.encryptionCertificateThumbprint; + } + + /** + * Set thumbprint of the encryption certificate. + * + * @param encryptionCertificateThumbprint the encryptionCertificateThumbprint value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withEncryptionCertificateThumbprint(String encryptionCertificateThumbprint) { + this.encryptionCertificateThumbprint = encryptionCertificateThumbprint; + return this; + } + + /** + * Get secondary thumbprint of the encryption certificate. + * + * @return the secondaryEncryptionCertificateThumbprint value + */ + public String secondaryEncryptionCertificateThumbprint() { + return this.secondaryEncryptionCertificateThumbprint; + } + + /** + * Set secondary thumbprint of the encryption certificate. + * + * @param secondaryEncryptionCertificateThumbprint the secondaryEncryptionCertificateThumbprint value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withSecondaryEncryptionCertificateThumbprint(String secondaryEncryptionCertificateThumbprint) { + this.secondaryEncryptionCertificateThumbprint = secondaryEncryptionCertificateThumbprint; + return this; + } + + /** + * Get the encryption certificate key. + * + * @return the encryptionJwk value + */ + public EncryptionJwkResource encryptionJwk() { + return this.encryptionJwk; + } + + /** + * Set the encryption certificate key. + * + * @param encryptionJwk the encryptionJwk value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withEncryptionJwk(EncryptionJwkResource encryptionJwk) { + this.encryptionJwk = encryptionJwk; + return this; + } + + /** + * Get the secondary encryption certificate key. + * + * @return the secondaryEncryptionJwk value + */ + public EncryptionJwkResource secondaryEncryptionJwk() { + return this.secondaryEncryptionJwk; + } + + /** + * Set the secondary encryption certificate key. + * + * @param secondaryEncryptionJwk the secondaryEncryptionJwk value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withSecondaryEncryptionJwk(EncryptionJwkResource secondaryEncryptionJwk) { + this.secondaryEncryptionJwk = secondaryEncryptionJwk; + return this; + } + + /** + * Get active message count. + * + * @return the activeMessageCount value + */ + public Integer activeMessageCount() { + return this.activeMessageCount; + } + + /** + * Set active message count. + * + * @param activeMessageCount the activeMessageCount value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withActiveMessageCount(Integer activeMessageCount) { + this.activeMessageCount = activeMessageCount; + return this; + } + + /** + * Get latest published version of the gateway install MSI. + * + * @return the latestPublishedMsiVersion value + */ + public String latestPublishedMsiVersion() { + return this.latestPublishedMsiVersion; + } + + /** + * Set latest published version of the gateway install MSI. + * + * @param latestPublishedMsiVersion the latestPublishedMsiVersion value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withLatestPublishedMsiVersion(String latestPublishedMsiVersion) { + this.latestPublishedMsiVersion = latestPublishedMsiVersion; + return this; + } + + /** + * Get gateway install MSI published time. + * + * @return the publishedTimeUtc value + */ + public DateTime publishedTimeUtc() { + return this.publishedTimeUtc; + } + + /** + * Set gateway install MSI published time. + * + * @param publishedTimeUtc the publishedTimeUtc value to set + * @return the GatewayStatus object itself. + */ + public GatewayStatus withPublishedTimeUtc(DateTime publishedTimeUtc) { + this.publishedTimeUtc = publishedTimeUtc; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/NodeParameters.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/NodeParameters.java new file mode 100644 index 00000000000..f90d601703b --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/NodeParameters.java @@ -0,0 +1,175 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameter collection for operations on arm node resource. + */ +@JsonFlatten +public class NodeParameters { + /** + * Location of the resource. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Object tags; + + /** + * Gateway ID which will manage this node. + */ + @JsonProperty(value = "properties.gatewayId") + private String gatewayId; + + /** + * myhost.domain.com. + */ + @JsonProperty(value = "properties.connectionName") + private String connectionName; + + /** + * User name to be used to connect to node. + */ + @JsonProperty(value = "properties.userName") + private String userName; + + /** + * Password associated with user name. + */ + @JsonProperty(value = "properties.password") + private String password; + + /** + * Get location of the resource. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location of the resource. + * + * @param location the location value to set + * @return the NodeParameters object itself. + */ + public NodeParameters withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Object tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the NodeParameters object itself. + */ + public NodeParameters withTags(Object tags) { + this.tags = tags; + return this; + } + + /** + * Get gateway ID which will manage this node. + * + * @return the gatewayId value + */ + public String gatewayId() { + return this.gatewayId; + } + + /** + * Set gateway ID which will manage this node. + * + * @param gatewayId the gatewayId value to set + * @return the NodeParameters object itself. + */ + public NodeParameters withGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + return this; + } + + /** + * Get myhost.domain.com. + * + * @return the connectionName value + */ + public String connectionName() { + return this.connectionName; + } + + /** + * Set myhost.domain.com. + * + * @param connectionName the connectionName value to set + * @return the NodeParameters object itself. + */ + public NodeParameters withConnectionName(String connectionName) { + this.connectionName = connectionName; + return this; + } + + /** + * Get user name to be used to connect to node. + * + * @return the userName value + */ + public String userName() { + return this.userName; + } + + /** + * Set user name to be used to connect to node. + * + * @param userName the userName value to set + * @return the NodeParameters object itself. + */ + public NodeParameters withUserName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get password associated with user name. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set password associated with user name. + * + * @param password the password value to set + * @return the NodeParameters object itself. + */ + public NodeParameters withPassword(String password) { + this.password = password; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PowerShellCommandParameters.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PowerShellCommandParameters.java new file mode 100644 index 00000000000..0d3de58395d --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PowerShellCommandParameters.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.servermanagement; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The parameters to a PowerShell script execution command. + */ +@JsonFlatten +public class PowerShellCommandParameters { + /** + * Script to execute. + */ + @JsonProperty(value = "properties.command") + private String command; + + /** + * Get script to execute. + * + * @return the command value + */ + public String command() { + return this.command; + } + + /** + * Set script to execute. + * + * @param command the command value to set + * @return the PowerShellCommandParameters object itself. + */ + public PowerShellCommandParameters withCommand(String command) { + this.command = command; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PowerShellCommandResult.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PowerShellCommandResult.java new file mode 100644 index 00000000000..f720181f47e --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PowerShellCommandResult.java @@ -0,0 +1,279 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Results from invoking a PowerShell command. + */ +public class PowerShellCommandResult { + /** + * The type of message. + */ + @JsonProperty(value = "messageType") + private Integer messageType; + + /** + * The HTML color string representing the foreground color. + */ + @JsonProperty(value = "foregroundColor") + private String foregroundColor; + + /** + * The HTML color string representing the background color. + */ + @JsonProperty(value = "backgroundColor") + private String backgroundColor; + + /** + * Actual result text from the PowerShell Command. + */ + @JsonProperty(value = "value") + private String value; + + /** + * The interactive prompt message. + */ + @JsonProperty(value = "prompt") + private String prompt; + + /** + * The exit code from a executable that was called from PowerShell. + */ + @JsonProperty(value = "exitCode") + private Integer exitCode; + + /** + * ID of the prompt message. + */ + @JsonProperty(value = "id") + private Integer id; + + /** + * Text that precedes the prompt. + */ + @JsonProperty(value = "caption") + private String caption; + + /** + * Text of the prompt. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Collection of PromptFieldDescription objects that contains the user + * input. + */ + @JsonProperty(value = "descriptions") + private List descriptions; + + /** + * Get the type of message. + * + * @return the messageType value + */ + public Integer messageType() { + return this.messageType; + } + + /** + * Set the type of message. + * + * @param messageType the messageType value to set + * @return the PowerShellCommandResult object itself. + */ + public PowerShellCommandResult withMessageType(Integer messageType) { + this.messageType = messageType; + return this; + } + + /** + * Get the HTML color string representing the foreground color. + * + * @return the foregroundColor value + */ + public String foregroundColor() { + return this.foregroundColor; + } + + /** + * Set the HTML color string representing the foreground color. + * + * @param foregroundColor the foregroundColor value to set + * @return the PowerShellCommandResult object itself. + */ + public PowerShellCommandResult withForegroundColor(String foregroundColor) { + this.foregroundColor = foregroundColor; + return this; + } + + /** + * Get the HTML color string representing the background color. + * + * @return the backgroundColor value + */ + public String backgroundColor() { + return this.backgroundColor; + } + + /** + * Set the HTML color string representing the background color. + * + * @param backgroundColor the backgroundColor value to set + * @return the PowerShellCommandResult object itself. + */ + public PowerShellCommandResult withBackgroundColor(String backgroundColor) { + this.backgroundColor = backgroundColor; + return this; + } + + /** + * Get actual result text from the PowerShell Command. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set actual result text from the PowerShell Command. + * + * @param value the value value to set + * @return the PowerShellCommandResult object itself. + */ + public PowerShellCommandResult withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the interactive prompt message. + * + * @return the prompt value + */ + public String prompt() { + return this.prompt; + } + + /** + * Set the interactive prompt message. + * + * @param prompt the prompt value to set + * @return the PowerShellCommandResult object itself. + */ + public PowerShellCommandResult withPrompt(String prompt) { + this.prompt = prompt; + return this; + } + + /** + * Get the exit code from a executable that was called from PowerShell. + * + * @return the exitCode value + */ + public Integer exitCode() { + return this.exitCode; + } + + /** + * Set the exit code from a executable that was called from PowerShell. + * + * @param exitCode the exitCode value to set + * @return the PowerShellCommandResult object itself. + */ + public PowerShellCommandResult withExitCode(Integer exitCode) { + this.exitCode = exitCode; + return this; + } + + /** + * Get iD of the prompt message. + * + * @return the id value + */ + public Integer id() { + return this.id; + } + + /** + * Set iD of the prompt message. + * + * @param id the id value to set + * @return the PowerShellCommandResult object itself. + */ + public PowerShellCommandResult withId(Integer id) { + this.id = id; + return this; + } + + /** + * Get text that precedes the prompt. + * + * @return the caption value + */ + public String caption() { + return this.caption; + } + + /** + * Set text that precedes the prompt. + * + * @param caption the caption value to set + * @return the PowerShellCommandResult object itself. + */ + public PowerShellCommandResult withCaption(String caption) { + this.caption = caption; + return this; + } + + /** + * Get text of the prompt. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set text of the prompt. + * + * @param message the message value to set + * @return the PowerShellCommandResult object itself. + */ + public PowerShellCommandResult withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get collection of PromptFieldDescription objects that contains the user input. + * + * @return the descriptions value + */ + public List descriptions() { + return this.descriptions; + } + + /** + * Set collection of PromptFieldDescription objects that contains the user input. + * + * @param descriptions the descriptions value to set + * @return the PowerShellCommandResult object itself. + */ + public PowerShellCommandResult withDescriptions(List descriptions) { + this.descriptions = descriptions; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PowerShellExpandOption.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PowerShellExpandOption.java new file mode 100644 index 00000000000..0d850e83b78 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PowerShellExpandOption.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.servermanagement; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for PowerShellExpandOption. + */ +public enum PowerShellExpandOption { + /** Enum value output. */ + OUTPUT("output"); + + /** The actual serialized value for a PowerShellExpandOption instance. */ + private String value; + + PowerShellExpandOption(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PowerShellExpandOption instance. + * + * @param value the serialized value to parse. + * @return the parsed PowerShellExpandOption object, or null if unable to parse. + */ + @JsonCreator + public static PowerShellExpandOption fromString(String value) { + PowerShellExpandOption[] items = PowerShellExpandOption.values(); + for (PowerShellExpandOption item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PowerShellTabCompletionParameters.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PowerShellTabCompletionParameters.java new file mode 100644 index 00000000000..cc119b40885 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PowerShellTabCompletionParameters.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Collection of parameters for PowerShell tab completion. + */ +public class PowerShellTabCompletionParameters { + /** + * Command to get tab completion for. + */ + @JsonProperty(value = "command") + private String command; + + /** + * Get command to get tab completion for. + * + * @return the command value + */ + public String command() { + return this.command; + } + + /** + * Set command to get tab completion for. + * + * @param command the command value to set + * @return the PowerShellTabCompletionParameters object itself. + */ + public PowerShellTabCompletionParameters withCommand(String command) { + this.command = command; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PromptFieldDescription.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PromptFieldDescription.java new file mode 100644 index 00000000000..8360d93c6b4 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PromptFieldDescription.java @@ -0,0 +1,147 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Field description for the implementation of PSHostUserInterface.Prompt. + */ +public class PromptFieldDescription { + /** + * The name of the prompt. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The label text of the prompt. + */ + @JsonProperty(value = "label") + private String label; + + /** + * The help message of the prompt. + */ + @JsonProperty(value = "helpMessage") + private String helpMessage; + + /** + * When set to 'true' the prompt field type is a list of values. + */ + @JsonProperty(value = "promptFieldTypeIsList") + private Boolean promptFieldTypeIsList; + + /** + * Possible values include: 'String', 'SecureString', 'Credential'. + */ + @JsonProperty(value = "promptFieldType") + private PromptFieldType promptFieldType; + + /** + * Get the name of the prompt. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the prompt. + * + * @param name the name value to set + * @return the PromptFieldDescription object itself. + */ + public PromptFieldDescription withName(String name) { + this.name = name; + return this; + } + + /** + * Get the label text of the prompt. + * + * @return the label value + */ + public String label() { + return this.label; + } + + /** + * Set the label text of the prompt. + * + * @param label the label value to set + * @return the PromptFieldDescription object itself. + */ + public PromptFieldDescription withLabel(String label) { + this.label = label; + return this; + } + + /** + * Get the help message of the prompt. + * + * @return the helpMessage value + */ + public String helpMessage() { + return this.helpMessage; + } + + /** + * Set the help message of the prompt. + * + * @param helpMessage the helpMessage value to set + * @return the PromptFieldDescription object itself. + */ + public PromptFieldDescription withHelpMessage(String helpMessage) { + this.helpMessage = helpMessage; + return this; + } + + /** + * Get when set to 'true' the prompt field type is a list of values. + * + * @return the promptFieldTypeIsList value + */ + public Boolean promptFieldTypeIsList() { + return this.promptFieldTypeIsList; + } + + /** + * Set when set to 'true' the prompt field type is a list of values. + * + * @param promptFieldTypeIsList the promptFieldTypeIsList value to set + * @return the PromptFieldDescription object itself. + */ + public PromptFieldDescription withPromptFieldTypeIsList(Boolean promptFieldTypeIsList) { + this.promptFieldTypeIsList = promptFieldTypeIsList; + return this; + } + + /** + * Get possible values include: 'String', 'SecureString', 'Credential'. + * + * @return the promptFieldType value + */ + public PromptFieldType promptFieldType() { + return this.promptFieldType; + } + + /** + * Set possible values include: 'String', 'SecureString', 'Credential'. + * + * @param promptFieldType the promptFieldType value to set + * @return the PromptFieldDescription object itself. + */ + public PromptFieldDescription withPromptFieldType(PromptFieldType promptFieldType) { + this.promptFieldType = promptFieldType; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PromptFieldType.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PromptFieldType.java new file mode 100644 index 00000000000..a8d36819879 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PromptFieldType.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for PromptFieldType. + */ +public enum PromptFieldType { + /** Enum value String. */ + STRING("String"), + + /** Enum value SecureString. */ + SECURE_STRING("SecureString"), + + /** Enum value Credential. */ + CREDENTIAL("Credential"); + + /** The actual serialized value for a PromptFieldType instance. */ + private String value; + + PromptFieldType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PromptFieldType instance. + * + * @param value the serialized value to parse. + * @return the parsed PromptFieldType object, or null if unable to parse. + */ + @JsonCreator + public static PromptFieldType fromString(String value) { + PromptFieldType[] items = PromptFieldType.values(); + for (PromptFieldType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PromptMessageResponse.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PromptMessageResponse.java new file mode 100644 index 00000000000..0d35f9a82c4 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/PromptMessageResponse.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.servermanagement; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The response to a prompt message. + */ +public class PromptMessageResponse { + /** + * The list of responses a cmdlet expects. + */ + @JsonProperty(value = "response") + private List response; + + /** + * Get the list of responses a cmdlet expects. + * + * @return the response value + */ + public List response() { + return this.response; + } + + /** + * Set the list of responses a cmdlet expects. + * + * @param response the response value to set + * @return the PromptMessageResponse object itself. + */ + public PromptMessageResponse withResponse(List response) { + this.response = response; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/RetentionPeriod.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/RetentionPeriod.java new file mode 100644 index 00000000000..6c9112327d0 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/RetentionPeriod.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.servermanagement; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RetentionPeriod. + */ +public enum RetentionPeriod { + /** Enum value Session. */ + SESSION("Session"), + + /** Enum value Persistent. */ + PERSISTENT("Persistent"); + + /** The actual serialized value for a RetentionPeriod instance. */ + private String value; + + RetentionPeriod(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RetentionPeriod instance. + * + * @param value the serialized value to parse. + * @return the parsed RetentionPeriod object, or null if unable to parse. + */ + @JsonCreator + public static RetentionPeriod fromString(String value) { + RetentionPeriod[] items = RetentionPeriod.values(); + for (RetentionPeriod item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/SessionParameters.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/SessionParameters.java new file mode 100644 index 00000000000..9ecaf18d023 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/SessionParameters.java @@ -0,0 +1,150 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameter collection for creation and other operations on sessions. + */ +@JsonFlatten +public class SessionParameters { + /** + * Encrypted User name to be used to connect to node. + */ + @JsonProperty(value = "properties.userName") + private String userName; + + /** + * Encrypted Password associated with user name. + */ + @JsonProperty(value = "properties.password") + private String password; + + /** + * Session retention period. Possible values include: 'Session', + * 'Persistent'. + */ + @JsonProperty(value = "properties.retentionPeriod") + private RetentionPeriod retentionPeriod; + + /** + * Credential data format. Possible values include: 'RsaEncrypted'. + */ + @JsonProperty(value = "properties.credentialDataFormat") + private CredentialDataFormat credentialDataFormat; + + /** + * Encryption certificate thumbprint. + */ + @JsonProperty(value = "properties.EncryptionCertificateThumbprint") + private String encryptionCertificateThumbprint; + + /** + * Get encrypted User name to be used to connect to node. + * + * @return the userName value + */ + public String userName() { + return this.userName; + } + + /** + * Set encrypted User name to be used to connect to node. + * + * @param userName the userName value to set + * @return the SessionParameters object itself. + */ + public SessionParameters withUserName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get encrypted Password associated with user name. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set encrypted Password associated with user name. + * + * @param password the password value to set + * @return the SessionParameters object itself. + */ + public SessionParameters withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get session retention period. Possible values include: 'Session', 'Persistent'. + * + * @return the retentionPeriod value + */ + public RetentionPeriod retentionPeriod() { + return this.retentionPeriod; + } + + /** + * Set session retention period. Possible values include: 'Session', 'Persistent'. + * + * @param retentionPeriod the retentionPeriod value to set + * @return the SessionParameters object itself. + */ + public SessionParameters withRetentionPeriod(RetentionPeriod retentionPeriod) { + this.retentionPeriod = retentionPeriod; + return this; + } + + /** + * Get credential data format. Possible values include: 'RsaEncrypted'. + * + * @return the credentialDataFormat value + */ + public CredentialDataFormat credentialDataFormat() { + return this.credentialDataFormat; + } + + /** + * Set credential data format. Possible values include: 'RsaEncrypted'. + * + * @param credentialDataFormat the credentialDataFormat value to set + * @return the SessionParameters object itself. + */ + public SessionParameters withCredentialDataFormat(CredentialDataFormat credentialDataFormat) { + this.credentialDataFormat = credentialDataFormat; + return this; + } + + /** + * Get encryption certificate thumbprint. + * + * @return the encryptionCertificateThumbprint value + */ + public String encryptionCertificateThumbprint() { + return this.encryptionCertificateThumbprint; + } + + /** + * Set encryption certificate thumbprint. + * + * @param encryptionCertificateThumbprint the encryptionCertificateThumbprint value to set + * @return the SessionParameters object itself. + */ + public SessionParameters withEncryptionCertificateThumbprint(String encryptionCertificateThumbprint) { + this.encryptionCertificateThumbprint = encryptionCertificateThumbprint; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/UpgradeMode.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/UpgradeMode.java new file mode 100644 index 00000000000..ac6aaf1e026 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/UpgradeMode.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.servermanagement; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for UpgradeMode. + */ +public enum UpgradeMode { + /** Enum value Manual. */ + MANUAL("Manual"), + + /** Enum value Automatic. */ + AUTOMATIC("Automatic"); + + /** The actual serialized value for a UpgradeMode instance. */ + private String value; + + UpgradeMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a UpgradeMode instance. + * + * @param value the serialized value to parse. + * @return the parsed UpgradeMode object, or null if unable to parse. + */ + @JsonCreator + public static UpgradeMode fromString(String value) { + UpgradeMode[] items = UpgradeMode.values(); + for (UpgradeMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/Version.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/Version.java new file mode 100644 index 00000000000..6f59c7f9a94 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/Version.java @@ -0,0 +1,173 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A multipart-numeric version number. + */ +public class Version { + /** + * The leftmost number of the version. + */ + @JsonProperty(value = "major") + private Integer major; + + /** + * The second leftmost number of the version. + */ + @JsonProperty(value = "minor") + private Integer minor; + + /** + * The third number of the version. + */ + @JsonProperty(value = "build") + private Integer build; + + /** + * The fourth number of the version. + */ + @JsonProperty(value = "revision") + private Integer revision; + + /** + * The MSW of the fourth part. + */ + @JsonProperty(value = "majorRevision") + private Integer majorRevision; + + /** + * The LSW of the fourth part. + */ + @JsonProperty(value = "minorRevision") + private Integer minorRevision; + + /** + * Get the leftmost number of the version. + * + * @return the major value + */ + public Integer major() { + return this.major; + } + + /** + * Set the leftmost number of the version. + * + * @param major the major value to set + * @return the Version object itself. + */ + public Version withMajor(Integer major) { + this.major = major; + return this; + } + + /** + * Get the second leftmost number of the version. + * + * @return the minor value + */ + public Integer minor() { + return this.minor; + } + + /** + * Set the second leftmost number of the version. + * + * @param minor the minor value to set + * @return the Version object itself. + */ + public Version withMinor(Integer minor) { + this.minor = minor; + return this; + } + + /** + * Get the third number of the version. + * + * @return the build value + */ + public Integer build() { + return this.build; + } + + /** + * Set the third number of the version. + * + * @param build the build value to set + * @return the Version object itself. + */ + public Version withBuild(Integer build) { + this.build = build; + return this; + } + + /** + * Get the fourth number of the version. + * + * @return the revision value + */ + public Integer revision() { + return this.revision; + } + + /** + * Set the fourth number of the version. + * + * @param revision the revision value to set + * @return the Version object itself. + */ + public Version withRevision(Integer revision) { + this.revision = revision; + return this; + } + + /** + * Get the MSW of the fourth part. + * + * @return the majorRevision value + */ + public Integer majorRevision() { + return this.majorRevision; + } + + /** + * Set the MSW of the fourth part. + * + * @param majorRevision the majorRevision value to set + * @return the Version object itself. + */ + public Version withMajorRevision(Integer majorRevision) { + this.majorRevision = majorRevision; + return this; + } + + /** + * Get the LSW of the fourth part. + * + * @return the minorRevision value + */ + public Integer minorRevision() { + return this.minorRevision; + } + + /** + * Set the LSW of the fourth part. + * + * @param minorRevision the minorRevision value to set + * @return the Version object itself. + */ + public Version withMinorRevision(Integer minorRevision) { + this.minorRevision = minorRevision; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/GatewayProfileInner.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/GatewayProfileInner.java new file mode 100644 index 00000000000..373f3cac85f --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/GatewayProfileInner.java @@ -0,0 +1,278 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * JSON properties that the gateway service uses know how to communicate with + * the resource. + */ +public class GatewayProfileInner { + /** + * The Dataplane connection URL. + */ + @JsonProperty(value = "dataPlaneServiceBaseAddress") + private String dataPlaneServiceBaseAddress; + + /** + * The ID of the gateway. + */ + @JsonProperty(value = "gatewayId") + private String gatewayId; + + /** + * The environment for the gateway (DEV, DogFood, or Production). + */ + @JsonProperty(value = "environment") + private String environment; + + /** + * Gateway upgrade manifest URL. + */ + @JsonProperty(value = "upgradeManifestUrl") + private String upgradeManifestUrl; + + /** + * Messaging namespace. + */ + @JsonProperty(value = "messagingNamespace") + private String messagingNamespace; + + /** + * Messaging Account. + */ + @JsonProperty(value = "messagingAccount") + private String messagingAccount; + + /** + * Messaging Key. + */ + @JsonProperty(value = "messagingKey") + private String messagingKey; + + /** + * Request queue name. + */ + @JsonProperty(value = "requestQueue") + private String requestQueue; + + /** + * Response topic name. + */ + @JsonProperty(value = "responseTopic") + private String responseTopic; + + /** + * The gateway status blob SAS URL. + */ + @JsonProperty(value = "statusBlobSignature") + private String statusBlobSignature; + + /** + * Get the Dataplane connection URL. + * + * @return the dataPlaneServiceBaseAddress value + */ + public String dataPlaneServiceBaseAddress() { + return this.dataPlaneServiceBaseAddress; + } + + /** + * Set the Dataplane connection URL. + * + * @param dataPlaneServiceBaseAddress the dataPlaneServiceBaseAddress value to set + * @return the GatewayProfileInner object itself. + */ + public GatewayProfileInner withDataPlaneServiceBaseAddress(String dataPlaneServiceBaseAddress) { + this.dataPlaneServiceBaseAddress = dataPlaneServiceBaseAddress; + return this; + } + + /** + * Get the ID of the gateway. + * + * @return the gatewayId value + */ + public String gatewayId() { + return this.gatewayId; + } + + /** + * Set the ID of the gateway. + * + * @param gatewayId the gatewayId value to set + * @return the GatewayProfileInner object itself. + */ + public GatewayProfileInner withGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + return this; + } + + /** + * Get the environment for the gateway (DEV, DogFood, or Production). + * + * @return the environment value + */ + public String environment() { + return this.environment; + } + + /** + * Set the environment for the gateway (DEV, DogFood, or Production). + * + * @param environment the environment value to set + * @return the GatewayProfileInner object itself. + */ + public GatewayProfileInner withEnvironment(String environment) { + this.environment = environment; + return this; + } + + /** + * Get gateway upgrade manifest URL. + * + * @return the upgradeManifestUrl value + */ + public String upgradeManifestUrl() { + return this.upgradeManifestUrl; + } + + /** + * Set gateway upgrade manifest URL. + * + * @param upgradeManifestUrl the upgradeManifestUrl value to set + * @return the GatewayProfileInner object itself. + */ + public GatewayProfileInner withUpgradeManifestUrl(String upgradeManifestUrl) { + this.upgradeManifestUrl = upgradeManifestUrl; + return this; + } + + /** + * Get messaging namespace. + * + * @return the messagingNamespace value + */ + public String messagingNamespace() { + return this.messagingNamespace; + } + + /** + * Set messaging namespace. + * + * @param messagingNamespace the messagingNamespace value to set + * @return the GatewayProfileInner object itself. + */ + public GatewayProfileInner withMessagingNamespace(String messagingNamespace) { + this.messagingNamespace = messagingNamespace; + return this; + } + + /** + * Get messaging Account. + * + * @return the messagingAccount value + */ + public String messagingAccount() { + return this.messagingAccount; + } + + /** + * Set messaging Account. + * + * @param messagingAccount the messagingAccount value to set + * @return the GatewayProfileInner object itself. + */ + public GatewayProfileInner withMessagingAccount(String messagingAccount) { + this.messagingAccount = messagingAccount; + return this; + } + + /** + * Get messaging Key. + * + * @return the messagingKey value + */ + public String messagingKey() { + return this.messagingKey; + } + + /** + * Set messaging Key. + * + * @param messagingKey the messagingKey value to set + * @return the GatewayProfileInner object itself. + */ + public GatewayProfileInner withMessagingKey(String messagingKey) { + this.messagingKey = messagingKey; + return this; + } + + /** + * Get request queue name. + * + * @return the requestQueue value + */ + public String requestQueue() { + return this.requestQueue; + } + + /** + * Set request queue name. + * + * @param requestQueue the requestQueue value to set + * @return the GatewayProfileInner object itself. + */ + public GatewayProfileInner withRequestQueue(String requestQueue) { + this.requestQueue = requestQueue; + return this; + } + + /** + * Get response topic name. + * + * @return the responseTopic value + */ + public String responseTopic() { + return this.responseTopic; + } + + /** + * Set response topic name. + * + * @param responseTopic the responseTopic value to set + * @return the GatewayProfileInner object itself. + */ + public GatewayProfileInner withResponseTopic(String responseTopic) { + this.responseTopic = responseTopic; + return this; + } + + /** + * Get the gateway status blob SAS URL. + * + * @return the statusBlobSignature value + */ + public String statusBlobSignature() { + return this.statusBlobSignature; + } + + /** + * Set the gateway status blob SAS URL. + * + * @param statusBlobSignature the statusBlobSignature value to set + * @return the GatewayProfileInner object itself. + */ + public GatewayProfileInner withStatusBlobSignature(String statusBlobSignature) { + this.statusBlobSignature = statusBlobSignature; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/GatewayResourceInner.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/GatewayResourceInner.java new file mode 100644 index 00000000000..f3baddfdd4c --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/GatewayResourceInner.java @@ -0,0 +1,292 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.servermanagement.UpgradeMode; +import java.util.List; +import com.microsoft.azure.management.servermanagement.GatewayStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Data model for an arm gateway resource. + */ +@JsonFlatten +@SkipParentValidation +public class GatewayResourceInner extends Resource { + /** + * UTC date and time when gateway was first added to management service. + */ + @JsonProperty(value = "properties.created") + private DateTime created; + + /** + * UTC date and time when node was last updated. + */ + @JsonProperty(value = "properties.updated") + private DateTime updated; + + /** + * The upgradeMode property gives the flexibility to gateway to auto + * upgrade itself. If properties value not specified, then we assume + * upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic'. + */ + @JsonProperty(value = "properties.upgradeMode") + private UpgradeMode upgradeMode; + + /** + * Latest available MSI version. + */ + @JsonProperty(value = "properties.desiredVersion") + private String desiredVersion; + + /** + * Names of the nodes in the gateway. + */ + @JsonProperty(value = "properties.instances") + private List instances; + + /** + * Number of active messages. + */ + @JsonProperty(value = "properties.activeMessageCount") + private Integer activeMessageCount; + + /** + * Last published MSI version. + */ + @JsonProperty(value = "properties.latestPublishedMsiVersion") + private String latestPublishedMsiVersion; + + /** + * The date/time of the last published gateway. + */ + @JsonProperty(value = "properties.publishedTimeUtc") + private DateTime publishedTimeUtc; + + /** + * Installer download uri. + */ + @JsonProperty(value = "properties.installerDownload", access = JsonProperty.Access.WRITE_ONLY) + private String installerDownload; + + /** + * Minimum gateway version. + */ + @JsonProperty(value = "properties.minimumVersion", access = JsonProperty.Access.WRITE_ONLY) + private String minimumVersion; + + /** + * The etag property. + */ + @JsonProperty(value = "etag") + private String etag; + + /** + * Get uTC date and time when gateway was first added to management service. + * + * @return the created value + */ + public DateTime created() { + return this.created; + } + + /** + * Set uTC date and time when gateway was first added to management service. + * + * @param created the created value to set + * @return the GatewayResourceInner object itself. + */ + public GatewayResourceInner withCreated(DateTime created) { + this.created = created; + return this; + } + + /** + * Get uTC date and time when node was last updated. + * + * @return the updated value + */ + public DateTime updated() { + return this.updated; + } + + /** + * Set uTC date and time when node was last updated. + * + * @param updated the updated value to set + * @return the GatewayResourceInner object itself. + */ + public GatewayResourceInner withUpdated(DateTime updated) { + this.updated = updated; + return this; + } + + /** + * Get the upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic'. + * + * @return the upgradeMode value + */ + public UpgradeMode upgradeMode() { + return this.upgradeMode; + } + + /** + * Set the upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic'. + * + * @param upgradeMode the upgradeMode value to set + * @return the GatewayResourceInner object itself. + */ + public GatewayResourceInner withUpgradeMode(UpgradeMode upgradeMode) { + this.upgradeMode = upgradeMode; + return this; + } + + /** + * Get latest available MSI version. + * + * @return the desiredVersion value + */ + public String desiredVersion() { + return this.desiredVersion; + } + + /** + * Set latest available MSI version. + * + * @param desiredVersion the desiredVersion value to set + * @return the GatewayResourceInner object itself. + */ + public GatewayResourceInner withDesiredVersion(String desiredVersion) { + this.desiredVersion = desiredVersion; + return this; + } + + /** + * Get names of the nodes in the gateway. + * + * @return the instances value + */ + public List instances() { + return this.instances; + } + + /** + * Set names of the nodes in the gateway. + * + * @param instances the instances value to set + * @return the GatewayResourceInner object itself. + */ + public GatewayResourceInner withInstances(List instances) { + this.instances = instances; + return this; + } + + /** + * Get number of active messages. + * + * @return the activeMessageCount value + */ + public Integer activeMessageCount() { + return this.activeMessageCount; + } + + /** + * Set number of active messages. + * + * @param activeMessageCount the activeMessageCount value to set + * @return the GatewayResourceInner object itself. + */ + public GatewayResourceInner withActiveMessageCount(Integer activeMessageCount) { + this.activeMessageCount = activeMessageCount; + return this; + } + + /** + * Get last published MSI version. + * + * @return the latestPublishedMsiVersion value + */ + public String latestPublishedMsiVersion() { + return this.latestPublishedMsiVersion; + } + + /** + * Set last published MSI version. + * + * @param latestPublishedMsiVersion the latestPublishedMsiVersion value to set + * @return the GatewayResourceInner object itself. + */ + public GatewayResourceInner withLatestPublishedMsiVersion(String latestPublishedMsiVersion) { + this.latestPublishedMsiVersion = latestPublishedMsiVersion; + return this; + } + + /** + * Get the date/time of the last published gateway. + * + * @return the publishedTimeUtc value + */ + public DateTime publishedTimeUtc() { + return this.publishedTimeUtc; + } + + /** + * Set the date/time of the last published gateway. + * + * @param publishedTimeUtc the publishedTimeUtc value to set + * @return the GatewayResourceInner object itself. + */ + public GatewayResourceInner withPublishedTimeUtc(DateTime publishedTimeUtc) { + this.publishedTimeUtc = publishedTimeUtc; + return this; + } + + /** + * Get installer download uri. + * + * @return the installerDownload value + */ + public String installerDownload() { + return this.installerDownload; + } + + /** + * Get minimum gateway version. + * + * @return the minimumVersion value + */ + public String minimumVersion() { + return this.minimumVersion; + } + + /** + * Get the etag value. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag value. + * + * @param etag the etag value to set + * @return the GatewayResourceInner object itself. + */ + public GatewayResourceInner withEtag(String etag) { + this.etag = etag; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/GatewaysInner.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/GatewaysInner.java new file mode 100644 index 00000000000..711612909b3 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/GatewaysInner.java @@ -0,0 +1,1999 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement.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.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servermanagement.ErrorException; +import com.microsoft.azure.management.servermanagement.GatewayExpandOption; +import com.microsoft.azure.management.servermanagement.GatewayParameters; +import com.microsoft.azure.management.servermanagement.UpgradeMode; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Gateways. + */ +public class GatewaysInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private GatewaysService service; + /** The service client containing this operation class. */ + private ServerManagementImpl client; + + /** + * Initializes an instance of GatewaysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public GatewaysInner(Retrofit retrofit, ServerManagementImpl client) { + this.service = retrofit.create(GatewaysService.class); + this.client = client; + } + + /** + * The interface defining all the services for Gateways to be + * used by Retrofit to perform actually REST calls. + */ + interface GatewaysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Gateways create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}") + Observable> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("gatewayName") String gatewayName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body GatewayParameters gatewayParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Gateways beginCreate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}") + Observable> beginCreate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("gatewayName") String gatewayName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body GatewayParameters gatewayParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Gateways update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("gatewayName") String gatewayName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body GatewayParameters gatewayParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Gateways beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("gatewayName") String gatewayName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body GatewayParameters gatewayParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Gateways delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("gatewayName") String gatewayName, @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.servermanagement.Gateways getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("gatewayName") String gatewayName, @Query("api-version") String apiVersion, @Query("$expand") GatewayExpandOption expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Gateways list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.ServerManagement/gateways") + Observable> list(@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.servermanagement.Gateways listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways") + 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.servermanagement.Gateways upgrade" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}/upgradetolatest") + Observable> upgrade(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("gatewayName") String gatewayName, @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.servermanagement.Gateways beginUpgrade" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}/upgradetolatest") + Observable> beginUpgrade(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("gatewayName") String gatewayName, @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.servermanagement.Gateways regenerateProfile" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}/regenerateprofile") + Observable> regenerateProfile(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("gatewayName") String gatewayName, @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.servermanagement.Gateways beginRegenerateProfile" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}/regenerateprofile") + Observable> beginRegenerateProfile(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("gatewayName") String gatewayName, @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.servermanagement.Gateways getProfile" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}/profile") + Observable> getProfile(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("gatewayName") String gatewayName, @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.servermanagement.Gateways beginGetProfile" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/gateways/{gatewayName}/profile") + Observable> beginGetProfile(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("gatewayName") String gatewayName, @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.servermanagement.Gateways listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Gateways listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GatewayResourceInner object if successful. + */ + public GatewayResourceInner create(String resourceGroupName, String gatewayName) { + return createWithServiceResponseAsync(resourceGroupName, gatewayName).toBlocking().last().body(); + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @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 gatewayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback); + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String gatewayName) { + return createWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1, GatewayResourceInner>() { + @Override + public GatewayResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String gatewayName) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String location = null; + final Object tags = null; + final UpgradeMode upgradeMode = null; + GatewayParameters gatewayParameters = new GatewayParameters(); + gatewayParameters.withLocation(null); + gatewayParameters.withTags(null); + gatewayParameters.withUpgradeMode(null); + Observable> observable = service.create(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), gatewayParameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GatewayResourceInner object if successful. + */ + public GatewayResourceInner create(String resourceGroupName, String gatewayName, String location, Object tags, UpgradeMode upgradeMode) { + return createWithServiceResponseAsync(resourceGroupName, gatewayName, location, tags, upgradeMode).toBlocking().last().body(); + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @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 gatewayName, String location, Object tags, UpgradeMode upgradeMode, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, gatewayName, location, tags, upgradeMode), serviceCallback); + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String gatewayName, String location, Object tags, UpgradeMode upgradeMode) { + return createWithServiceResponseAsync(resourceGroupName, gatewayName, location, tags, upgradeMode).map(new Func1, GatewayResourceInner>() { + @Override + public GatewayResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String gatewayName, String location, Object tags, UpgradeMode upgradeMode) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + GatewayParameters gatewayParameters = new GatewayParameters(); + gatewayParameters.withLocation(location); + gatewayParameters.withTags(tags); + gatewayParameters.withUpgradeMode(upgradeMode); + Observable> observable = service.create(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), gatewayParameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GatewayResourceInner object if successful. + */ + public GatewayResourceInner beginCreate(String resourceGroupName, String gatewayName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, gatewayName).toBlocking().single().body(); + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @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 gatewayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback); + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GatewayResourceInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String gatewayName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1, GatewayResourceInner>() { + @Override + public GatewayResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GatewayResourceInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String gatewayName) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String location = null; + final Object tags = null; + final UpgradeMode upgradeMode = null; + GatewayParameters gatewayParameters = new GatewayParameters(); + gatewayParameters.withLocation(null); + gatewayParameters.withTags(null); + gatewayParameters.withUpgradeMode(null); + return service.beginCreate(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), gatewayParameters, 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); + } + } + }); + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GatewayResourceInner object if successful. + */ + public GatewayResourceInner beginCreate(String resourceGroupName, String gatewayName, String location, Object tags, UpgradeMode upgradeMode) { + return beginCreateWithServiceResponseAsync(resourceGroupName, gatewayName, location, tags, upgradeMode).toBlocking().single().body(); + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @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 gatewayName, String location, Object tags, UpgradeMode upgradeMode, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, gatewayName, location, tags, upgradeMode), serviceCallback); + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GatewayResourceInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String gatewayName, String location, Object tags, UpgradeMode upgradeMode) { + return beginCreateWithServiceResponseAsync(resourceGroupName, gatewayName, location, tags, upgradeMode).map(new Func1, GatewayResourceInner>() { + @Override + public GatewayResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a ManagementService gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GatewayResourceInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String gatewayName, String location, Object tags, UpgradeMode upgradeMode) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + GatewayParameters gatewayParameters = new GatewayParameters(); + gatewayParameters.withLocation(location); + gatewayParameters.withTags(tags); + gatewayParameters.withUpgradeMode(upgradeMode); + return service.beginCreate(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), gatewayParameters, 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 ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GatewayResourceInner object if successful. + */ + public GatewayResourceInner update(String resourceGroupName, String gatewayName) { + return updateWithServiceResponseAsync(resourceGroupName, gatewayName).toBlocking().last().body(); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @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 gatewayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String gatewayName) { + return updateWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1, GatewayResourceInner>() { + @Override + public GatewayResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String gatewayName) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String location = null; + final Object tags = null; + final UpgradeMode upgradeMode = null; + GatewayParameters gatewayParameters = new GatewayParameters(); + gatewayParameters.withLocation(null); + gatewayParameters.withTags(null); + gatewayParameters.withUpgradeMode(null); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), gatewayParameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GatewayResourceInner object if successful. + */ + public GatewayResourceInner update(String resourceGroupName, String gatewayName, String location, Object tags, UpgradeMode upgradeMode) { + return updateWithServiceResponseAsync(resourceGroupName, gatewayName, location, tags, upgradeMode).toBlocking().last().body(); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @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 gatewayName, String location, Object tags, UpgradeMode upgradeMode, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, gatewayName, location, tags, upgradeMode), serviceCallback); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String gatewayName, String location, Object tags, UpgradeMode upgradeMode) { + return updateWithServiceResponseAsync(resourceGroupName, gatewayName, location, tags, upgradeMode).map(new Func1, GatewayResourceInner>() { + @Override + public GatewayResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String gatewayName, String location, Object tags, UpgradeMode upgradeMode) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + GatewayParameters gatewayParameters = new GatewayParameters(); + gatewayParameters.withLocation(location); + gatewayParameters.withTags(tags); + gatewayParameters.withUpgradeMode(upgradeMode); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), gatewayParameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GatewayResourceInner object if successful. + */ + public GatewayResourceInner beginUpdate(String resourceGroupName, String gatewayName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, gatewayName).toBlocking().single().body(); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @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 gatewayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GatewayResourceInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String gatewayName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1, GatewayResourceInner>() { + @Override + public GatewayResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GatewayResourceInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String gatewayName) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String location = null; + final Object tags = null; + final UpgradeMode upgradeMode = null; + GatewayParameters gatewayParameters = new GatewayParameters(); + gatewayParameters.withLocation(null); + gatewayParameters.withTags(null); + gatewayParameters.withUpgradeMode(null); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), gatewayParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GatewayResourceInner object if successful. + */ + public GatewayResourceInner beginUpdate(String resourceGroupName, String gatewayName, String location, Object tags, UpgradeMode upgradeMode) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, location, tags, upgradeMode).toBlocking().single().body(); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @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 gatewayName, String location, Object tags, UpgradeMode upgradeMode, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, location, tags, upgradeMode), serviceCallback); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GatewayResourceInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String gatewayName, String location, Object tags, UpgradeMode upgradeMode) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, location, tags, upgradeMode).map(new Func1, GatewayResourceInner>() { + @Override + public GatewayResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a gateway belonging to a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param upgradeMode The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. Possible values include: 'Manual', 'Automatic' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GatewayResourceInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String gatewayName, String location, Object tags, UpgradeMode upgradeMode) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + GatewayParameters gatewayParameters = new GatewayParameters(); + gatewayParameters.withLocation(location); + gatewayParameters.withTags(tags); + gatewayParameters.withUpgradeMode(upgradeMode); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), gatewayParameters, 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 ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Deletes a gateway from a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException 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 gatewayName) { + deleteWithServiceResponseAsync(resourceGroupName, gatewayName).toBlocking().single().body(); + } + + /** + * Deletes a gateway from a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @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 gatewayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback); + } + + /** + * Deletes a gateway from a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String gatewayName) { + return deleteWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a gateway from a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String gatewayName) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Gets a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GatewayResourceInner object if successful. + */ + public GatewayResourceInner getByResourceGroup(String resourceGroupName, String gatewayName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, gatewayName).toBlocking().single().body(); + } + + /** + * Gets a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum) + * @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 gatewayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback); + } + + /** + * Gets a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GatewayResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String gatewayName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1, GatewayResourceInner>() { + @Override + public GatewayResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GatewayResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String gatewayName) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final GatewayExpandOption expand = null; + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), expand, 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); + } + } + }); + } + + /** + * Gets a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum) + * @param expand Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Possible values include: 'status', 'download' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GatewayResourceInner object if successful. + */ + public GatewayResourceInner getByResourceGroup(String resourceGroupName, String gatewayName, GatewayExpandOption expand) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, gatewayName, expand).toBlocking().single().body(); + } + + /** + * Gets a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum) + * @param expand Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Possible values include: 'status', 'download' + * @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 gatewayName, GatewayExpandOption expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, gatewayName, expand), serviceCallback); + } + + /** + * Gets a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum) + * @param expand Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Possible values include: 'status', 'download' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GatewayResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String gatewayName, GatewayExpandOption expand) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, gatewayName, expand).map(new Func1, GatewayResourceInner>() { + @Override + public GatewayResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum) + * @param expand Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Possible values include: 'status', 'download' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GatewayResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String gatewayName, GatewayExpandOption expand) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName 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, gatewayName, this.client.apiVersion(), expand, 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 ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Returns gateways in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException 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<GatewayResourceInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns gateways in a subscription. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns gateways in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GatewayResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns gateways in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GatewayResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .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(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns gateways in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GatewayResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Returns gateways in a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException 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<GatewayResourceInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns gateways in a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @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> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns gateways in a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GatewayResourceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns gateways in a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GatewayResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .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(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns gateways in a resource group. + * + ServiceResponse> * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GatewayResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Upgrades a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void upgrade(String resourceGroupName, String gatewayName) { + upgradeWithServiceResponseAsync(resourceGroupName, gatewayName).toBlocking().last().body(); + } + + /** + * Upgrades a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @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 upgradeAsync(String resourceGroupName, String gatewayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(upgradeWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback); + } + + /** + * Upgrades a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable upgradeAsync(String resourceGroupName, String gatewayName) { + return upgradeWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upgrades a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> upgradeWithServiceResponseAsync(String resourceGroupName, String gatewayName) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName 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.upgrade(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Upgrades a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginUpgrade(String resourceGroupName, String gatewayName) { + beginUpgradeWithServiceResponseAsync(resourceGroupName, gatewayName).toBlocking().single().body(); + } + + /** + * Upgrades a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @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 beginUpgradeAsync(String resourceGroupName, String gatewayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpgradeWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback); + } + + /** + * Upgrades a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginUpgradeAsync(String resourceGroupName, String gatewayName) { + return beginUpgradeWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upgrades a gateway. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginUpgradeWithServiceResponseAsync(String resourceGroupName, String gatewayName) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName 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.beginUpgrade(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpgradeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpgradeDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Regenerate a gateway's profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void regenerateProfile(String resourceGroupName, String gatewayName) { + regenerateProfileWithServiceResponseAsync(resourceGroupName, gatewayName).toBlocking().last().body(); + } + + /** + * Regenerate a gateway's profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @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 regenerateProfileAsync(String resourceGroupName, String gatewayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateProfileWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback); + } + + /** + * Regenerate a gateway's profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable regenerateProfileAsync(String resourceGroupName, String gatewayName) { + return regenerateProfileWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerate a gateway's profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> regenerateProfileWithServiceResponseAsync(String resourceGroupName, String gatewayName) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName 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.regenerateProfile(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Regenerate a gateway's profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginRegenerateProfile(String resourceGroupName, String gatewayName) { + beginRegenerateProfileWithServiceResponseAsync(resourceGroupName, gatewayName).toBlocking().single().body(); + } + + /** + * Regenerate a gateway's profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @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 beginRegenerateProfileAsync(String resourceGroupName, String gatewayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRegenerateProfileWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback); + } + + /** + * Regenerate a gateway's profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRegenerateProfileAsync(String resourceGroupName, String gatewayName) { + return beginRegenerateProfileWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerate a gateway's profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRegenerateProfileWithServiceResponseAsync(String resourceGroupName, String gatewayName) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName 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.beginRegenerateProfile(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginRegenerateProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRegenerateProfileDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Gets a gateway profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GatewayProfileInner object if successful. + */ + public GatewayProfileInner getProfile(String resourceGroupName, String gatewayName) { + return getProfileWithServiceResponseAsync(resourceGroupName, gatewayName).toBlocking().last().body(); + } + + /** + * Gets a gateway profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @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 getProfileAsync(String resourceGroupName, String gatewayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getProfileWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback); + } + + /** + * Gets a gateway profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable getProfileAsync(String resourceGroupName, String gatewayName) { + return getProfileWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1, GatewayProfileInner>() { + @Override + public GatewayProfileInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a gateway profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> getProfileWithServiceResponseAsync(String resourceGroupName, String gatewayName) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName 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.getProfile(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Gets a gateway profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GatewayProfileInner object if successful. + */ + public GatewayProfileInner beginGetProfile(String resourceGroupName, String gatewayName) { + return beginGetProfileWithServiceResponseAsync(resourceGroupName, gatewayName).toBlocking().single().body(); + } + + /** + * Gets a gateway profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @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 beginGetProfileAsync(String resourceGroupName, String gatewayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginGetProfileWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback); + } + + /** + * Gets a gateway profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GatewayProfileInner object + */ + public Observable beginGetProfileAsync(String resourceGroupName, String gatewayName) { + return beginGetProfileWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1, GatewayProfileInner>() { + @Override + public GatewayProfileInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a gateway profile. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param gatewayName The gateway name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GatewayProfileInner object + */ + public Observable> beginGetProfileWithServiceResponseAsync(String resourceGroupName, String gatewayName) { + 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 (gatewayName == null) { + throw new IllegalArgumentException("Parameter gatewayName 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.beginGetProfile(this.client.subscriptionId(), resourceGroupName, gatewayName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginGetProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginGetProfileDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Returns gateways in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException 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<GatewayResourceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns gateways in a subscription. + * + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns gateways in a subscription. + * + * @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<GatewayResourceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns gateways in a subscription. + * + * @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<GatewayResourceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(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(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns gateways in a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GatewayResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(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.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Returns gateways in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException 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<GatewayResourceInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns gateways in a resource group. + * + * @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> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns gateways in a resource group. + * + * @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<GatewayResourceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns gateways in a resource group. + * + * @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<GatewayResourceInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(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(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns gateways in a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GatewayResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/NodeResourceInner.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/NodeResourceInner.java new file mode 100644 index 00000000000..0b22f8cdeb7 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/NodeResourceInner.java @@ -0,0 +1,153 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A Node Resource. + */ +@JsonFlatten +@SkipParentValidation +public class NodeResourceInner extends Resource { + /** + * ID of the gateway. + */ + @JsonProperty(value = "properties.gatewayId") + private String gatewayId; + + /** + * myhost.domain.com. + */ + @JsonProperty(value = "properties.connectionName") + private String connectionName; + + /** + * UTC date and time when node was first added to management service. + */ + @JsonProperty(value = "properties.created") + private DateTime created; + + /** + * UTC date and time when node was last updated. + */ + @JsonProperty(value = "properties.updated") + private DateTime updated; + + /** + * The etag property. + */ + @JsonProperty(value = "etag") + private String etag; + + /** + * Get iD of the gateway. + * + * @return the gatewayId value + */ + public String gatewayId() { + return this.gatewayId; + } + + /** + * Set iD of the gateway. + * + * @param gatewayId the gatewayId value to set + * @return the NodeResourceInner object itself. + */ + public NodeResourceInner withGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + return this; + } + + /** + * Get myhost.domain.com. + * + * @return the connectionName value + */ + public String connectionName() { + return this.connectionName; + } + + /** + * Set myhost.domain.com. + * + * @param connectionName the connectionName value to set + * @return the NodeResourceInner object itself. + */ + public NodeResourceInner withConnectionName(String connectionName) { + this.connectionName = connectionName; + return this; + } + + /** + * Get uTC date and time when node was first added to management service. + * + * @return the created value + */ + public DateTime created() { + return this.created; + } + + /** + * Set uTC date and time when node was first added to management service. + * + * @param created the created value to set + * @return the NodeResourceInner object itself. + */ + public NodeResourceInner withCreated(DateTime created) { + this.created = created; + return this; + } + + /** + * Get uTC date and time when node was last updated. + * + * @return the updated value + */ + public DateTime updated() { + return this.updated; + } + + /** + * Set uTC date and time when node was last updated. + * + * @param updated the updated value to set + * @return the NodeResourceInner object itself. + */ + public NodeResourceInner withUpdated(DateTime updated) { + this.updated = updated; + return this; + } + + /** + * Get the etag value. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag value. + * + * @param etag the etag value to set + * @return the NodeResourceInner object itself. + */ + public NodeResourceInner withEtag(String etag) { + this.etag = etag; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/NodesInner.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/NodesInner.java new file mode 100644 index 00000000000..1182adda418 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/NodesInner.java @@ -0,0 +1,1509 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement.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.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.servermanagement.ErrorException; +import com.microsoft.azure.management.servermanagement.NodeParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Nodes. + */ +public class NodesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private NodesService service; + /** The service client containing this operation class. */ + private ServerManagementImpl client; + + /** + * Initializes an instance of NodesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public NodesInner(Retrofit retrofit, ServerManagementImpl client) { + this.service = retrofit.create(NodesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Nodes to be + * used by Retrofit to perform actually REST calls. + */ + interface NodesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Nodes create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}") + Observable> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body NodeParameters gatewayParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Nodes beginCreate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}") + Observable> beginCreate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body NodeParameters gatewayParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Nodes update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body NodeParameters nodeParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Nodes beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body NodeParameters nodeParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Nodes delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @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.servermanagement.Nodes getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @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.servermanagement.Nodes list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.ServerManagement/nodes") + Observable> list(@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.servermanagement.Nodes listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes") + 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.servermanagement.Nodes listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Nodes listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NodeResourceInner object if successful. + */ + public NodeResourceInner create(String resourceGroupName, String nodeName) { + return createWithServiceResponseAsync(resourceGroupName, nodeName).toBlocking().last().body(); + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @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 nodeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, nodeName), serviceCallback); + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String nodeName) { + return createWithServiceResponseAsync(resourceGroupName, nodeName).map(new Func1, NodeResourceInner>() { + @Override + public NodeResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String nodeName) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String location = null; + final Object tags = null; + final String gatewayId = null; + final String connectionName = null; + final String userName = null; + final String password = null; + NodeParameters gatewayParameters = new NodeParameters(); + gatewayParameters.withLocation(null); + gatewayParameters.withTags(null); + gatewayParameters.withGatewayId(null); + gatewayParameters.withConnectionName(null); + gatewayParameters.withUserName(null); + gatewayParameters.withPassword(null); + Observable> observable = service.create(this.client.subscriptionId(), resourceGroupName, nodeName, this.client.apiVersion(), this.client.acceptLanguage(), gatewayParameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NodeResourceInner object if successful. + */ + public NodeResourceInner create(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password) { + return createWithServiceResponseAsync(resourceGroupName, nodeName, location, tags, gatewayId, connectionName, userName, password).toBlocking().last().body(); + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, nodeName, location, tags, gatewayId, connectionName, userName, password), serviceCallback); + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password) { + return createWithServiceResponseAsync(resourceGroupName, nodeName, location, tags, gatewayId, connectionName, userName, password).map(new Func1, NodeResourceInner>() { + @Override + public NodeResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + NodeParameters gatewayParameters = new NodeParameters(); + gatewayParameters.withLocation(location); + gatewayParameters.withTags(tags); + gatewayParameters.withGatewayId(gatewayId); + gatewayParameters.withConnectionName(connectionName); + gatewayParameters.withUserName(userName); + gatewayParameters.withPassword(password); + Observable> observable = service.create(this.client.subscriptionId(), resourceGroupName, nodeName, this.client.apiVersion(), this.client.acceptLanguage(), gatewayParameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NodeResourceInner object if successful. + */ + public NodeResourceInner beginCreate(String resourceGroupName, String nodeName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, nodeName).toBlocking().single().body(); + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @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 nodeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, nodeName), serviceCallback); + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NodeResourceInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String nodeName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, nodeName).map(new Func1, NodeResourceInner>() { + @Override + public NodeResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NodeResourceInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String nodeName) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String location = null; + final Object tags = null; + final String gatewayId = null; + final String connectionName = null; + final String userName = null; + final String password = null; + NodeParameters gatewayParameters = new NodeParameters(); + gatewayParameters.withLocation(null); + gatewayParameters.withTags(null); + gatewayParameters.withGatewayId(null); + gatewayParameters.withConnectionName(null); + gatewayParameters.withUserName(null); + gatewayParameters.withPassword(null); + return service.beginCreate(this.client.subscriptionId(), resourceGroupName, nodeName, this.client.apiVersion(), this.client.acceptLanguage(), gatewayParameters, 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); + } + } + }); + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NodeResourceInner object if successful. + */ + public NodeResourceInner beginCreate(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password) { + return beginCreateWithServiceResponseAsync(resourceGroupName, nodeName, location, tags, gatewayId, connectionName, userName, password).toBlocking().single().body(); + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateAsync(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, nodeName, location, tags, gatewayId, connectionName, userName, password), serviceCallback); + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NodeResourceInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password) { + return beginCreateWithServiceResponseAsync(resourceGroupName, nodeName, location, tags, gatewayId, connectionName, userName, password).map(new Func1, NodeResourceInner>() { + @Override + public NodeResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NodeResourceInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + NodeParameters gatewayParameters = new NodeParameters(); + gatewayParameters.withLocation(location); + gatewayParameters.withTags(tags); + gatewayParameters.withGatewayId(gatewayId); + gatewayParameters.withConnectionName(connectionName); + gatewayParameters.withUserName(userName); + gatewayParameters.withPassword(password); + return service.beginCreate(this.client.subscriptionId(), resourceGroupName, nodeName, this.client.apiVersion(), this.client.acceptLanguage(), gatewayParameters, 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 ErrorException, 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(ErrorException.class) + .build(response); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NodeResourceInner object if successful. + */ + public NodeResourceInner update(String resourceGroupName, String nodeName) { + return updateWithServiceResponseAsync(resourceGroupName, nodeName).toBlocking().last().body(); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @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 nodeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, nodeName), serviceCallback); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String nodeName) { + return updateWithServiceResponseAsync(resourceGroupName, nodeName).map(new Func1, NodeResourceInner>() { + @Override + public NodeResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String nodeName) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String location = null; + final Object tags = null; + final String gatewayId = null; + final String connectionName = null; + final String userName = null; + final String password = null; + NodeParameters nodeParameters = new NodeParameters(); + nodeParameters.withLocation(null); + nodeParameters.withTags(null); + nodeParameters.withGatewayId(null); + nodeParameters.withConnectionName(null); + nodeParameters.withUserName(null); + nodeParameters.withPassword(null); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, nodeName, this.client.apiVersion(), this.client.acceptLanguage(), nodeParameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NodeResourceInner object if successful. + */ + public NodeResourceInner update(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password) { + return updateWithServiceResponseAsync(resourceGroupName, nodeName, location, tags, gatewayId, connectionName, userName, password).toBlocking().last().body(); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, nodeName, location, tags, gatewayId, connectionName, userName, password), serviceCallback); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password) { + return updateWithServiceResponseAsync(resourceGroupName, nodeName, location, tags, gatewayId, connectionName, userName, password).map(new Func1, NodeResourceInner>() { + @Override + public NodeResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + NodeParameters nodeParameters = new NodeParameters(); + nodeParameters.withLocation(location); + nodeParameters.withTags(tags); + nodeParameters.withGatewayId(gatewayId); + nodeParameters.withConnectionName(connectionName); + nodeParameters.withUserName(userName); + nodeParameters.withPassword(password); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, nodeName, this.client.apiVersion(), this.client.acceptLanguage(), nodeParameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NodeResourceInner object if successful. + */ + public NodeResourceInner beginUpdate(String resourceGroupName, String nodeName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, nodeName).toBlocking().single().body(); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @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 nodeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, nodeName), serviceCallback); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NodeResourceInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String nodeName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, nodeName).map(new Func1, NodeResourceInner>() { + @Override + public NodeResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NodeResourceInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String nodeName) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String location = null; + final Object tags = null; + final String gatewayId = null; + final String connectionName = null; + final String userName = null; + final String password = null; + NodeParameters nodeParameters = new NodeParameters(); + nodeParameters.withLocation(null); + nodeParameters.withTags(null); + nodeParameters.withGatewayId(null); + nodeParameters.withConnectionName(null); + nodeParameters.withUserName(null); + nodeParameters.withPassword(null); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, nodeName, this.client.apiVersion(), this.client.acceptLanguage(), nodeParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NodeResourceInner object if successful. + */ + public NodeResourceInner beginUpdate(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, nodeName, location, tags, gatewayId, connectionName, userName, password).toBlocking().single().body(); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, nodeName, location, tags, gatewayId, connectionName, userName, password), serviceCallback); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NodeResourceInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, nodeName, location, tags, gatewayId, connectionName, userName, password).map(new Func1, NodeResourceInner>() { + @Override + public NodeResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param location Location of the resource. + * @param tags Resource tags. + * @param gatewayId Gateway ID which will manage this node. + * @param connectionName myhost.domain.com + * @param userName User name to be used to connect to node. + * @param password Password associated with user name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NodeResourceInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String nodeName, String location, Object tags, String gatewayId, String connectionName, String userName, String password) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + NodeParameters nodeParameters = new NodeParameters(); + nodeParameters.withLocation(location); + nodeParameters.withTags(tags); + nodeParameters.withGatewayId(gatewayId); + nodeParameters.withConnectionName(connectionName); + nodeParameters.withUserName(userName); + nodeParameters.withPassword(password); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, nodeName, this.client.apiVersion(), this.client.acceptLanguage(), nodeParameters, 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 ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * deletes a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException 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 nodeName) { + deleteWithServiceResponseAsync(resourceGroupName, nodeName).toBlocking().single().body(); + } + + /** + * deletes a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @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 nodeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, nodeName), serviceCallback); + } + + /** + * deletes a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String nodeName) { + return deleteWithServiceResponseAsync(resourceGroupName, nodeName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * deletes a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String nodeName) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, nodeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Gets a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NodeResourceInner object if successful. + */ + public NodeResourceInner getByResourceGroup(String resourceGroupName, String nodeName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, nodeName).toBlocking().single().body(); + } + + /** + * Gets a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @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 nodeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, nodeName), serviceCallback); + } + + /** + * Gets a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NodeResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String nodeName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, nodeName).map(new Func1, NodeResourceInner>() { + @Override + public NodeResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a management node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NodeResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String nodeName) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName 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, nodeName, 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 ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Lists nodes in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException 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<NodeResourceInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists nodes in a subscription. + * + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists nodes in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists nodes in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .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(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists nodes in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Lists nodes in a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException 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<NodeResourceInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists nodes in a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @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> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists nodes in a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeResourceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists nodes in a resource group. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NodeResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .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(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists nodes in a resource group. + * + ServiceResponse> * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Lists nodes in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException 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<NodeResourceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists nodes in a subscription. + * + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists nodes in a subscription. + * + * @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<NodeResourceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists nodes in a subscription. + * + * @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<NodeResourceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(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(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists nodes in a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(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.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Lists nodes in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException 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<NodeResourceInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists nodes in a resource group. + * + * @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> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists nodes in a resource group. + * + * @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<NodeResourceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists nodes in a resource group. + * + * @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<NodeResourceInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(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(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists nodes in a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NodeResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PageImpl.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PageImpl.java new file mode 100644 index 00000000000..db9a425de73 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/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.servermanagement.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellCommandResultsInner.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellCommandResultsInner.java new file mode 100644 index 00000000000..d1e3a4ba6b5 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellCommandResultsInner.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement.implementation; + +import java.util.List; +import com.microsoft.azure.management.servermanagement.PowerShellCommandResult; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A collection of results from a PowerShell command. + */ +public class PowerShellCommandResultsInner { + /** + * The results property. + */ + @JsonProperty(value = "results") + private List results; + + /** + * The pssession property. + */ + @JsonProperty(value = "pssession") + private String pssession; + + /** + * The command property. + */ + @JsonProperty(value = "command") + private String command; + + /** + * The completed property. + */ + @JsonProperty(value = "completed") + private Boolean completed; + + /** + * Get the results value. + * + * @return the results value + */ + public List results() { + return this.results; + } + + /** + * Set the results value. + * + * @param results the results value to set + * @return the PowerShellCommandResultsInner object itself. + */ + public PowerShellCommandResultsInner withResults(List results) { + this.results = results; + return this; + } + + /** + * Get the pssession value. + * + * @return the pssession value + */ + public String pssession() { + return this.pssession; + } + + /** + * Set the pssession value. + * + * @param pssession the pssession value to set + * @return the PowerShellCommandResultsInner object itself. + */ + public PowerShellCommandResultsInner withPssession(String pssession) { + this.pssession = pssession; + return this; + } + + /** + * Get the command value. + * + * @return the command value + */ + public String command() { + return this.command; + } + + /** + * Set the command value. + * + * @param command the command value to set + * @return the PowerShellCommandResultsInner object itself. + */ + public PowerShellCommandResultsInner withCommand(String command) { + this.command = command; + return this; + } + + /** + * Get the completed value. + * + * @return the completed value + */ + public Boolean completed() { + return this.completed; + } + + /** + * Set the completed value. + * + * @param completed the completed value to set + * @return the PowerShellCommandResultsInner object itself. + */ + public PowerShellCommandResultsInner withCompleted(Boolean completed) { + this.completed = completed; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellCommandStatusInner.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellCommandStatusInner.java new file mode 100644 index 00000000000..0ccc8ffcf20 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellCommandStatusInner.java @@ -0,0 +1,154 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement.implementation; + +import java.util.List; +import com.microsoft.azure.management.servermanagement.PowerShellCommandResult; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Result status from invoking a PowerShell command. + */ +@JsonFlatten +@SkipParentValidation +public class PowerShellCommandStatusInner extends Resource { + /** + * The results property. + */ + @JsonProperty(value = "properties.results") + private List results; + + /** + * The pssession property. + */ + @JsonProperty(value = "properties.pssession") + private String pssession; + + /** + * The command property. + */ + @JsonProperty(value = "properties.command") + private String command; + + /** + * The completed property. + */ + @JsonProperty(value = "properties.completed") + private Boolean completed; + + /** + * The etag property. + */ + @JsonProperty(value = "etag") + private String etag; + + /** + * Get the results value. + * + * @return the results value + */ + public List results() { + return this.results; + } + + /** + * Set the results value. + * + * @param results the results value to set + * @return the PowerShellCommandStatusInner object itself. + */ + public PowerShellCommandStatusInner withResults(List results) { + this.results = results; + return this; + } + + /** + * Get the pssession value. + * + * @return the pssession value + */ + public String pssession() { + return this.pssession; + } + + /** + * Set the pssession value. + * + * @param pssession the pssession value to set + * @return the PowerShellCommandStatusInner object itself. + */ + public PowerShellCommandStatusInner withPssession(String pssession) { + this.pssession = pssession; + return this; + } + + /** + * Get the command value. + * + * @return the command value + */ + public String command() { + return this.command; + } + + /** + * Set the command value. + * + * @param command the command value to set + * @return the PowerShellCommandStatusInner object itself. + */ + public PowerShellCommandStatusInner withCommand(String command) { + this.command = command; + return this; + } + + /** + * Get the completed value. + * + * @return the completed value + */ + public Boolean completed() { + return this.completed; + } + + /** + * Set the completed value. + * + * @param completed the completed value to set + * @return the PowerShellCommandStatusInner object itself. + */ + public PowerShellCommandStatusInner withCompleted(Boolean completed) { + this.completed = completed; + return this; + } + + /** + * Get the etag value. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag value. + * + * @param etag the etag value to set + * @return the PowerShellCommandStatusInner object itself. + */ + public PowerShellCommandStatusInner withEtag(String etag) { + this.etag = etag; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellSessionResourceInner.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellSessionResourceInner.java new file mode 100644 index 00000000000..5a48b32c79d --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellSessionResourceInner.java @@ -0,0 +1,233 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.servermanagement.Version; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A PowerShell session resource (practically equivalent to a runspace + * instance). + */ +@JsonFlatten +@SkipParentValidation +public class PowerShellSessionResourceInner extends Resource { + /** + * The PowerShell Session ID. + */ + @JsonProperty(value = "properties.sessionId") + private String sessionId; + + /** + * The runspace state. + */ + @JsonProperty(value = "properties.state") + private String state; + + /** + * The availability of the runspace. + */ + @JsonProperty(value = "properties.runspaceAvailability") + private String runspaceAvailability; + + /** + * Timestamp of last time the service disconnected from the runspace. + */ + @JsonProperty(value = "properties.disconnectedOn") + private DateTime disconnectedOn; + + /** + * Timestamp when the runspace expires. + */ + @JsonProperty(value = "properties.expiresOn") + private DateTime expiresOn; + + /** + * The version property. + */ + @JsonProperty(value = "properties.version") + private Version version; + + /** + * Name of the runspace. + */ + @JsonProperty(value = "properties.name") + private String powerShellSessionResourceName; + + /** + * The etag property. + */ + @JsonProperty(value = "etag") + private String etag; + + /** + * Get the PowerShell Session ID. + * + * @return the sessionId value + */ + public String sessionId() { + return this.sessionId; + } + + /** + * Set the PowerShell Session ID. + * + * @param sessionId the sessionId value to set + * @return the PowerShellSessionResourceInner object itself. + */ + public PowerShellSessionResourceInner withSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + /** + * Get the runspace state. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Set the runspace state. + * + * @param state the state value to set + * @return the PowerShellSessionResourceInner object itself. + */ + public PowerShellSessionResourceInner withState(String state) { + this.state = state; + return this; + } + + /** + * Get the availability of the runspace. + * + * @return the runspaceAvailability value + */ + public String runspaceAvailability() { + return this.runspaceAvailability; + } + + /** + * Set the availability of the runspace. + * + * @param runspaceAvailability the runspaceAvailability value to set + * @return the PowerShellSessionResourceInner object itself. + */ + public PowerShellSessionResourceInner withRunspaceAvailability(String runspaceAvailability) { + this.runspaceAvailability = runspaceAvailability; + return this; + } + + /** + * Get timestamp of last time the service disconnected from the runspace. + * + * @return the disconnectedOn value + */ + public DateTime disconnectedOn() { + return this.disconnectedOn; + } + + /** + * Set timestamp of last time the service disconnected from the runspace. + * + * @param disconnectedOn the disconnectedOn value to set + * @return the PowerShellSessionResourceInner object itself. + */ + public PowerShellSessionResourceInner withDisconnectedOn(DateTime disconnectedOn) { + this.disconnectedOn = disconnectedOn; + return this; + } + + /** + * Get timestamp when the runspace expires. + * + * @return the expiresOn value + */ + public DateTime expiresOn() { + return this.expiresOn; + } + + /** + * Set timestamp when the runspace expires. + * + * @param expiresOn the expiresOn value to set + * @return the PowerShellSessionResourceInner object itself. + */ + public PowerShellSessionResourceInner withExpiresOn(DateTime expiresOn) { + this.expiresOn = expiresOn; + return this; + } + + /** + * Get the version value. + * + * @return the version value + */ + public Version version() { + return this.version; + } + + /** + * Set the version value. + * + * @param version the version value to set + * @return the PowerShellSessionResourceInner object itself. + */ + public PowerShellSessionResourceInner withVersion(Version version) { + this.version = version; + return this; + } + + /** + * Get name of the runspace. + * + * @return the powerShellSessionResourceName value + */ + public String powerShellSessionResourceName() { + return this.powerShellSessionResourceName; + } + + /** + * Set name of the runspace. + * + * @param powerShellSessionResourceName the powerShellSessionResourceName value to set + * @return the PowerShellSessionResourceInner object itself. + */ + public PowerShellSessionResourceInner withPowerShellSessionResourceName(String powerShellSessionResourceName) { + this.powerShellSessionResourceName = powerShellSessionResourceName; + return this; + } + + /** + * Get the etag value. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag value. + * + * @param etag the etag value to set + * @return the PowerShellSessionResourceInner object itself. + */ + public PowerShellSessionResourceInner withEtag(String etag) { + this.etag = etag; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellSessionResourcesInner.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellSessionResourcesInner.java new file mode 100644 index 00000000000..05b947dbced --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellSessionResourcesInner.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.servermanagement.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A collection of PowerShell session resources. + */ +public class PowerShellSessionResourcesInner { + /** + * Collection of PowerShell session resources. + */ + @JsonProperty(value = "value") + private List value; + + /** + * The URL to the next set of resources. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get collection of PowerShell session resources. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set collection of PowerShell session resources. + * + * @param value the value value to set + * @return the PowerShellSessionResourcesInner object itself. + */ + public PowerShellSessionResourcesInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the URL to the next set of resources. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the URL to the next set of resources. + * + * @param nextLink the nextLink value to set + * @return the PowerShellSessionResourcesInner object itself. + */ + public PowerShellSessionResourcesInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellTabCompletionResultsInner.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellTabCompletionResultsInner.java new file mode 100644 index 00000000000..10bf3ce603f --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellTabCompletionResultsInner.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.servermanagement.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An array of strings representing the different values that can be selected + * through. + */ +public class PowerShellTabCompletionResultsInner { + /** + * The results property. + */ + @JsonProperty(value = "results") + private List results; + + /** + * Get the results value. + * + * @return the results value + */ + public List results() { + return this.results; + } + + /** + * Set the results value. + * + * @param results the results value to set + * @return the PowerShellTabCompletionResultsInner object itself. + */ + public PowerShellTabCompletionResultsInner withResults(List results) { + this.results = results; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellsInner.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellsInner.java new file mode 100644 index 00000000000..a4e1369f0bb --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/PowerShellsInner.java @@ -0,0 +1,1529 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.servermanagement.ErrorException; +import com.microsoft.azure.management.servermanagement.PowerShellCommandParameters; +import com.microsoft.azure.management.servermanagement.PowerShellExpandOption; +import com.microsoft.azure.management.servermanagement.PowerShellTabCompletionParameters; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PowerShells. + */ +public class PowerShellsInner { + /** The Retrofit service to perform REST calls. */ + private PowerShellsService service; + /** The service client containing this operation class. */ + private ServerManagementImpl client; + + /** + * Initializes an instance of PowerShellsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PowerShellsInner(Retrofit retrofit, ServerManagementImpl client) { + this.service = retrofit.create(PowerShellsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PowerShells to be + * used by Retrofit to perform actually REST calls. + */ + interface PowerShellsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.PowerShells listSession" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions") + Observable> listSession(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @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.servermanagement.PowerShells createSession" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}") + Observable> createSession(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @Path("pssession") String pssession, @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.servermanagement.PowerShells beginCreateSession" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}") + Observable> beginCreateSession(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @Path("pssession") String pssession, @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.servermanagement.PowerShells getCommandStatus" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}") + Observable> getCommandStatus(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @Path("pssession") String pssession, @Query("api-version") String apiVersion, @Query("$expand") PowerShellExpandOption expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.PowerShells updateCommand" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}") + Observable> updateCommand(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @Path("pssession") String pssession, @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.servermanagement.PowerShells beginUpdateCommand" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}") + Observable> beginUpdateCommand(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @Path("pssession") String pssession, @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.servermanagement.PowerShells invokeCommand" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/invokeCommand") + Observable> invokeCommand(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @Path("pssession") String pssession, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body PowerShellCommandParameters powerShellCommandParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.PowerShells beginInvokeCommand" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/invokeCommand") + Observable> beginInvokeCommand(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @Path("pssession") String pssession, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body PowerShellCommandParameters powerShellCommandParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.PowerShells cancelCommand" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/cancel") + Observable> cancelCommand(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @Path("pssession") String pssession, @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.servermanagement.PowerShells beginCancelCommand" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/cancel") + Observable> beginCancelCommand(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @Path("pssession") String pssession, @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.servermanagement.PowerShells tabCompletion" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}/features/powerShellConsole/pssessions/{pssession}/tab") + Observable> tabCompletion(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @Path("pssession") String pssession, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body PowerShellTabCompletionParameters powerShellTabCompletionParamters, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of the active sessions. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellSessionResourcesInner object if successful. + */ + public PowerShellSessionResourcesInner listSession(String resourceGroupName, String nodeName, String session) { + return listSessionWithServiceResponseAsync(resourceGroupName, nodeName, session).toBlocking().single().body(); + } + + /** + * Gets a list of the active sessions. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @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 listSessionAsync(String resourceGroupName, String nodeName, String session, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listSessionWithServiceResponseAsync(resourceGroupName, nodeName, session), serviceCallback); + } + + /** + * Gets a list of the active sessions. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellSessionResourcesInner object + */ + public Observable listSessionAsync(String resourceGroupName, String nodeName, String session) { + return listSessionWithServiceResponseAsync(resourceGroupName, nodeName, session).map(new Func1, PowerShellSessionResourcesInner>() { + @Override + public PowerShellSessionResourcesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a list of the active sessions. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellSessionResourcesInner object + */ + public Observable> listSessionWithServiceResponseAsync(String resourceGroupName, String nodeName, String session) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session 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.listSession(this.client.subscriptionId(), resourceGroupName, nodeName, session, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listSessionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listSessionDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Creates a PowerShell session. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellSessionResourceInner object if successful. + */ + public PowerShellSessionResourceInner createSession(String resourceGroupName, String nodeName, String session, String pssession) { + return createSessionWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).toBlocking().last().body(); + } + + /** + * Creates a PowerShell session. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @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 createSessionAsync(String resourceGroupName, String nodeName, String session, String pssession, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createSessionWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession), serviceCallback); + } + + /** + * Creates a PowerShell session. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createSessionAsync(String resourceGroupName, String nodeName, String session, String pssession) { + return createSessionWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).map(new Func1, PowerShellSessionResourceInner>() { + @Override + public PowerShellSessionResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a PowerShell session. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createSessionWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String pssession) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (pssession == null) { + throw new IllegalArgumentException("Parameter pssession 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.createSession(this.client.subscriptionId(), resourceGroupName, nodeName, session, pssession, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a PowerShell session. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellSessionResourceInner object if successful. + */ + public PowerShellSessionResourceInner beginCreateSession(String resourceGroupName, String nodeName, String session, String pssession) { + return beginCreateSessionWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).toBlocking().single().body(); + } + + /** + * Creates a PowerShell session. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @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 beginCreateSessionAsync(String resourceGroupName, String nodeName, String session, String pssession, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateSessionWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession), serviceCallback); + } + + /** + * Creates a PowerShell session. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellSessionResourceInner object + */ + public Observable beginCreateSessionAsync(String resourceGroupName, String nodeName, String session, String pssession) { + return beginCreateSessionWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).map(new Func1, PowerShellSessionResourceInner>() { + @Override + public PowerShellSessionResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a PowerShell session. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellSessionResourceInner object + */ + public Observable> beginCreateSessionWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String pssession) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (pssession == null) { + throw new IllegalArgumentException("Parameter pssession 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.beginCreateSession(this.client.subscriptionId(), resourceGroupName, nodeName, session, pssession, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateSessionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateSessionDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Gets the status of a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellCommandStatusInner object if successful. + */ + public PowerShellCommandStatusInner getCommandStatus(String resourceGroupName, String nodeName, String session, String pssession) { + return getCommandStatusWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).toBlocking().single().body(); + } + + /** + * Gets the status of a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @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 getCommandStatusAsync(String resourceGroupName, String nodeName, String session, String pssession, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getCommandStatusWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession), serviceCallback); + } + + /** + * Gets the status of a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellCommandStatusInner object + */ + public Observable getCommandStatusAsync(String resourceGroupName, String nodeName, String session, String pssession) { + return getCommandStatusWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).map(new Func1, PowerShellCommandStatusInner>() { + @Override + public PowerShellCommandStatusInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the status of a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellCommandStatusInner object + */ + public Observable> getCommandStatusWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String pssession) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (pssession == null) { + throw new IllegalArgumentException("Parameter pssession is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final PowerShellExpandOption expand = null; + return service.getCommandStatus(this.client.subscriptionId(), resourceGroupName, nodeName, session, pssession, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getCommandStatusDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the status of a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param expand Gets current output from an ongoing call. Possible values include: 'output' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellCommandStatusInner object if successful. + */ + public PowerShellCommandStatusInner getCommandStatus(String resourceGroupName, String nodeName, String session, String pssession, PowerShellExpandOption expand) { + return getCommandStatusWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession, expand).toBlocking().single().body(); + } + + /** + * Gets the status of a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param expand Gets current output from an ongoing call. Possible values include: 'output' + * @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 getCommandStatusAsync(String resourceGroupName, String nodeName, String session, String pssession, PowerShellExpandOption expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getCommandStatusWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession, expand), serviceCallback); + } + + /** + * Gets the status of a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param expand Gets current output from an ongoing call. Possible values include: 'output' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellCommandStatusInner object + */ + public Observable getCommandStatusAsync(String resourceGroupName, String nodeName, String session, String pssession, PowerShellExpandOption expand) { + return getCommandStatusWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession, expand).map(new Func1, PowerShellCommandStatusInner>() { + @Override + public PowerShellCommandStatusInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the status of a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param expand Gets current output from an ongoing call. Possible values include: 'output' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellCommandStatusInner object + */ + public Observable> getCommandStatusWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String pssession, PowerShellExpandOption expand) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (pssession == null) { + throw new IllegalArgumentException("Parameter pssession 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.getCommandStatus(this.client.subscriptionId(), resourceGroupName, nodeName, session, pssession, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getCommandStatusDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getCommandStatusDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Updates a running PowerShell command with more data. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellCommandResultsInner object if successful. + */ + public PowerShellCommandResultsInner updateCommand(String resourceGroupName, String nodeName, String session, String pssession) { + return updateCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).toBlocking().last().body(); + } + + /** + * Updates a running PowerShell command with more data. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @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 updateCommandAsync(String resourceGroupName, String nodeName, String session, String pssession, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession), serviceCallback); + } + + /** + * Updates a running PowerShell command with more data. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateCommandAsync(String resourceGroupName, String nodeName, String session, String pssession) { + return updateCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).map(new Func1, PowerShellCommandResultsInner>() { + @Override + public PowerShellCommandResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a running PowerShell command with more data. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateCommandWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String pssession) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (pssession == null) { + throw new IllegalArgumentException("Parameter pssession 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.updateCommand(this.client.subscriptionId(), resourceGroupName, nodeName, session, pssession, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a running PowerShell command with more data. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellCommandResultsInner object if successful. + */ + public PowerShellCommandResultsInner beginUpdateCommand(String resourceGroupName, String nodeName, String session, String pssession) { + return beginUpdateCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).toBlocking().single().body(); + } + + /** + * Updates a running PowerShell command with more data. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @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 beginUpdateCommandAsync(String resourceGroupName, String nodeName, String session, String pssession, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession), serviceCallback); + } + + /** + * Updates a running PowerShell command with more data. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellCommandResultsInner object + */ + public Observable beginUpdateCommandAsync(String resourceGroupName, String nodeName, String session, String pssession) { + return beginUpdateCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).map(new Func1, PowerShellCommandResultsInner>() { + @Override + public PowerShellCommandResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a running PowerShell command with more data. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellCommandResultsInner object + */ + public Observable> beginUpdateCommandWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String pssession) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (pssession == null) { + throw new IllegalArgumentException("Parameter pssession 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.beginUpdateCommand(this.client.subscriptionId(), resourceGroupName, nodeName, session, pssession, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateCommandDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateCommandDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellCommandResultsInner object if successful. + */ + public PowerShellCommandResultsInner invokeCommand(String resourceGroupName, String nodeName, String session, String pssession) { + return invokeCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).toBlocking().last().body(); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @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 invokeCommandAsync(String resourceGroupName, String nodeName, String session, String pssession, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(invokeCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession), serviceCallback); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable invokeCommandAsync(String resourceGroupName, String nodeName, String session, String pssession) { + return invokeCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).map(new Func1, PowerShellCommandResultsInner>() { + @Override + public PowerShellCommandResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> invokeCommandWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String pssession) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (pssession == null) { + throw new IllegalArgumentException("Parameter pssession is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String command = null; + PowerShellCommandParameters powerShellCommandParameters = new PowerShellCommandParameters(); + powerShellCommandParameters.withCommand(null); + Observable> observable = service.invokeCommand(this.client.subscriptionId(), resourceGroupName, nodeName, session, pssession, this.client.apiVersion(), this.client.acceptLanguage(), powerShellCommandParameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param command Script to execute. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellCommandResultsInner object if successful. + */ + public PowerShellCommandResultsInner invokeCommand(String resourceGroupName, String nodeName, String session, String pssession, String command) { + return invokeCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession, command).toBlocking().last().body(); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param command Script to execute. + * @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 invokeCommandAsync(String resourceGroupName, String nodeName, String session, String pssession, String command, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(invokeCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession, command), serviceCallback); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param command Script to execute. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable invokeCommandAsync(String resourceGroupName, String nodeName, String session, String pssession, String command) { + return invokeCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession, command).map(new Func1, PowerShellCommandResultsInner>() { + @Override + public PowerShellCommandResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param command Script to execute. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> invokeCommandWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String pssession, String command) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (pssession == null) { + throw new IllegalArgumentException("Parameter pssession is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + PowerShellCommandParameters powerShellCommandParameters = new PowerShellCommandParameters(); + powerShellCommandParameters.withCommand(command); + Observable> observable = service.invokeCommand(this.client.subscriptionId(), resourceGroupName, nodeName, session, pssession, this.client.apiVersion(), this.client.acceptLanguage(), powerShellCommandParameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellCommandResultsInner object if successful. + */ + public PowerShellCommandResultsInner beginInvokeCommand(String resourceGroupName, String nodeName, String session, String pssession) { + return beginInvokeCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).toBlocking().single().body(); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @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 beginInvokeCommandAsync(String resourceGroupName, String nodeName, String session, String pssession, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginInvokeCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession), serviceCallback); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellCommandResultsInner object + */ + public Observable beginInvokeCommandAsync(String resourceGroupName, String nodeName, String session, String pssession) { + return beginInvokeCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).map(new Func1, PowerShellCommandResultsInner>() { + @Override + public PowerShellCommandResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellCommandResultsInner object + */ + public Observable> beginInvokeCommandWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String pssession) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (pssession == null) { + throw new IllegalArgumentException("Parameter pssession is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String command = null; + PowerShellCommandParameters powerShellCommandParameters = new PowerShellCommandParameters(); + powerShellCommandParameters.withCommand(null); + return service.beginInvokeCommand(this.client.subscriptionId(), resourceGroupName, nodeName, session, pssession, this.client.apiVersion(), this.client.acceptLanguage(), powerShellCommandParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginInvokeCommandDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param command Script to execute. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellCommandResultsInner object if successful. + */ + public PowerShellCommandResultsInner beginInvokeCommand(String resourceGroupName, String nodeName, String session, String pssession, String command) { + return beginInvokeCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession, command).toBlocking().single().body(); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param command Script to execute. + * @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 beginInvokeCommandAsync(String resourceGroupName, String nodeName, String session, String pssession, String command, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginInvokeCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession, command), serviceCallback); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param command Script to execute. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellCommandResultsInner object + */ + public Observable beginInvokeCommandAsync(String resourceGroupName, String nodeName, String session, String pssession, String command) { + return beginInvokeCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession, command).map(new Func1, PowerShellCommandResultsInner>() { + @Override + public PowerShellCommandResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a PowerShell script and invokes it. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param command Script to execute. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellCommandResultsInner object + */ + public Observable> beginInvokeCommandWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String pssession, String command) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (pssession == null) { + throw new IllegalArgumentException("Parameter pssession is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + PowerShellCommandParameters powerShellCommandParameters = new PowerShellCommandParameters(); + powerShellCommandParameters.withCommand(command); + return service.beginInvokeCommand(this.client.subscriptionId(), resourceGroupName, nodeName, session, pssession, this.client.apiVersion(), this.client.acceptLanguage(), powerShellCommandParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginInvokeCommandDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginInvokeCommandDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Cancels a PowerShell command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellCommandResultsInner object if successful. + */ + public PowerShellCommandResultsInner cancelCommand(String resourceGroupName, String nodeName, String session, String pssession) { + return cancelCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).toBlocking().last().body(); + } + + /** + * Cancels a PowerShell command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @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 cancelCommandAsync(String resourceGroupName, String nodeName, String session, String pssession, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession), serviceCallback); + } + + /** + * Cancels a PowerShell command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable cancelCommandAsync(String resourceGroupName, String nodeName, String session, String pssession) { + return cancelCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).map(new Func1, PowerShellCommandResultsInner>() { + @Override + public PowerShellCommandResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a PowerShell command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> cancelCommandWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String pssession) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (pssession == null) { + throw new IllegalArgumentException("Parameter pssession 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.cancelCommand(this.client.subscriptionId(), resourceGroupName, nodeName, session, pssession, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Cancels a PowerShell command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellCommandResultsInner object if successful. + */ + public PowerShellCommandResultsInner beginCancelCommand(String resourceGroupName, String nodeName, String session, String pssession) { + return beginCancelCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).toBlocking().single().body(); + } + + /** + * Cancels a PowerShell command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @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 beginCancelCommandAsync(String resourceGroupName, String nodeName, String session, String pssession, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCancelCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession), serviceCallback); + } + + /** + * Cancels a PowerShell command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellCommandResultsInner object + */ + public Observable beginCancelCommandAsync(String resourceGroupName, String nodeName, String session, String pssession) { + return beginCancelCommandWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).map(new Func1, PowerShellCommandResultsInner>() { + @Override + public PowerShellCommandResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a PowerShell command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellCommandResultsInner object + */ + public Observable> beginCancelCommandWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String pssession) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (pssession == null) { + throw new IllegalArgumentException("Parameter pssession 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.beginCancelCommand(this.client.subscriptionId(), resourceGroupName, nodeName, session, pssession, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCancelCommandDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCancelCommandDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Gets tab completion values for a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellTabCompletionResultsInner object if successful. + */ + public PowerShellTabCompletionResultsInner tabCompletion(String resourceGroupName, String nodeName, String session, String pssession) { + return tabCompletionWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).toBlocking().single().body(); + } + + /** + * Gets tab completion values for a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @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 tabCompletionAsync(String resourceGroupName, String nodeName, String session, String pssession, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(tabCompletionWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession), serviceCallback); + } + + /** + * Gets tab completion values for a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellTabCompletionResultsInner object + */ + public Observable tabCompletionAsync(String resourceGroupName, String nodeName, String session, String pssession) { + return tabCompletionWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession).map(new Func1, PowerShellTabCompletionResultsInner>() { + @Override + public PowerShellTabCompletionResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets tab completion values for a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellTabCompletionResultsInner object + */ + public Observable> tabCompletionWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String pssession) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (pssession == null) { + throw new IllegalArgumentException("Parameter pssession is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String command = null; + PowerShellTabCompletionParameters powerShellTabCompletionParamters = new PowerShellTabCompletionParameters(); + powerShellTabCompletionParamters.withCommand(null); + return service.tabCompletion(this.client.subscriptionId(), resourceGroupName, nodeName, session, pssession, this.client.apiVersion(), this.client.acceptLanguage(), powerShellTabCompletionParamters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = tabCompletionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets tab completion values for a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param command Command to get tab completion for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PowerShellTabCompletionResultsInner object if successful. + */ + public PowerShellTabCompletionResultsInner tabCompletion(String resourceGroupName, String nodeName, String session, String pssession, String command) { + return tabCompletionWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession, command).toBlocking().single().body(); + } + + /** + * Gets tab completion values for a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param command Command to get tab completion for. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture tabCompletionAsync(String resourceGroupName, String nodeName, String session, String pssession, String command, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(tabCompletionWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession, command), serviceCallback); + } + + /** + * Gets tab completion values for a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param command Command to get tab completion for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellTabCompletionResultsInner object + */ + public Observable tabCompletionAsync(String resourceGroupName, String nodeName, String session, String pssession, String command) { + return tabCompletionWithServiceResponseAsync(resourceGroupName, nodeName, session, pssession, command).map(new Func1, PowerShellTabCompletionResultsInner>() { + @Override + public PowerShellTabCompletionResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets tab completion values for a command. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param pssession The PowerShell sessionId from the user. + * @param command Command to get tab completion for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PowerShellTabCompletionResultsInner object + */ + public Observable> tabCompletionWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String pssession, String command) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (pssession == null) { + throw new IllegalArgumentException("Parameter pssession is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + PowerShellTabCompletionParameters powerShellTabCompletionParamters = new PowerShellTabCompletionParameters(); + powerShellTabCompletionParamters.withCommand(command); + return service.tabCompletion(this.client.subscriptionId(), resourceGroupName, nodeName, session, pssession, this.client.apiVersion(), this.client.acceptLanguage(), powerShellTabCompletionParamters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = tabCompletionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse tabCompletionDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/ServerManagementImpl.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/ServerManagementImpl.java new file mode 100644 index 00000000000..f40a32fe1c7 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/ServerManagementImpl.java @@ -0,0 +1,238 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement.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 ServerManagementImpl class. + */ +public class ServerManagementImpl 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; + } + + /** Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ServerManagementImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client API Version. */ + private String apiVersion; + + /** + * Gets Client API Version. + * + * @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 ServerManagementImpl 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 ServerManagementImpl 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 ServerManagementImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The GatewaysInner object to access its operations. + */ + private GatewaysInner gateways; + + /** + * Gets the GatewaysInner object to access its operations. + * @return the GatewaysInner object. + */ + public GatewaysInner gateways() { + return this.gateways; + } + + /** + * The NodesInner object to access its operations. + */ + private NodesInner nodes; + + /** + * Gets the NodesInner object to access its operations. + * @return the NodesInner object. + */ + public NodesInner nodes() { + return this.nodes; + } + + /** + * The SessionsInner object to access its operations. + */ + private SessionsInner sessions; + + /** + * Gets the SessionsInner object to access its operations. + * @return the SessionsInner object. + */ + public SessionsInner sessions() { + return this.sessions; + } + + /** + * The PowerShellsInner object to access its operations. + */ + private PowerShellsInner powerShells; + + /** + * Gets the PowerShellsInner object to access its operations. + * @return the PowerShellsInner object. + */ + public PowerShellsInner powerShells() { + return this.powerShells; + } + + /** + * Initializes an instance of ServerManagement client. + * + * @param credentials the management credentials for Azure + */ + public ServerManagementImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of ServerManagement client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public ServerManagementImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of ServerManagement client. + * + * @param restClient the REST client to connect to Azure. + */ + public ServerManagementImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2016-07-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.gateways = new GatewaysInner(restClient().retrofit(), this); + this.nodes = new NodesInner(restClient().retrofit(), this); + this.sessions = new SessionsInner(restClient().retrofit(), this); + this.powerShells = new PowerShellsInner(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(), "ServerManagement", "2016-07-01-preview"); + } +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/SessionResourceInner.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/SessionResourceInner.java new file mode 100644 index 00000000000..bde74c9b304 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/SessionResourceInner.java @@ -0,0 +1,127 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * The session object. + */ +@JsonFlatten +@SkipParentValidation +public class SessionResourceInner extends Resource { + /** + * The username connecting to the session. + */ + @JsonProperty(value = "properties.userName") + private String userName; + + /** + * UTC date and time when node was first added to management service. + */ + @JsonProperty(value = "properties.created") + private DateTime created; + + /** + * UTC date and time when node was last updated. + */ + @JsonProperty(value = "properties.updated") + private DateTime updated; + + /** + * The etag property. + */ + @JsonProperty(value = "etag") + private String etag; + + /** + * Get the username connecting to the session. + * + * @return the userName value + */ + public String userName() { + return this.userName; + } + + /** + * Set the username connecting to the session. + * + * @param userName the userName value to set + * @return the SessionResourceInner object itself. + */ + public SessionResourceInner withUserName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get uTC date and time when node was first added to management service. + * + * @return the created value + */ + public DateTime created() { + return this.created; + } + + /** + * Set uTC date and time when node was first added to management service. + * + * @param created the created value to set + * @return the SessionResourceInner object itself. + */ + public SessionResourceInner withCreated(DateTime created) { + this.created = created; + return this; + } + + /** + * Get uTC date and time when node was last updated. + * + * @return the updated value + */ + public DateTime updated() { + return this.updated; + } + + /** + * Set uTC date and time when node was last updated. + * + * @param updated the updated value to set + * @return the SessionResourceInner object itself. + */ + public SessionResourceInner withUpdated(DateTime updated) { + this.updated = updated; + return this; + } + + /** + * Get the etag value. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag value. + * + * @param etag the etag value to set + * @return the SessionResourceInner object itself. + */ + public SessionResourceInner withEtag(String etag) { + this.etag = etag; + return this; + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/SessionsInner.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/SessionsInner.java new file mode 100644 index 00000000000..ac55ab55b0b --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/SessionsInner.java @@ -0,0 +1,670 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.servermanagement.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.servermanagement.CredentialDataFormat; +import com.microsoft.azure.management.servermanagement.ErrorException; +import com.microsoft.azure.management.servermanagement.RetentionPeriod; +import com.microsoft.azure.management.servermanagement.SessionParameters; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.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 Sessions. + */ +public class SessionsInner { + /** The Retrofit service to perform REST calls. */ + private SessionsService service; + /** The service client containing this operation class. */ + private ServerManagementImpl client; + + /** + * Initializes an instance of SessionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SessionsInner(Retrofit retrofit, ServerManagementImpl client) { + this.service = retrofit.create(SessionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Sessions to be + * used by Retrofit to perform actually REST calls. + */ + interface SessionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Sessions create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}") + Observable> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body SessionParameters sessionParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Sessions beginCreate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}") + Observable> beginCreate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body SessionParameters sessionParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.servermanagement.Sessions delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @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.servermanagement.Sessions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServerManagement/nodes/{nodeName}/sessions/{session}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("nodeName") String nodeName, @Path("session") String session, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SessionResourceInner object if successful. + */ + public SessionResourceInner create(String resourceGroupName, String nodeName, String session) { + return createWithServiceResponseAsync(resourceGroupName, nodeName, session).toBlocking().last().body(); + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @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 nodeName, String session, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, nodeName, session), serviceCallback); + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String nodeName, String session) { + return createWithServiceResponseAsync(resourceGroupName, nodeName, session).map(new Func1, SessionResourceInner>() { + @Override + public SessionResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String nodeName, String session) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String userName = null; + final String password = null; + final RetentionPeriod retentionPeriod = null; + final CredentialDataFormat credentialDataFormat = null; + final String encryptionCertificateThumbprint = null; + SessionParameters sessionParameters = new SessionParameters(); + sessionParameters.withUserName(null); + sessionParameters.withPassword(null); + sessionParameters.withRetentionPeriod(null); + sessionParameters.withCredentialDataFormat(null); + sessionParameters.withEncryptionCertificateThumbprint(null); + Observable> observable = service.create(this.client.subscriptionId(), resourceGroupName, nodeName, session, this.client.apiVersion(), this.client.acceptLanguage(), sessionParameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param userName Encrypted User name to be used to connect to node. + * @param password Encrypted Password associated with user name. + * @param retentionPeriod Session retention period. Possible values include: 'Session', 'Persistent' + * @param credentialDataFormat Credential data format. Possible values include: 'RsaEncrypted' + * @param encryptionCertificateThumbprint Encryption certificate thumbprint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SessionResourceInner object if successful. + */ + public SessionResourceInner create(String resourceGroupName, String nodeName, String session, String userName, String password, RetentionPeriod retentionPeriod, CredentialDataFormat credentialDataFormat, String encryptionCertificateThumbprint) { + return createWithServiceResponseAsync(resourceGroupName, nodeName, session, userName, password, retentionPeriod, credentialDataFormat, encryptionCertificateThumbprint).toBlocking().last().body(); + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param userName Encrypted User name to be used to connect to node. + * @param password Encrypted Password associated with user name. + * @param retentionPeriod Session retention period. Possible values include: 'Session', 'Persistent' + * @param credentialDataFormat Credential data format. Possible values include: 'RsaEncrypted' + * @param encryptionCertificateThumbprint Encryption certificate thumbprint. + * @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 nodeName, String session, String userName, String password, RetentionPeriod retentionPeriod, CredentialDataFormat credentialDataFormat, String encryptionCertificateThumbprint, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, nodeName, session, userName, password, retentionPeriod, credentialDataFormat, encryptionCertificateThumbprint), serviceCallback); + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param userName Encrypted User name to be used to connect to node. + * @param password Encrypted Password associated with user name. + * @param retentionPeriod Session retention period. Possible values include: 'Session', 'Persistent' + * @param credentialDataFormat Credential data format. Possible values include: 'RsaEncrypted' + * @param encryptionCertificateThumbprint Encryption certificate thumbprint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String nodeName, String session, String userName, String password, RetentionPeriod retentionPeriod, CredentialDataFormat credentialDataFormat, String encryptionCertificateThumbprint) { + return createWithServiceResponseAsync(resourceGroupName, nodeName, session, userName, password, retentionPeriod, credentialDataFormat, encryptionCertificateThumbprint).map(new Func1, SessionResourceInner>() { + @Override + public SessionResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param userName Encrypted User name to be used to connect to node. + * @param password Encrypted Password associated with user name. + * @param retentionPeriod Session retention period. Possible values include: 'Session', 'Persistent' + * @param credentialDataFormat Credential data format. Possible values include: 'RsaEncrypted' + * @param encryptionCertificateThumbprint Encryption certificate thumbprint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String userName, String password, RetentionPeriod retentionPeriod, CredentialDataFormat credentialDataFormat, String encryptionCertificateThumbprint) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + SessionParameters sessionParameters = new SessionParameters(); + sessionParameters.withUserName(userName); + sessionParameters.withPassword(password); + sessionParameters.withRetentionPeriod(retentionPeriod); + sessionParameters.withCredentialDataFormat(credentialDataFormat); + sessionParameters.withEncryptionCertificateThumbprint(encryptionCertificateThumbprint); + Observable> observable = service.create(this.client.subscriptionId(), resourceGroupName, nodeName, session, this.client.apiVersion(), this.client.acceptLanguage(), sessionParameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SessionResourceInner object if successful. + */ + public SessionResourceInner beginCreate(String resourceGroupName, String nodeName, String session) { + return beginCreateWithServiceResponseAsync(resourceGroupName, nodeName, session).toBlocking().single().body(); + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @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 nodeName, String session, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, nodeName, session), serviceCallback); + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SessionResourceInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String nodeName, String session) { + return beginCreateWithServiceResponseAsync(resourceGroupName, nodeName, session).map(new Func1, SessionResourceInner>() { + @Override + public SessionResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SessionResourceInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String nodeName, String session) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String userName = null; + final String password = null; + final RetentionPeriod retentionPeriod = null; + final CredentialDataFormat credentialDataFormat = null; + final String encryptionCertificateThumbprint = null; + SessionParameters sessionParameters = new SessionParameters(); + sessionParameters.withUserName(null); + sessionParameters.withPassword(null); + sessionParameters.withRetentionPeriod(null); + sessionParameters.withCredentialDataFormat(null); + sessionParameters.withEncryptionCertificateThumbprint(null); + return service.beginCreate(this.client.subscriptionId(), resourceGroupName, nodeName, session, this.client.apiVersion(), this.client.acceptLanguage(), sessionParameters, 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); + } + } + }); + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param userName Encrypted User name to be used to connect to node. + * @param password Encrypted Password associated with user name. + * @param retentionPeriod Session retention period. Possible values include: 'Session', 'Persistent' + * @param credentialDataFormat Credential data format. Possible values include: 'RsaEncrypted' + * @param encryptionCertificateThumbprint Encryption certificate thumbprint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SessionResourceInner object if successful. + */ + public SessionResourceInner beginCreate(String resourceGroupName, String nodeName, String session, String userName, String password, RetentionPeriod retentionPeriod, CredentialDataFormat credentialDataFormat, String encryptionCertificateThumbprint) { + return beginCreateWithServiceResponseAsync(resourceGroupName, nodeName, session, userName, password, retentionPeriod, credentialDataFormat, encryptionCertificateThumbprint).toBlocking().single().body(); + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param userName Encrypted User name to be used to connect to node. + * @param password Encrypted Password associated with user name. + * @param retentionPeriod Session retention period. Possible values include: 'Session', 'Persistent' + * @param credentialDataFormat Credential data format. Possible values include: 'RsaEncrypted' + * @param encryptionCertificateThumbprint Encryption certificate thumbprint. + * @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 nodeName, String session, String userName, String password, RetentionPeriod retentionPeriod, CredentialDataFormat credentialDataFormat, String encryptionCertificateThumbprint, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, nodeName, session, userName, password, retentionPeriod, credentialDataFormat, encryptionCertificateThumbprint), serviceCallback); + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param userName Encrypted User name to be used to connect to node. + * @param password Encrypted Password associated with user name. + * @param retentionPeriod Session retention period. Possible values include: 'Session', 'Persistent' + * @param credentialDataFormat Credential data format. Possible values include: 'RsaEncrypted' + * @param encryptionCertificateThumbprint Encryption certificate thumbprint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SessionResourceInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String nodeName, String session, String userName, String password, RetentionPeriod retentionPeriod, CredentialDataFormat credentialDataFormat, String encryptionCertificateThumbprint) { + return beginCreateWithServiceResponseAsync(resourceGroupName, nodeName, session, userName, password, retentionPeriod, credentialDataFormat, encryptionCertificateThumbprint).map(new Func1, SessionResourceInner>() { + @Override + public SessionResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @param userName Encrypted User name to be used to connect to node. + * @param password Encrypted Password associated with user name. + * @param retentionPeriod Session retention period. Possible values include: 'Session', 'Persistent' + * @param credentialDataFormat Credential data format. Possible values include: 'RsaEncrypted' + * @param encryptionCertificateThumbprint Encryption certificate thumbprint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SessionResourceInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String nodeName, String session, String userName, String password, RetentionPeriod retentionPeriod, CredentialDataFormat credentialDataFormat, String encryptionCertificateThumbprint) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + SessionParameters sessionParameters = new SessionParameters(); + sessionParameters.withUserName(userName); + sessionParameters.withPassword(password); + sessionParameters.withRetentionPeriod(retentionPeriod); + sessionParameters.withCredentialDataFormat(credentialDataFormat); + sessionParameters.withEncryptionCertificateThumbprint(encryptionCertificateThumbprint); + return service.beginCreate(this.client.subscriptionId(), resourceGroupName, nodeName, session, this.client.apiVersion(), this.client.acceptLanguage(), sessionParameters, 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 ErrorException, 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(ErrorException.class) + .build(response); + } + + /** + * Deletes a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException 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 nodeName, String session) { + deleteWithServiceResponseAsync(resourceGroupName, nodeName, session).toBlocking().single().body(); + } + + /** + * Deletes a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @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 nodeName, String session, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, nodeName, session), serviceCallback); + } + + /** + * Deletes a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String nodeName, String session) { + return deleteWithServiceResponseAsync(resourceGroupName, nodeName, session).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String nodeName, String session) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, nodeName, session, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Gets a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SessionResourceInner object if successful. + */ + public SessionResourceInner get(String resourceGroupName, String nodeName, String session) { + return getWithServiceResponseAsync(resourceGroupName, nodeName, session).toBlocking().single().body(); + } + + /** + * Gets a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @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 nodeName, String session, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, nodeName, session), serviceCallback); + } + + /** + * Gets a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SessionResourceInner object + */ + public Observable getAsync(String resourceGroupName, String nodeName, String session) { + return getWithServiceResponseAsync(resourceGroupName, nodeName, session).map(new Func1, SessionResourceInner>() { + @Override + public SessionResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a session for a node. + * + * @param resourceGroupName The resource group name uniquely identifies the resource group within the user subscriptionId. + * @param nodeName The node name (256 characters maximum). + * @param session The sessionId from the user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SessionResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String nodeName, String session) { + 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 (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (session == null) { + throw new IllegalArgumentException("Parameter session 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, nodeName, session, 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 ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + +} diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/package-info.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/implementation/package-info.java new file mode 100644 index 00000000000..89f9e605d58 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/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 ServerManagement. + * REST API for Azure Server Management Service. + */ +package com.microsoft.azure.management.servermanagement.implementation; diff --git a/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/package-info.java b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/package-info.java new file mode 100644 index 00000000000..cf2c13129a7 --- /dev/null +++ b/azure-mgmt-servermanagement/src/main/java/com/microsoft/azure/management/servermanagement/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 ServerManagement. + * REST API for Azure Server Management Service. + */ +package com.microsoft.azure.management.servermanagement;