diff --git a/hybridcompute/resource-manager/v2019_03_18/pom.xml b/hybridcompute/resource-manager/v2019_03_18/pom.xml new file mode 100644 index 000000000000..1b0860fccf75 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.hybridcompute.v2019_03_18 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-hybridcompute + 1.0.0-beta + jar + Microsoft Azure SDK for HybridCompute Management + This package contains Microsoft HybridCompute Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/ErrorDetail.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/ErrorDetail.java new file mode 100644 index 000000000000..141b89e1c575 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/ErrorDetail.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error details. + */ +public class ErrorDetail { + /** + * The error's code. + */ + @JsonProperty(value = "code", required = true) + private String code; + + /** + * A human readable error message. + */ + @JsonProperty(value = "message", required = true) + private String message; + + /** + * Indicates which property in the request is responsible for the error. + */ + @JsonProperty(value = "target") + private String target; + + /** + * Additional error details. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Get the error's code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the error's code. + * + * @param code the code value to set + * @return the ErrorDetail object itself. + */ + public ErrorDetail withCode(String code) { + this.code = code; + return this; + } + + /** + * Get a human readable error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set a human readable error message. + * + * @param message the message value to set + * @return the ErrorDetail object itself. + */ + public ErrorDetail withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get indicates which property in the request is responsible for the error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Set indicates which property in the request is responsible for the error. + * + * @param target the target value to set + * @return the ErrorDetail object itself. + */ + public ErrorDetail withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get additional error details. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set additional error details. + * + * @param details the details value to set + * @return the ErrorDetail object itself. + */ + public ErrorDetail withDetails(List details) { + this.details = details; + return this; + } + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/ErrorResponse.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/ErrorResponse.java new file mode 100644 index 000000000000..cc33ade21719 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/ErrorResponse.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.hybridcompute.v2019_03_18; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response. + * Contains details when the response code indicates an error. + */ +public class ErrorResponse { + /** + * The error details. + */ + @JsonProperty(value = "error", required = true) + private ErrorDetail error; + + /** + * Get the error details. + * + * @return the error value + */ + public ErrorDetail error() { + return this.error; + } + + /** + * Set the error details. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetail error) { + this.error = error; + return this; + } + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/ErrorResponseException.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/ErrorResponseException.java new file mode 100644 index 000000000000..ef1bb53428a3 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/ErrorResponseException.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.hybridcompute.v2019_03_18; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException 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 ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/InstanceViewTypes.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/InstanceViewTypes.java new file mode 100644 index 000000000000..9ce92d69067b --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/InstanceViewTypes.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.hybridcompute.v2019_03_18; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for InstanceViewTypes. + */ +public enum InstanceViewTypes { + /** Enum value instanceView. */ + INSTANCE_VIEW("instanceView"); + + /** The actual serialized value for a InstanceViewTypes instance. */ + private String value; + + InstanceViewTypes(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a InstanceViewTypes instance. + * + * @param value the serialized value to parse. + * @return the parsed InstanceViewTypes object, or null if unable to parse. + */ + @JsonCreator + public static InstanceViewTypes fromString(String value) { + InstanceViewTypes[] items = InstanceViewTypes.values(); + for (InstanceViewTypes item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/Machine.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/Machine.java new file mode 100644 index 000000000000..4cc9563afd4a --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/Machine.java @@ -0,0 +1,210 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation.HybridComputeManager; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation.MachineInner; + +/** + * Type representing Machine. + */ +public interface Machine extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the agentVersion value. + */ + String agentVersion(); + + /** + * @return the clientPublicKey value. + */ + String clientPublicKey(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the errorDetails value. + */ + List errorDetails(); + + /** + * @return the lastStatusChange value. + */ + DateTime lastStatusChange(); + + /** + * @return the machineFqdn value. + */ + String machineFqdn(); + + /** + * @return the osName value. + */ + String osName(); + + /** + * @return the osProfile value. + */ + OSProfile osProfile(); + + /** + * @return the osVersion value. + */ + String osVersion(); + + /** + * @return the physicalLocation value. + */ + String physicalLocation(); + + /** + * @return the principalId value. + */ + String principalId(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the status value. + */ + StatusTypes status(); + + /** + * @return the tenantId value. + */ + String tenantId(); + + /** + * @return the type1 value. + */ + String type1(); + + /** + * @return the vmId value. + */ + String vmId(); + + /** + * The entirety of the Machine definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of Machine definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Machine definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Machine definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the machine definition allowing to specify ClientPublicKey. + */ + interface WithClientPublicKey { + /** + * Specifies clientPublicKey. + * @param clientPublicKey Public Key that the client provides to be used during initial resource onboarding + * @return the next definition stage + */ + WithCreate withClientPublicKey(String clientPublicKey); + } + + /** + * The stage of the machine definition allowing to specify OsProfile. + */ + interface WithOsProfile { + /** + * Specifies osProfile. + * @param osProfile Specifies the operating system settings for the hybrid machine + * @return the next definition stage + */ + WithCreate withOsProfile(OSProfile osProfile); + } + + /** + * The stage of the machine definition allowing to specify PhysicalLocation. + */ + interface WithPhysicalLocation { + /** + * Specifies physicalLocation. + * @param physicalLocation Resource's Physical Location + * @return the next definition stage + */ + WithCreate withPhysicalLocation(String physicalLocation); + } + + /** + * The stage of the machine definition allowing to specify Type1. + */ + interface WithType1 { + /** + * Specifies type1. + * @param type1 The identity type + * @return the next definition stage + */ + WithCreate withType1(String type1); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithClientPublicKey, DefinitionStages.WithOsProfile, DefinitionStages.WithPhysicalLocation, DefinitionStages.WithType1 { + } + } + /** + * The template for a Machine update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithPhysicalLocation { + } + + /** + * Grouping of Machine update stages. + */ + interface UpdateStages { + /** + * The stage of the machine update allowing to specify PhysicalLocation. + */ + interface WithPhysicalLocation { + /** + * Specifies physicalLocation. + * @param physicalLocation Resource's Physical Location + * @return the next update stage + */ + Update withPhysicalLocation(String physicalLocation); + } + + } +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/MachineReconnect.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/MachineReconnect.java new file mode 100644 index 000000000000..8058daf92668 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/MachineReconnect.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Describes a hybrid machine reconnect. + */ +@JsonFlatten +public class MachineReconnect { + /** + * Specifies the hybrid machine unique ID. + */ + @JsonProperty(value = "properties.vmId") + private String vmId; + + /** + * Public Key that the client provides to be used during initial resource + * onboarding. + */ + @JsonProperty(value = "properties.clientPublicKey") + private String clientPublicKey; + + /** + * Get specifies the hybrid machine unique ID. + * + * @return the vmId value + */ + public String vmId() { + return this.vmId; + } + + /** + * Set specifies the hybrid machine unique ID. + * + * @param vmId the vmId value to set + * @return the MachineReconnect object itself. + */ + public MachineReconnect withVmId(String vmId) { + this.vmId = vmId; + return this; + } + + /** + * Get public Key that the client provides to be used during initial resource onboarding. + * + * @return the clientPublicKey value + */ + public String clientPublicKey() { + return this.clientPublicKey; + } + + /** + * Set public Key that the client provides to be used during initial resource onboarding. + * + * @param clientPublicKey the clientPublicKey value to set + * @return the MachineReconnect object itself. + */ + public MachineReconnect withClientPublicKey(String clientPublicKey) { + this.clientPublicKey = clientPublicKey; + return this; + } + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/MachineUpdate.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/MachineUpdate.java new file mode 100644 index 000000000000..46736cbc82a5 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/MachineUpdate.java @@ -0,0 +1,101 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Describes a hybrid machine Update. + */ +@JsonFlatten +public class MachineUpdate extends UpdateResource { + /** + * The identity type. + */ + @JsonProperty(value = "identity.type") + private String type; + + /** + * The identity's principal id. + */ + @JsonProperty(value = "identity.principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The identity's tenant id. + */ + @JsonProperty(value = "identity.tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * Resource's Physical Location. + */ + @JsonProperty(value = "properties.physicalLocation") + private String physicalLocation; + + /** + * Get the identity type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the identity type. + * + * @param type the type value to set + * @return the MachineUpdate object itself. + */ + public MachineUpdate withType(String type) { + this.type = type; + return this; + } + + /** + * Get the identity's principal id. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the identity's tenant id. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get resource's Physical Location. + * + * @return the physicalLocation value + */ + public String physicalLocation() { + return this.physicalLocation; + } + + /** + * Set resource's Physical Location. + * + * @param physicalLocation the physicalLocation value to set + * @return the MachineUpdate object itself. + */ + public MachineUpdate withPhysicalLocation(String physicalLocation) { + this.physicalLocation = physicalLocation; + return this; + } + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/Machines.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/Machines.java new file mode 100644 index 000000000000..eaf870a8e069 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/Machines.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation.MachinesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Machines. + */ +public interface Machines extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * The operation to reconnect a hybrid machine resource to its identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param parameters Parameters supplied to the Reconnect hybrid machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable reconnectAsync(String resourceGroupName, String name, MachineReconnect parameters); + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/OSProfile.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/OSProfile.java new file mode 100644 index 000000000000..9b177e55213d --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/OSProfile.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the operating system settings for the hybrid machine. + */ +public class OSProfile { + /** + * Specifies the host OS name of the hybrid machine. + */ + @JsonProperty(value = "computerName", access = JsonProperty.Access.WRITE_ONLY) + private String computerName; + + /** + * Get specifies the host OS name of the hybrid machine. + * + * @return the computerName value + */ + public String computerName() { + return this.computerName; + } + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/OperationValue.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/OperationValue.java new file mode 100644 index 000000000000..40b4d24e95a7 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/OperationValue.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.hybridcompute.v2019_03_18; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation.HybridComputeManager; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation.OperationValueInner; + +/** + * Type representing OperationValue. + */ +public interface OperationValue extends HasInner, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the origin value. + */ + String origin(); + + /** + * @return the provider value. + */ + String provider(); + + /** + * @return the resource value. + */ + String resource(); + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/Operations.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/Operations.java new file mode 100644 index 000000000000..427e94dec732 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18; + +import rx.Observable; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Gets a list of hybrid compute operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/StatusTypes.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/StatusTypes.java new file mode 100644 index 000000000000..8d04cd9ecdb9 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/StatusTypes.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.hybridcompute.v2019_03_18; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for StatusTypes. + */ +public enum StatusTypes { + /** Enum value Connected. */ + CONNECTED("Connected"), + + /** Enum value Disconnected. */ + DISCONNECTED("Disconnected"), + + /** Enum value Error. */ + ERROR("Error"); + + /** The actual serialized value for a StatusTypes instance. */ + private String value; + + StatusTypes(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a StatusTypes instance. + * + * @param value the serialized value to parse. + * @return the parsed StatusTypes object, or null if unable to parse. + */ + @JsonCreator + public static StatusTypes fromString(String value) { + StatusTypes[] items = StatusTypes.values(); + for (StatusTypes item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/UpdateResource.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/UpdateResource.java new file mode 100644 index 000000000000..04bc2ba72d58 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/UpdateResource.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.hybridcompute.v2019_03_18; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Update Resource model definition. + */ +public class UpdateResource { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the UpdateResource object itself. + */ + public UpdateResource withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/HybridComputeManagementClientImpl.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/HybridComputeManagementClientImpl.java new file mode 100644 index 000000000000..5c5e6fc96d69 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/HybridComputeManagementClientImpl.java @@ -0,0 +1,210 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18.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 HybridComputeManagementClientImpl class. + */ +public class HybridComputeManagementClientImpl 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; + } + + /** Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * 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 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 HybridComputeManagementClientImpl 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; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public HybridComputeManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * 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 HybridComputeManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. 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 Whether a unique x-ms-client-request-id should be generated. 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 Whether a unique x-ms-client-request-id should be generated. 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 HybridComputeManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The MachinesInner object to access its operations. + */ + private MachinesInner machines; + + /** + * Gets the MachinesInner object to access its operations. + * @return the MachinesInner object. + */ + public MachinesInner machines() { + return this.machines; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * Initializes an instance of HybridComputeManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public HybridComputeManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of HybridComputeManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public HybridComputeManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of HybridComputeManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public HybridComputeManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2019-03-18-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.machines = new MachinesInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "HybridComputeManagementClient", "2019-03-18-preview"); + } +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/HybridComputeManager.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/HybridComputeManager.java new file mode 100644 index 000000000000..fd87a7f388b9 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/HybridComputeManager.java @@ -0,0 +1,111 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.Machines; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.Operations; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure HybridCompute resource management. + */ +public final class HybridComputeManager extends ManagerCore { + private Machines machines; + private Operations operations; + /** + * Get a Configurable instance that can be used to create HybridComputeManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new HybridComputeManager.ConfigurableImpl(); + } + /** + * Creates an instance of HybridComputeManager that exposes HybridCompute resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the HybridComputeManager + */ + public static HybridComputeManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new HybridComputeManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of HybridComputeManager that exposes HybridCompute resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the HybridComputeManager + */ + public static HybridComputeManager authenticate(RestClient restClient, String subscriptionId) { + return new HybridComputeManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of HybridComputeManager that exposes HybridCompute management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing HybridCompute management API entry points that work across subscriptions + */ + HybridComputeManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Machines. + */ + public Machines machines() { + if (this.machines == null) { + this.machines = new MachinesImpl(this); + } + return this.machines; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public HybridComputeManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return HybridComputeManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private HybridComputeManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new HybridComputeManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/IdParsingUtils.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..b233e781128e --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/MachineImpl.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/MachineImpl.java new file mode 100644 index 000000000000..de5d05e7e050 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/MachineImpl.java @@ -0,0 +1,180 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.Machine; +import rx.Observable; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.MachineUpdate; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.OSProfile; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.StatusTypes; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.ErrorDetail; +import rx.functions.Func1; + +class MachineImpl extends GroupableResourceCoreImpl implements Machine, Machine.Definition, Machine.Update { + private MachineUpdate updateParameter; + MachineImpl(String name, MachineInner inner, HybridComputeManager manager) { + super(name, inner, manager); + this.updateParameter = new MachineUpdate(); + } + + @Override + public Observable createResourceAsync() { + MachinesInner client = this.manager().inner().machines(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public MachineInner call(MachineInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + MachinesInner client = this.manager().inner().machines(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public MachineInner call(MachineInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + MachinesInner client = this.manager().inner().machines(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new MachineUpdate(); + } + + @Override + public String agentVersion() { + return this.inner().agentVersion(); + } + + @Override + public String clientPublicKey() { + return this.inner().clientPublicKey(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public List errorDetails() { + return this.inner().errorDetails(); + } + + @Override + public DateTime lastStatusChange() { + return this.inner().lastStatusChange(); + } + + @Override + public String machineFqdn() { + return this.inner().machineFqdn(); + } + + @Override + public String osName() { + return this.inner().osName(); + } + + @Override + public OSProfile osProfile() { + return this.inner().osProfile(); + } + + @Override + public String osVersion() { + return this.inner().osVersion(); + } + + @Override + public String physicalLocation() { + return this.inner().physicalLocation(); + } + + @Override + public String principalId() { + return this.inner().principalId(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public StatusTypes status() { + return this.inner().status(); + } + + @Override + public String tenantId() { + return this.inner().tenantId(); + } + + @Override + public String type1() { + return this.inner().type1(); + } + + @Override + public String vmId() { + return this.inner().vmId(); + } + + @Override + public MachineImpl withClientPublicKey(String clientPublicKey) { + this.inner().withClientPublicKey(clientPublicKey); + return this; + } + + @Override + public MachineImpl withOsProfile(OSProfile osProfile) { + this.inner().withOsProfile(osProfile); + return this; + } + + @Override + public MachineImpl withType1(String type1) { + this.inner().withType1(type1); + return this; + } + + @Override + public MachineImpl withPhysicalLocation(String physicalLocation) { + if (isInCreateMode()) { + this.inner().withPhysicalLocation(physicalLocation); + } else { + this.updateParameter.withPhysicalLocation(physicalLocation); + } + return this; + } + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/MachineInner.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/MachineInner.java new file mode 100644 index 000000000000..8aceec84c6cb --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/MachineInner.java @@ -0,0 +1,311 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation; + +import com.microsoft.azure.management.hybridcompute.v2019_03_18.OSProfile; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.StatusTypes; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.ErrorDetail; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Describes a hybrid machine. + */ +@JsonFlatten +public class MachineInner extends Resource { + /** + * Specifies the operating system settings for the hybrid machine. + */ + @JsonProperty(value = "properties.osProfile") + private OSProfile osProfile; + + /** + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The status of the hybrid machine agent. Possible values include: + * 'Connected', 'Disconnected', 'Error'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private StatusTypes status; + + /** + * The time of the last status change. + */ + @JsonProperty(value = "properties.lastStatusChange", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastStatusChange; + + /** + * Details about the error state. + */ + @JsonProperty(value = "properties.errorDetails", access = JsonProperty.Access.WRITE_ONLY) + private List errorDetails; + + /** + * The hybrid machine agent full version. + */ + @JsonProperty(value = "properties.agentVersion", access = JsonProperty.Access.WRITE_ONLY) + private String agentVersion; + + /** + * Specifies the hybrid machine unique ID. + */ + @JsonProperty(value = "properties.vmId", access = JsonProperty.Access.WRITE_ONLY) + private String vmId; + + /** + * Specifies the hybrid machine display name. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * Specifies the hybrid machine FQDN. + */ + @JsonProperty(value = "properties.machineFqdn", access = JsonProperty.Access.WRITE_ONLY) + private String machineFqdn; + + /** + * Resource's Physical Location. + */ + @JsonProperty(value = "properties.physicalLocation") + private String physicalLocation; + + /** + * Public Key that the client provides to be used during initial resource + * onboarding. + */ + @JsonProperty(value = "properties.clientPublicKey") + private String clientPublicKey; + + /** + * The Operating System running on the hybrid machine. + */ + @JsonProperty(value = "properties.osName", access = JsonProperty.Access.WRITE_ONLY) + private String osName; + + /** + * The version of Operating System running on the hybrid machine. + */ + @JsonProperty(value = "properties.osVersion", access = JsonProperty.Access.WRITE_ONLY) + private String osVersion; + + /** + * The identity type. + */ + @JsonProperty(value = "identity.type") + private String type1; + + /** + * The identity's principal id. + */ + @JsonProperty(value = "identity.principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The identity's tenant id. + */ + @JsonProperty(value = "identity.tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * Get specifies the operating system settings for the hybrid machine. + * + * @return the osProfile value + */ + public OSProfile osProfile() { + return this.osProfile; + } + + /** + * Set specifies the operating system settings for the hybrid machine. + * + * @param osProfile the osProfile value to set + * @return the MachineInner object itself. + */ + public MachineInner withOsProfile(OSProfile osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Get the provisioning state, which only appears in the response. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the status of the hybrid machine agent. Possible values include: 'Connected', 'Disconnected', 'Error'. + * + * @return the status value + */ + public StatusTypes status() { + return this.status; + } + + /** + * Get the time of the last status change. + * + * @return the lastStatusChange value + */ + public DateTime lastStatusChange() { + return this.lastStatusChange; + } + + /** + * Get details about the error state. + * + * @return the errorDetails value + */ + public List errorDetails() { + return this.errorDetails; + } + + /** + * Get the hybrid machine agent full version. + * + * @return the agentVersion value + */ + public String agentVersion() { + return this.agentVersion; + } + + /** + * Get specifies the hybrid machine unique ID. + * + * @return the vmId value + */ + public String vmId() { + return this.vmId; + } + + /** + * Get specifies the hybrid machine display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get specifies the hybrid machine FQDN. + * + * @return the machineFqdn value + */ + public String machineFqdn() { + return this.machineFqdn; + } + + /** + * Get resource's Physical Location. + * + * @return the physicalLocation value + */ + public String physicalLocation() { + return this.physicalLocation; + } + + /** + * Set resource's Physical Location. + * + * @param physicalLocation the physicalLocation value to set + * @return the MachineInner object itself. + */ + public MachineInner withPhysicalLocation(String physicalLocation) { + this.physicalLocation = physicalLocation; + return this; + } + + /** + * Get public Key that the client provides to be used during initial resource onboarding. + * + * @return the clientPublicKey value + */ + public String clientPublicKey() { + return this.clientPublicKey; + } + + /** + * Set public Key that the client provides to be used during initial resource onboarding. + * + * @param clientPublicKey the clientPublicKey value to set + * @return the MachineInner object itself. + */ + public MachineInner withClientPublicKey(String clientPublicKey) { + this.clientPublicKey = clientPublicKey; + return this; + } + + /** + * Get the Operating System running on the hybrid machine. + * + * @return the osName value + */ + public String osName() { + return this.osName; + } + + /** + * Get the version of Operating System running on the hybrid machine. + * + * @return the osVersion value + */ + public String osVersion() { + return this.osVersion; + } + + /** + * Get the identity type. + * + * @return the type1 value + */ + public String type1() { + return this.type1; + } + + /** + * Set the identity type. + * + * @param type1 the type1 value to set + * @return the MachineInner object itself. + */ + public MachineInner withType1(String type1) { + this.type1 = type1; + return this; + } + + /** + * Get the identity's principal id. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the identity's tenant id. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/MachinesImpl.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/MachinesImpl.java new file mode 100644 index 000000000000..ae660a981b6c --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/MachinesImpl.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.Machines; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.Machine; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.MachineReconnect; + +class MachinesImpl extends GroupableResourcesCoreImpl implements Machines { + protected MachinesImpl(HybridComputeManager manager) { + super(manager.inner().machines(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + MachinesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + MachinesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + MachinesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + MachinesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Machine call(MachineInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + MachinesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + MachinesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Machine call(MachineInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public MachineImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable reconnectAsync(String resourceGroupName, String name, MachineReconnect parameters) { + MachinesInner client = this.inner(); + return client.reconnectAsync(resourceGroupName, name, parameters) + .map(new Func1() { + @Override + public Machine call(MachineInner inner) { + return new MachineImpl(inner.name(), inner, manager()); + } + }); + } + + @Override + protected MachineImpl wrapModel(MachineInner inner) { + return new MachineImpl(inner.name(), inner, manager()); + } + + @Override + protected MachineImpl wrapModel(String name) { + return new MachineImpl(name, new MachineInner(), this.manager()); + } + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/MachinesInner.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/MachinesInner.java new file mode 100644 index 000000000000..d7816e092796 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/MachinesInner.java @@ -0,0 +1,1094 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.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.hybridcompute.v2019_03_18.ErrorResponseException; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.InstanceViewTypes; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.MachineReconnect; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.MachineUpdate; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Machines. + */ +public class MachinesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private MachinesService service; + /** The service client containing this operation class. */ + private HybridComputeManagementClientImpl client; + + /** + * Initializes an instance of MachinesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MachinesInner(Retrofit retrofit, HybridComputeManagementClientImpl client) { + this.service = retrofit.create(MachinesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Machines to be + * used by Retrofit to perform actually REST calls. + */ + interface MachinesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridcompute.v2019_03_18.Machines createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Query("api-version") String apiVersion, @Body MachineInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridcompute.v2019_03_18.Machines update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Query("api-version") String apiVersion, @Body MachineUpdate parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridcompute.v2019_03_18.Machines delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @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.hybridcompute.v2019_03_18.Machines getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Query("api-version") String apiVersion, @Query("$expand") InstanceViewTypes 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.hybridcompute.v2019_03_18.Machines reconnect" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/reconnect") + Observable> reconnect(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Query("api-version") String apiVersion, @Body MachineReconnect parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridcompute.v2019_03_18.Machines listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines") + 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.hybridcompute.v2019_03_18.Machines list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/machines") + 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.hybridcompute.v2019_03_18.Machines listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@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.hybridcompute.v2019_03_18.Machines listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * The operation to create or update a hybrid machine resource identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param parameters Parameters supplied to the Create hybrid machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MachineInner object if successful. + */ + public MachineInner createOrUpdate(String resourceGroupName, String name, MachineInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body(); + } + + /** + * The operation to create or update a hybrid machine resource identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param parameters Parameters supplied to the Create hybrid machine operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String name, MachineInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); + } + + /** + * The operation to create or update a hybrid machine resource identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param parameters Parameters supplied to the Create hybrid machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MachineInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String name, MachineInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, MachineInner>() { + @Override + public MachineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to create or update a hybrid machine resource identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param parameters Parameters supplied to the Create hybrid machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MachineInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String name, MachineInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, name, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to update a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param parameters Parameters supplied to the Update hybrid machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MachineInner object if successful. + */ + public MachineInner update(String resourceGroupName, String name, MachineUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body(); + } + + /** + * The operation to update a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param parameters Parameters supplied to the Update hybrid machine operation. + * @param serviceCallback 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 name, MachineUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); + } + + /** + * The operation to update a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param parameters Parameters supplied to the Update hybrid machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MachineInner object + */ + public Observable updateAsync(String resourceGroupName, String name, MachineUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, MachineInner>() { + @Override + public MachineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to update a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param parameters Parameters supplied to the Update hybrid machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MachineInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String name, MachineUpdate parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(this.client.subscriptionId(), resourceGroupName, name, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to remove a hybrid machine identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 name) { + deleteWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); + } + + /** + * The operation to remove a hybrid machine identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param serviceCallback 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 name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, name), serviceCallback); + } + + /** + * The operation to remove a hybrid machine identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String name) { + return deleteWithServiceResponseAsync(resourceGroupName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to remove a hybrid machine identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String name) { + 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 (name == null) { + throw new IllegalArgumentException("Parameter name 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, name, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MachineInner object if successful. + */ + public MachineInner getByResourceGroup(String resourceGroupName, String name) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); + } + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param serviceCallback 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 name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, name), serviceCallback); + } + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MachineInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String name) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).map(new Func1, MachineInner>() { + @Override + public MachineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MachineInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String name) { + 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 (name == null) { + throw new IllegalArgumentException("Parameter name 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 InstanceViewTypes expand = null; + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, name, 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); + } + } + }); + } + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param expand The expand expression to apply on the operation. Possible values include: 'instanceView' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MachineInner object if successful. + */ + public MachineInner getByResourceGroup(String resourceGroupName, String name, InstanceViewTypes expand) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name, expand).toBlocking().single().body(); + } + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param expand The expand expression to apply on the operation. Possible values include: 'instanceView' + * @param serviceCallback 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 name, InstanceViewTypes expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, name, expand), serviceCallback); + } + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param expand The expand expression to apply on the operation. Possible values include: 'instanceView' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MachineInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String name, InstanceViewTypes expand) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name, expand).map(new Func1, MachineInner>() { + @Override + public MachineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param expand The expand expression to apply on the operation. Possible values include: 'instanceView' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MachineInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String name, InstanceViewTypes 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 (name == null) { + throw new IllegalArgumentException("Parameter name 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, name, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to reconnect a hybrid machine resource to its identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param parameters Parameters supplied to the Reconnect hybrid machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MachineInner object if successful. + */ + public MachineInner reconnect(String resourceGroupName, String name, MachineReconnect parameters) { + return reconnectWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body(); + } + + /** + * The operation to reconnect a hybrid machine resource to its identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param parameters Parameters supplied to the Reconnect hybrid machine operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture reconnectAsync(String resourceGroupName, String name, MachineReconnect parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(reconnectWithServiceResponseAsync(resourceGroupName, name, parameters), serviceCallback); + } + + /** + * The operation to reconnect a hybrid machine resource to its identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param parameters Parameters supplied to the Reconnect hybrid machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MachineInner object + */ + public Observable reconnectAsync(String resourceGroupName, String name, MachineReconnect parameters) { + return reconnectWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1, MachineInner>() { + @Override + public MachineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to reconnect a hybrid machine resource to its identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param parameters Parameters supplied to the Reconnect hybrid machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MachineInner object + */ + public Observable> reconnectWithServiceResponseAsync(String resourceGroupName, String name, MachineReconnect parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.reconnect(this.client.subscriptionId(), resourceGroupName, name, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = reconnectDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse reconnectDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MachineInner> 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 all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> 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 all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MachineInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MachineInner> 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 all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next page of hybrid machines. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MachineInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MachineInner> 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 all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @param serviceCallback 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 all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MachineInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MachineInner> 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 all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MachineInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MachineInner> 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 all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @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 all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @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<MachineInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @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<MachineInner> 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 all the hybrid machines in the specified resource group. Use the nextLink property in the response to get the next page of hybrid machines. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MachineInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MachineInner> 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 all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @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 all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @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<MachineInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines. + * + * @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<MachineInner> 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 all the hybrid machines in the specified subscription. Use the nextLink property in the response to get the next page of hybrid machines. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MachineInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/OperationValueImpl.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/OperationValueImpl.java new file mode 100644 index 000000000000..62c858e6f23e --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/OperationValueImpl.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.hybridcompute.v2019_03_18.implementation; + +import com.microsoft.azure.management.hybridcompute.v2019_03_18.OperationValue; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class OperationValueImpl extends WrapperImpl implements OperationValue { + private final HybridComputeManager manager; + OperationValueImpl(OperationValueInner inner, HybridComputeManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public HybridComputeManager manager() { + return this.manager; + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String operation() { + return this.inner().operation(); + } + + @Override + public String origin() { + return this.inner().origin(); + } + + @Override + public String provider() { + return this.inner().provider(); + } + + @Override + public String resource() { + return this.inner().resource(); + } + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/OperationValueInner.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/OperationValueInner.java new file mode 100644 index 000000000000..09903007d3c6 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/OperationValueInner.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Describes the properties of a Compute Operation value. + */ +@JsonFlatten +public class OperationValueInner { + /** + * The origin of the compute operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private String origin; + + /** + * The name of the compute operation. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The display name of the compute operation. + */ + @JsonProperty(value = "display.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The display name of the resource the operation applies to. + */ + @JsonProperty(value = "display.resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * The description of the operation. + */ + @JsonProperty(value = "display.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * The resource provider for the operation. + */ + @JsonProperty(value = "display.provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Get the origin of the compute operation. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Get the name of the compute operation. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the display name of the compute operation. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the display name of the resource the operation applies to. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get the description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get the resource provider for the operation. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/OperationsImpl.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/OperationsImpl.java new file mode 100644 index 000000000000..60557c3b610e --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.Operations; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.OperationValue; + +class OperationsImpl extends WrapperImpl implements Operations { + private final HybridComputeManager manager; + + OperationsImpl(HybridComputeManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public HybridComputeManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public OperationValue call(OperationValueInner inner) { + return new OperationValueImpl(inner, manager()); + } + }); + } + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/OperationsInner.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/OperationsInner.java new file mode 100644 index 000000000000..7abfa586e698 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/OperationsInner.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.hybridcompute.v2019_03_18.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private HybridComputeManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, HybridComputeManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hybridcompute.v2019_03_18.Operations list" }) + @GET("providers/Microsoft.HybridCompute/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of hybrid compute operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<OperationValueInner> object if successful. + */ + public List list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets a list of hybrid compute operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets a list of hybrid compute operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<OperationValueInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of hybrid compute operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<OperationValueInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/PageImpl.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/PageImpl.java new file mode 100644 index 000000000000..d866459d0b7c --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/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.hybridcompute.v2019_03_18.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/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/PageImpl1.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/PageImpl1.java new file mode 100644 index 000000000000..2e6014a9eaa9 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/package-info.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/implementation/package-info.java new file mode 100644 index 000000000000..778c8c1780a6 --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/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 HybridComputeManagementClient. + * The Hybrid Compute Management Client. + */ +package com.microsoft.azure.management.hybridcompute.v2019_03_18.implementation; diff --git a/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/package-info.java b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/package-info.java new file mode 100644 index 000000000000..6a5f26319dac --- /dev/null +++ b/hybridcompute/resource-manager/v2019_03_18/src/main/java/com/microsoft/azure/management/hybridcompute/v2019_03_18/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 HybridComputeManagementClient. + * The Hybrid Compute Management Client. + */ +package com.microsoft.azure.management.hybridcompute.v2019_03_18;