diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/pom.xml b/sdk/imagebuilder/mgmt-v2019_02_01_preview/pom.xml new file mode 100644 index 000000000000..e62f4f52dc8b --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.imagebuilder.v2019_02_01_preview + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-virtualmachineimages + 1.0.0-beta + jar + Microsoft Azure SDK for VirtualMachineImages Management + This package contains Microsoft VirtualMachineImages 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/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ApiError.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ApiError.java new file mode 100644 index 000000000000..e50fc26afaca --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ApiError.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Api error. + */ +public class ApiError { + /** + * The Api error details. + */ + @JsonProperty(value = "details") + private List details; + + /** + * The Api inner error. + */ + @JsonProperty(value = "innerError") + private InnerError innerError; + + /** + * The error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * The target of the particular error. + */ + @JsonProperty(value = "target") + private String target; + + /** + * The error message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the Api error details. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set the Api error details. + * + * @param details the details value to set + * @return the ApiError object itself. + */ + public ApiError withDetails(List details) { + this.details = details; + return this; + } + + /** + * Get the Api inner error. + * + * @return the innerError value + */ + public InnerError innerError() { + return this.innerError; + } + + /** + * Set the Api inner error. + * + * @param innerError the innerError value to set + * @return the ApiError object itself. + */ + public ApiError withInnerError(InnerError innerError) { + this.innerError = innerError; + return this; + } + + /** + * Get the error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the error code. + * + * @param code the code value to set + * @return the ApiError object itself. + */ + public ApiError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the target of the particular error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Set the target of the particular error. + * + * @param target the target value to set + * @return the ApiError object itself. + */ + public ApiError withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the error message. + * + * @param message the message value to set + * @return the ApiError object itself. + */ + public ApiError withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ApiErrorBase.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ApiErrorBase.java new file mode 100644 index 000000000000..68577d8d9b0f --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ApiErrorBase.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Api error base. + */ +public class ApiErrorBase { + /** + * The error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * The target of the particular error. + */ + @JsonProperty(value = "target") + private String target; + + /** + * The error message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the error code. + * + * @param code the code value to set + * @return the ApiErrorBase object itself. + */ + public ApiErrorBase withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the target of the particular error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Set the target of the particular error. + * + * @param target the target value to set + * @return the ApiErrorBase object itself. + */ + public ApiErrorBase withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the error message. + * + * @param message the message value to set + * @return the ApiErrorBase object itself. + */ + public ApiErrorBase withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ApiErrorException.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ApiErrorException.java new file mode 100644 index 000000000000..0d25f9dfe13d --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ApiErrorException.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.imagebuilder.v2019_02_01_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ApiError information. + */ +public class ApiErrorException extends RestException { + /** + * Initializes a new instance of the ApiErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ApiErrorException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ApiErrorException 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 ApiErrorException(final String message, final Response response, final ApiError body) { + super(message, response, body); + } + + @Override + public ApiError body() { + return (ApiError) super.body(); + } +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplate.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplate.java new file mode 100644 index 000000000000..9b617a0d644a --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplate.java @@ -0,0 +1,147 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +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.imagebuilder.v2019_02_01_preview.implementation.VirtualMachineImagesManager; +import java.util.List; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation.ImageTemplateInner; + +/** + * Type representing ImageTemplate. + */ +public interface ImageTemplate extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the customize value. + */ + List customize(); + + /** + * @return the distribute value. + */ + List distribute(); + + /** + * @return the lastRunStatus value. + */ + ImageTemplateLastRunStatus lastRunStatus(); + + /** + * @return the provisioningError value. + */ + ProvisioningError provisioningError(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the source value. + */ + ImageTemplateSource source(); + + /** + * The entirety of the ImageTemplate definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithDistribute, DefinitionStages.WithSource, DefinitionStages.WithCreate { + } + + /** + * Grouping of ImageTemplate definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ImageTemplate definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the ImageTemplate definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the imagetemplate definition allowing to specify Distribute. + */ + interface WithDistribute { + /** + * Specifies distribute. + * @param distribute The distribution targets where the image output needs to go to + * @return the next definition stage +*/ + WithSource withDistribute(List distribute); + } + + /** + * The stage of the imagetemplate definition allowing to specify Source. + */ + interface WithSource { + /** + * Specifies source. + * @param source Specifies the properties used to describe the source image + * @return the next definition stage +*/ + WithCreate withSource(ImageTemplateSource source); + } + + /** + * The stage of the imagetemplate definition allowing to specify Customize. + */ + interface WithCustomize { + /** + * Specifies customize. + * @param customize Specifies the properties used to describe the customization steps of the image, like Image source etc + * @return the next definition stage + */ + WithCreate withCustomize(List customize); + } + + /** + * 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.WithCustomize { + } + } + /** + * The template for a ImageTemplate update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithCustomize { + } + + /** + * Grouping of ImageTemplate update stages. + */ + interface UpdateStages { + /** + * The stage of the imagetemplate update allowing to specify Customize. + */ + interface WithCustomize { + /** + * Specifies customize. + * @param customize Specifies the properties used to describe the customization steps of the image, like Image source etc + * @return the next update stage + */ + Update withCustomize(List customize); + } + + } +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateCustomizer.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateCustomizer.java new file mode 100644 index 000000000000..e355bc1d826b --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateCustomizer.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The ImageTemplateCustomizer model. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = ImageTemplateCustomizer.class) +@JsonTypeName("ImageTemplateCustomizer") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Shell", value = ImageTemplateShellCustomizer.class), + @JsonSubTypes.Type(name = "WindowsRestart", value = ImageTemplateRestartCustomizer.class), + @JsonSubTypes.Type(name = "PowerShell", value = ImageTemplatePowerShellCustomizer.class) +}) +public class ImageTemplateCustomizer { + /** + * Friendly Name to provide context on what this customization step does. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get friendly Name to provide context on what this customization step does. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set friendly Name to provide context on what this customization step does. + * + * @param name the name value to set + * @return the ImageTemplateCustomizer object itself. + */ + public ImageTemplateCustomizer withName(String name) { + this.name = name; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateDistributor.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateDistributor.java new file mode 100644 index 000000000000..92802fef8499 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateDistributor.java @@ -0,0 +1,81 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Generic distribution object. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = ImageTemplateDistributor.class) +@JsonTypeName("ImageTemplateDistributor") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ManagedImage", value = ImageTemplateManagedImageDistributor.class), + @JsonSubTypes.Type(name = "SharedImage", value = ImageTemplateSharedImageDistributor.class), + @JsonSubTypes.Type(name = "VHD", value = ImageTemplateVhdDistributor.class) +}) +public class ImageTemplateDistributor { + /** + * The name to be used for the associated RunOutput. + */ + @JsonProperty(value = "runOutputName", required = true) + private String runOutputName; + + /** + * Tags that will be applied to the artifact once it has been + * created/updated by the distributor. + */ + @JsonProperty(value = "artifactTags") + private Map artifactTags; + + /** + * Get the name to be used for the associated RunOutput. + * + * @return the runOutputName value + */ + public String runOutputName() { + return this.runOutputName; + } + + /** + * Set the name to be used for the associated RunOutput. + * + * @param runOutputName the runOutputName value to set + * @return the ImageTemplateDistributor object itself. + */ + public ImageTemplateDistributor withRunOutputName(String runOutputName) { + this.runOutputName = runOutputName; + return this; + } + + /** + * Get tags that will be applied to the artifact once it has been created/updated by the distributor. + * + * @return the artifactTags value + */ + public Map artifactTags() { + return this.artifactTags; + } + + /** + * Set tags that will be applied to the artifact once it has been created/updated by the distributor. + * + * @param artifactTags the artifactTags value to set + * @return the ImageTemplateDistributor object itself. + */ + public ImageTemplateDistributor withArtifactTags(Map artifactTags) { + this.artifactTags = artifactTags; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateIsoSource.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateIsoSource.java new file mode 100644 index 000000000000..29bf0792a792 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateIsoSource.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.imagebuilder.v2019_02_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Describes an image source that is an installation ISO. Currently only + * supports Red Hat Enterprise Linux 7.2-7.5 ISO's. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = ImageTemplateIsoSource.class) +@JsonTypeName("ISO") +public class ImageTemplateIsoSource extends ImageTemplateSource { + /** + * URI to get the ISO image. This URI has to be accessible to the resource + * provider at the time of the image template creation. + */ + @JsonProperty(value = "sourceURI", required = true) + private String sourceURI; + + /** + * SHA256 Checksum of the ISO image. + */ + @JsonProperty(value = "sha256Checksum", required = true) + private String sha256Checksum; + + /** + * Get uRI to get the ISO image. This URI has to be accessible to the resource provider at the time of the image template creation. + * + * @return the sourceURI value + */ + public String sourceURI() { + return this.sourceURI; + } + + /** + * Set uRI to get the ISO image. This URI has to be accessible to the resource provider at the time of the image template creation. + * + * @param sourceURI the sourceURI value to set + * @return the ImageTemplateIsoSource object itself. + */ + public ImageTemplateIsoSource withSourceURI(String sourceURI) { + this.sourceURI = sourceURI; + return this; + } + + /** + * Get sHA256 Checksum of the ISO image. + * + * @return the sha256Checksum value + */ + public String sha256Checksum() { + return this.sha256Checksum; + } + + /** + * Set sHA256 Checksum of the ISO image. + * + * @param sha256Checksum the sha256Checksum value to set + * @return the ImageTemplateIsoSource object itself. + */ + public ImageTemplateIsoSource withSha256Checksum(String sha256Checksum) { + this.sha256Checksum = sha256Checksum; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateLastRunStatus.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateLastRunStatus.java new file mode 100644 index 000000000000..4b23efb4b3e2 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateLastRunStatus.java @@ -0,0 +1,150 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ImageTemplateLastRunStatus model. + */ +public class ImageTemplateLastRunStatus { + /** + * Start time of the last run (UTC). + */ + @JsonProperty(value = "startTime") + private DateTime startTime; + + /** + * End time of the last run (UTC). + */ + @JsonProperty(value = "endTime") + private DateTime endTime; + + /** + * State of the last run. Possible values include: 'Running', 'Succeeded', + * 'PartiallySucceeded', 'Failed'. + */ + @JsonProperty(value = "runState") + private String runState; + + /** + * Sub-state of the last run. Possible values include: 'Queued', + * 'Building', 'Customizing', 'Distributing'. + */ + @JsonProperty(value = "runSubState") + private String runSubState; + + /** + * Verbose information about the last run state. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get start time of the last run (UTC). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set start time of the last run (UTC). + * + * @param startTime the startTime value to set + * @return the ImageTemplateLastRunStatus object itself. + */ + public ImageTemplateLastRunStatus withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get end time of the last run (UTC). + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set end time of the last run (UTC). + * + * @param endTime the endTime value to set + * @return the ImageTemplateLastRunStatus object itself. + */ + public ImageTemplateLastRunStatus withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get state of the last run. Possible values include: 'Running', 'Succeeded', 'PartiallySucceeded', 'Failed'. + * + * @return the runState value + */ + public String runState() { + return this.runState; + } + + /** + * Set state of the last run. Possible values include: 'Running', 'Succeeded', 'PartiallySucceeded', 'Failed'. + * + * @param runState the runState value to set + * @return the ImageTemplateLastRunStatus object itself. + */ + public ImageTemplateLastRunStatus withRunState(String runState) { + this.runState = runState; + return this; + } + + /** + * Get sub-state of the last run. Possible values include: 'Queued', 'Building', 'Customizing', 'Distributing'. + * + * @return the runSubState value + */ + public String runSubState() { + return this.runSubState; + } + + /** + * Set sub-state of the last run. Possible values include: 'Queued', 'Building', 'Customizing', 'Distributing'. + * + * @param runSubState the runSubState value to set + * @return the ImageTemplateLastRunStatus object itself. + */ + public ImageTemplateLastRunStatus withRunSubState(String runSubState) { + this.runSubState = runSubState; + return this; + } + + /** + * Get verbose information about the last run state. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set verbose information about the last run state. + * + * @param message the message value to set + * @return the ImageTemplateLastRunStatus object itself. + */ + public ImageTemplateLastRunStatus withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateManagedImageDistributor.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateManagedImageDistributor.java new file mode 100644 index 000000000000..60533bb2324c --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateManagedImageDistributor.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Distribute as a Managed Disk Image. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = ImageTemplateManagedImageDistributor.class) +@JsonTypeName("ManagedImage") +public class ImageTemplateManagedImageDistributor extends ImageTemplateDistributor { + /** + * Resource Id of the Managed Disk Image. + */ + @JsonProperty(value = "imageId", required = true) + private String imageId; + + /** + * Azure location for the image, should match if image already exists. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Get resource Id of the Managed Disk Image. + * + * @return the imageId value + */ + public String imageId() { + return this.imageId; + } + + /** + * Set resource Id of the Managed Disk Image. + * + * @param imageId the imageId value to set + * @return the ImageTemplateManagedImageDistributor object itself. + */ + public ImageTemplateManagedImageDistributor withImageId(String imageId) { + this.imageId = imageId; + return this; + } + + /** + * Get azure location for the image, should match if image already exists. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set azure location for the image, should match if image already exists. + * + * @param location the location value to set + * @return the ImageTemplateManagedImageDistributor object itself. + */ + public ImageTemplateManagedImageDistributor withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateManagedImageSource.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateManagedImageSource.java new file mode 100644 index 000000000000..f22befc57f19 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateManagedImageSource.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Describes an image source that is a managed image in customer subscription. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = ImageTemplateManagedImageSource.class) +@JsonTypeName("ManagedImage") +public class ImageTemplateManagedImageSource extends ImageTemplateSource { + /** + * ARM resource id of the managed image in customer subscription. + */ + @JsonProperty(value = "imageId", required = true) + private String imageId; + + /** + * Get aRM resource id of the managed image in customer subscription. + * + * @return the imageId value + */ + public String imageId() { + return this.imageId; + } + + /** + * Set aRM resource id of the managed image in customer subscription. + * + * @param imageId the imageId value to set + * @return the ImageTemplateManagedImageSource object itself. + */ + public ImageTemplateManagedImageSource withImageId(String imageId) { + this.imageId = imageId; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplatePlatformImageSource.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplatePlatformImageSource.java new file mode 100644 index 000000000000..b1aa0e4c201d --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplatePlatformImageSource.java @@ -0,0 +1,130 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Describes an image source from [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = ImageTemplatePlatformImageSource.class) +@JsonTypeName("PlatformImage") +public class ImageTemplatePlatformImageSource extends ImageTemplateSource { + /** + * Image Publisher in [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + */ + @JsonProperty(value = "publisher") + private String publisher; + + /** + * Image offer from the [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + */ + @JsonProperty(value = "offer") + private String offer; + + /** + * Image sku from the [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + */ + @JsonProperty(value = "sku") + private String sku; + + /** + * Image version from the [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + */ + @JsonProperty(value = "version") + private String version; + + /** + * Get image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + * @return the publisher value + */ + public String publisher() { + return this.publisher; + } + + /** + * Set image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + * @param publisher the publisher value to set + * @return the ImageTemplatePlatformImageSource object itself. + */ + public ImageTemplatePlatformImageSource withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + * @return the offer value + */ + public String offer() { + return this.offer; + } + + /** + * Set image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + * @param offer the offer value to set + * @return the ImageTemplatePlatformImageSource object itself. + */ + public ImageTemplatePlatformImageSource withOffer(String offer) { + this.offer = offer; + return this; + } + + /** + * Get image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + * @return the sku value + */ + public String sku() { + return this.sku; + } + + /** + * Set image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + * @param sku the sku value to set + * @return the ImageTemplatePlatformImageSource object itself. + */ + public ImageTemplatePlatformImageSource withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Get image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + * @param version the version value to set + * @return the ImageTemplatePlatformImageSource object itself. + */ + public ImageTemplatePlatformImageSource withVersion(String version) { + this.version = version; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplatePowerShellCustomizer.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplatePowerShellCustomizer.java new file mode 100644 index 000000000000..fe23ce4685ab --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplatePowerShellCustomizer.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Runs the specified PowerShell on the VM (Windows). Corresponds to Packer + * powershell provisioner. Exactly one of 'script' or 'inline' can be + * specified. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = ImageTemplatePowerShellCustomizer.class) +@JsonTypeName("PowerShell") +public class ImageTemplatePowerShellCustomizer extends ImageTemplateCustomizer { + /** + * The PowerShell script to be run for customizing. It can be a github + * link, SAS URI for Azure Storage, etc. + */ + @JsonProperty(value = "script") + private String script; + + /** + * Array of PowerShell commands to execute. + */ + @JsonProperty(value = "inline") + private List inline; + + /** + * Valid exit codes for the PowerShell script. [Default: 0]. + */ + @JsonProperty(value = "validExitCodes") + private List validExitCodes; + + /** + * Get the PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc. + * + * @return the script value + */ + public String script() { + return this.script; + } + + /** + * Set the PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc. + * + * @param script the script value to set + * @return the ImageTemplatePowerShellCustomizer object itself. + */ + public ImageTemplatePowerShellCustomizer withScript(String script) { + this.script = script; + return this; + } + + /** + * Get array of PowerShell commands to execute. + * + * @return the inline value + */ + public List inline() { + return this.inline; + } + + /** + * Set array of PowerShell commands to execute. + * + * @param inline the inline value to set + * @return the ImageTemplatePowerShellCustomizer object itself. + */ + public ImageTemplatePowerShellCustomizer withInline(List inline) { + this.inline = inline; + return this; + } + + /** + * Get valid exit codes for the PowerShell script. [Default: 0]. + * + * @return the validExitCodes value + */ + public List validExitCodes() { + return this.validExitCodes; + } + + /** + * Set valid exit codes for the PowerShell script. [Default: 0]. + * + * @param validExitCodes the validExitCodes value to set + * @return the ImageTemplatePowerShellCustomizer object itself. + */ + public ImageTemplatePowerShellCustomizer withValidExitCodes(List validExitCodes) { + this.validExitCodes = validExitCodes; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateRestartCustomizer.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateRestartCustomizer.java new file mode 100644 index 000000000000..16c49818e6a5 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateRestartCustomizer.java @@ -0,0 +1,102 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Reboots a VM and waits for it to come back online (Windows). Corresponds to + * Packer windows-restart provisioner. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = ImageTemplateRestartCustomizer.class) +@JsonTypeName("WindowsRestart") +public class ImageTemplateRestartCustomizer extends ImageTemplateCustomizer { + /** + * Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer + * restart"']. + */ + @JsonProperty(value = "restartCommand") + private String restartCommand; + + /** + * Command to check if restart succeeded [Default: '']. + */ + @JsonProperty(value = "restartCheckCommand") + private String restartCheckCommand; + + /** + * Restart timeout specified as a string of magnitude and unit, e.g. '5m' + * (5 minutes) or '2h' (2 hours) [Default: '5m']. + */ + @JsonProperty(value = "restartTimeout") + private String restartTimeout; + + /** + * Get command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer restart"']. + * + * @return the restartCommand value + */ + public String restartCommand() { + return this.restartCommand; + } + + /** + * Set command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer restart"']. + * + * @param restartCommand the restartCommand value to set + * @return the ImageTemplateRestartCustomizer object itself. + */ + public ImageTemplateRestartCustomizer withRestartCommand(String restartCommand) { + this.restartCommand = restartCommand; + return this; + } + + /** + * Get command to check if restart succeeded [Default: '']. + * + * @return the restartCheckCommand value + */ + public String restartCheckCommand() { + return this.restartCheckCommand; + } + + /** + * Set command to check if restart succeeded [Default: '']. + * + * @param restartCheckCommand the restartCheckCommand value to set + * @return the ImageTemplateRestartCustomizer object itself. + */ + public ImageTemplateRestartCustomizer withRestartCheckCommand(String restartCheckCommand) { + this.restartCheckCommand = restartCheckCommand; + return this; + } + + /** + * Get restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m']. + * + * @return the restartTimeout value + */ + public String restartTimeout() { + return this.restartTimeout; + } + + /** + * Set restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m']. + * + * @param restartTimeout the restartTimeout value to set + * @return the ImageTemplateRestartCustomizer object itself. + */ + public ImageTemplateRestartCustomizer withRestartTimeout(String restartTimeout) { + this.restartTimeout = restartTimeout; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateSharedImageDistributor.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateSharedImageDistributor.java new file mode 100644 index 000000000000..5b42e10dbe33 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateSharedImageDistributor.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Distribute via Shared Image Gallery. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = ImageTemplateSharedImageDistributor.class) +@JsonTypeName("SharedImage") +public class ImageTemplateSharedImageDistributor extends ImageTemplateDistributor { + /** + * Resource Id of the Shared Image Gallery image. + */ + @JsonProperty(value = "galleryImageId", required = true) + private String galleryImageId; + + /** + * The replicationRegions property. + */ + @JsonProperty(value = "replicationRegions", required = true) + private List replicationRegions; + + /** + * Get resource Id of the Shared Image Gallery image. + * + * @return the galleryImageId value + */ + public String galleryImageId() { + return this.galleryImageId; + } + + /** + * Set resource Id of the Shared Image Gallery image. + * + * @param galleryImageId the galleryImageId value to set + * @return the ImageTemplateSharedImageDistributor object itself. + */ + public ImageTemplateSharedImageDistributor withGalleryImageId(String galleryImageId) { + this.galleryImageId = galleryImageId; + return this; + } + + /** + * Get the replicationRegions value. + * + * @return the replicationRegions value + */ + public List replicationRegions() { + return this.replicationRegions; + } + + /** + * Set the replicationRegions value. + * + * @param replicationRegions the replicationRegions value to set + * @return the ImageTemplateSharedImageDistributor object itself. + */ + public ImageTemplateSharedImageDistributor withReplicationRegions(List replicationRegions) { + this.replicationRegions = replicationRegions; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateShellCustomizer.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateShellCustomizer.java new file mode 100644 index 000000000000..ce45a491c4d1 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateShellCustomizer.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Runs a shell script during the customization phase (Linux). Corresponds to + * Packer shell provisioner. Exactly one of 'script' or 'inline' can be + * specified. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = ImageTemplateShellCustomizer.class) +@JsonTypeName("Shell") +public class ImageTemplateShellCustomizer extends ImageTemplateCustomizer { + /** + * The shell script to be run for customizing. It can be a github link, SAS + * URI for Azure Storage, etc. + */ + @JsonProperty(value = "script") + private String script; + + /** + * Array of shell commands to execute. + */ + @JsonProperty(value = "inline") + private List inline; + + /** + * Get the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc. + * + * @return the script value + */ + public String script() { + return this.script; + } + + /** + * Set the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc. + * + * @param script the script value to set + * @return the ImageTemplateShellCustomizer object itself. + */ + public ImageTemplateShellCustomizer withScript(String script) { + this.script = script; + return this; + } + + /** + * Get array of shell commands to execute. + * + * @return the inline value + */ + public List inline() { + return this.inline; + } + + /** + * Set array of shell commands to execute. + * + * @param inline the inline value to set + * @return the ImageTemplateShellCustomizer object itself. + */ + public ImageTemplateShellCustomizer withInline(List inline) { + this.inline = inline; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateSource.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateSource.java new file mode 100644 index 000000000000..79e75faa6d5c --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateSource.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The ImageTemplateSource model. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = ImageTemplateSource.class) +@JsonTypeName("ImageTemplateSource") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ISO", value = ImageTemplateIsoSource.class), + @JsonSubTypes.Type(name = "PlatformImage", value = ImageTemplatePlatformImageSource.class), + @JsonSubTypes.Type(name = "ManagedImage", value = ImageTemplateManagedImageSource.class) +}) +public class ImageTemplateSource { +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateUpdateParameters.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateUpdateParameters.java new file mode 100644 index 000000000000..81d2b93db1e3 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateUpdateParameters.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.imagebuilder.v2019_02_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for updating an image template. + */ +public class ImageTemplateUpdateParameters { + /** + * The user-specified tags associated with the image template. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the user-specified tags associated with the image template. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the user-specified tags associated with the image template. + * + * @param tags the tags value to set + * @return the ImageTemplateUpdateParameters object itself. + */ + public ImageTemplateUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateVhdDistributor.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateVhdDistributor.java new file mode 100644 index 000000000000..ed213a5c3e8a --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ImageTemplateVhdDistributor.java @@ -0,0 +1,20 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Distribute via VHD in a storage account. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = ImageTemplateVhdDistributor.class) +@JsonTypeName("VHD") +public class ImageTemplateVhdDistributor extends ImageTemplateDistributor { +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/InnerError.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/InnerError.java new file mode 100644 index 000000000000..841af268de25 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/InnerError.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Inner error details. + */ +public class InnerError { + /** + * The exception type. + */ + @JsonProperty(value = "exceptionType") + private String exceptionType; + + /** + * The internal error message or exception dump. + */ + @JsonProperty(value = "errorDetail") + private String errorDetail; + + /** + * Get the exception type. + * + * @return the exceptionType value + */ + public String exceptionType() { + return this.exceptionType; + } + + /** + * Set the exception type. + * + * @param exceptionType the exceptionType value to set + * @return the InnerError object itself. + */ + public InnerError withExceptionType(String exceptionType) { + this.exceptionType = exceptionType; + return this; + } + + /** + * Get the internal error message or exception dump. + * + * @return the errorDetail value + */ + public String errorDetail() { + return this.errorDetail; + } + + /** + * Set the internal error message or exception dump. + * + * @param errorDetail the errorDetail value to set + * @return the InnerError object itself. + */ + public InnerError withErrorDetail(String errorDetail) { + this.errorDetail = errorDetail; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/Operation.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/Operation.java new file mode 100644 index 000000000000..4e696babdbba --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/Operation.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation.VirtualMachineImagesManager; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the origin value. + */ + String origin(); + + /** + * @return the properties value. + */ + Object properties(); + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/OperationDisplay.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/OperationDisplay.java new file mode 100644 index 000000000000..493710a81717 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/OperationDisplay.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.imagebuilder.v2019_02_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that describes the operation. + */ +public class OperationDisplay { + /** + * Friendly name of the resource provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * The operation type. + * For example: read, write, delete, or listKeys/action. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * The resource type on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * The friendly name of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider value. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider value. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get for example: read, write, delete, or listKeys/action. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set for example: read, write, delete, or listKeys/action. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the resource value. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description value. + * + * @param description the description value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/Operations.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/Operations.java new file mode 100644 index 000000000000..4b3cd4866f2d --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/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.imagebuilder.v2019_02_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ProvisioningError.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ProvisioningError.java new file mode 100644 index 000000000000..72a165d7f751 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/ProvisioningError.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ProvisioningError model. + */ +public class ProvisioningError { + /** + * Error code of the provisioning failure. Possible values include: + * 'BadSourceType', 'BadPIRSource', 'BadISOSource', + * 'BadManagedImageSource', 'BadCustomizerType', + * 'UnsupportedCustomizerType', 'NoCustomizerScript', 'BadDistributeType', + * 'BadSharedImageDistribute', 'ServerError', 'Other'. + */ + @JsonProperty(value = "provisioningErrorCode") + private String provisioningErrorCode; + + /** + * Verbose error message about the provisioning failure. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code of the provisioning failure. Possible values include: 'BadSourceType', 'BadPIRSource', 'BadISOSource', 'BadManagedImageSource', 'BadCustomizerType', 'UnsupportedCustomizerType', 'NoCustomizerScript', 'BadDistributeType', 'BadSharedImageDistribute', 'ServerError', 'Other'. + * + * @return the provisioningErrorCode value + */ + public String provisioningErrorCode() { + return this.provisioningErrorCode; + } + + /** + * Set error code of the provisioning failure. Possible values include: 'BadSourceType', 'BadPIRSource', 'BadISOSource', 'BadManagedImageSource', 'BadCustomizerType', 'UnsupportedCustomizerType', 'NoCustomizerScript', 'BadDistributeType', 'BadSharedImageDistribute', 'ServerError', 'Other'. + * + * @param provisioningErrorCode the provisioningErrorCode value to set + * @return the ProvisioningError object itself. + */ + public ProvisioningError withProvisioningErrorCode(String provisioningErrorCode) { + this.provisioningErrorCode = provisioningErrorCode; + return this; + } + + /** + * Get verbose error message about the provisioning failure. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set verbose error message about the provisioning failure. + * + * @param message the message value to set + * @return the ProvisioningError object itself. + */ + public ProvisioningError withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/RunOutput.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/RunOutput.java new file mode 100644 index 000000000000..571adb7cd1e1 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/RunOutput.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation.RunOutputInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation.VirtualMachineImagesManager; + +/** + * Type representing RunOutput. + */ +public interface RunOutput extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the artifactId value. + */ + String artifactId(); + + /** + * @return the artifactUri value. + */ + String artifactUri(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/VirtualMachineImageTemplates.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/VirtualMachineImageTemplates.java new file mode 100644 index 000000000000..efe7812452b7 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/VirtualMachineImageTemplates.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ImageTemplate; +import rx.Completable; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.RunOutput; + +/** + * Type representing VirtualMachineImageTemplates. + */ +public interface VirtualMachineImageTemplates { + /** + * Begins definition for a new ImageTemplate resource. + * @param name resource name. + * @return the first stage of the new ImageTemplate definition. + */ + ImageTemplate.DefinitionStages.Blank defineImageTemplate(String name); + + /** + * Get information about a virtual machine image template. + * + * @param resourceGroupName resource group name + * @param name resource name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByResourceGroupAsync(String resourceGroupName, String name); + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @param resourceGroupName resource group name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupAsync(String resourceGroupName); + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName resource group name + * @param name resource name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String name); + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable runAsync(String resourceGroupName, String imageTemplateName); + + /** + * Get the specified run output for the specified image template resource. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param runOutputName The name of the run output + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getRunOutputAsync(String resourceGroupName, String imageTemplateName, String runOutputName); + + /** + * List all run outputs for the specified Image Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listRunOutputsAsync(final String resourceGroupName, final String imageTemplateName); + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/IdParsingUtils.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..d758e25d9853 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/ImageBuilderClientImpl.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/ImageBuilderClientImpl.java new file mode 100644 index 000000000000..2ef6de27c76a --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/ImageBuilderClientImpl.java @@ -0,0 +1,212 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ImageBuilderClientImpl class. + */ +public class ImageBuilderClientImpl 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 ImageBuilderClientImpl 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 ImageBuilderClientImpl 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 ImageBuilderClientImpl 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 ImageBuilderClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The VirtualMachineImageTemplatesInner object to access its operations. + */ + private VirtualMachineImageTemplatesInner virtualMachineImageTemplates; + + /** + * Gets the VirtualMachineImageTemplatesInner object to access its operations. + * @return the VirtualMachineImageTemplatesInner object. + */ + public VirtualMachineImageTemplatesInner virtualMachineImageTemplates() { + return this.virtualMachineImageTemplates; + } + + /** + * 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 ImageBuilderClient client. + * + * @param credentials the management credentials for Azure + */ + public ImageBuilderClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of ImageBuilderClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public ImageBuilderClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of ImageBuilderClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public ImageBuilderClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2019-02-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.virtualMachineImageTemplates = new VirtualMachineImageTemplatesInner(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(), "ImageBuilderClient", "2019-02-01-preview"); + } +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/ImageTemplateImpl.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/ImageTemplateImpl.java new file mode 100644 index 000000000000..6f6d187a03c2 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/ImageTemplateImpl.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ImageTemplate; +import rx.Observable; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ImageTemplateSource; +import java.util.List; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ImageTemplateCustomizer; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ImageTemplateDistributor; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ProvisioningError; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ImageTemplateLastRunStatus; + +class ImageTemplateImpl extends GroupableResourceCoreImpl implements ImageTemplate, ImageTemplate.Definition, ImageTemplate.Update { + ImageTemplateImpl(String name, ImageTemplateInner inner, VirtualMachineImagesManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + VirtualMachineImageTemplatesInner client = this.manager().inner().virtualMachineImageTemplates(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + VirtualMachineImageTemplatesInner client = this.manager().inner().virtualMachineImageTemplates(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + VirtualMachineImageTemplatesInner client = this.manager().inner().virtualMachineImageTemplates(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List customize() { + return this.inner().customize(); + } + + @Override + public List distribute() { + return this.inner().distribute(); + } + + @Override + public ImageTemplateLastRunStatus lastRunStatus() { + return this.inner().lastRunStatus(); + } + + @Override + public ProvisioningError provisioningError() { + return this.inner().provisioningError(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public ImageTemplateSource source() { + return this.inner().source(); + } + + @Override + public ImageTemplateImpl withDistribute(List distribute) { + this.inner().withDistribute(distribute); + return this; + } + + @Override + public ImageTemplateImpl withSource(ImageTemplateSource source) { + this.inner().withSource(source); + return this; + } + + @Override + public ImageTemplateImpl withCustomize(List customize) { + this.inner().withCustomize(customize); + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/ImageTemplateInner.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/ImageTemplateInner.java new file mode 100644 index 000000000000..9a31240275c6 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/ImageTemplateInner.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation; + +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ImageTemplateSource; +import java.util.List; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ImageTemplateCustomizer; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ImageTemplateDistributor; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ProvisioningError; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ImageTemplateLastRunStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The ImageTemplateInner model. + */ +@JsonFlatten +public class ImageTemplateInner extends Resource { + /** + * Specifies the properties used to describe the source image. + */ + @JsonProperty(value = "properties.source", required = true) + private ImageTemplateSource source; + + /** + * Specifies the properties used to describe the customization steps of the + * image, like Image source etc. + */ + @JsonProperty(value = "properties.customize") + private List customize; + + /** + * The distribution targets where the image output needs to go to. + */ + @JsonProperty(value = "properties.distribute", required = true) + private List distribute; + + /** + * Provisioning state of the resource. Possible values include: 'Creating', + * 'Succeeded', 'Failed', 'Deleting'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Provisioning error, if any. + */ + @JsonProperty(value = "properties.provisioningError", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningError provisioningError; + + /** + * State of 'run' that is currently executing or was last executed. + */ + @JsonProperty(value = "properties.lastRunStatus", access = JsonProperty.Access.WRITE_ONLY) + private ImageTemplateLastRunStatus lastRunStatus; + + /** + * Get specifies the properties used to describe the source image. + * + * @return the source value + */ + public ImageTemplateSource source() { + return this.source; + } + + /** + * Set specifies the properties used to describe the source image. + * + * @param source the source value to set + * @return the ImageTemplateInner object itself. + */ + public ImageTemplateInner withSource(ImageTemplateSource source) { + this.source = source; + return this; + } + + /** + * Get specifies the properties used to describe the customization steps of the image, like Image source etc. + * + * @return the customize value + */ + public List customize() { + return this.customize; + } + + /** + * Set specifies the properties used to describe the customization steps of the image, like Image source etc. + * + * @param customize the customize value to set + * @return the ImageTemplateInner object itself. + */ + public ImageTemplateInner withCustomize(List customize) { + this.customize = customize; + return this; + } + + /** + * Get the distribution targets where the image output needs to go to. + * + * @return the distribute value + */ + public List distribute() { + return this.distribute; + } + + /** + * Set the distribution targets where the image output needs to go to. + * + * @param distribute the distribute value to set + * @return the ImageTemplateInner object itself. + */ + public ImageTemplateInner withDistribute(List distribute) { + this.distribute = distribute; + return this; + } + + /** + * Get provisioning state of the resource. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Deleting'. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get provisioning error, if any. + * + * @return the provisioningError value + */ + public ProvisioningError provisioningError() { + return this.provisioningError; + } + + /** + * Get state of 'run' that is currently executing or was last executed. + * + * @return the lastRunStatus value + */ + public ImageTemplateLastRunStatus lastRunStatus() { + return this.lastRunStatus; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/OperationImpl.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/OperationImpl.java new file mode 100644 index 000000000000..3948d1dd7844 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/OperationImpl.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation; + +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final VirtualMachineImagesManager manager; + OperationImpl(OperationInner inner, VirtualMachineImagesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public VirtualMachineImagesManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String origin() { + return this.inner().origin(); + } + + @Override + public Object properties() { + return this.inner().properties(); + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/OperationInner.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/OperationInner.java new file mode 100644 index 000000000000..7d824ee96d19 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/OperationInner.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation; + +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A REST API operation. + */ +public class OperationInner { + /** + * The operation name. + * This is of the format {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that describes the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * The intended executor of the operation. + */ + @JsonProperty(value = "origin") + private String origin; + + /** + * Properties of the operation. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get this is of the format {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set this is of the format {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display value. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display value. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin value. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin value. + * + * @param origin the origin value to set + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the OperationInner object itself. + */ + public OperationInner withProperties(Object properties) { + this.properties = properties; + return this; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/OperationsImpl.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/OperationsImpl.java new file mode 100644 index 000000000000..40a7b7b67f0e --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/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.imagebuilder.v2019_02_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final VirtualMachineImagesManager manager; + + OperationsImpl(VirtualMachineImagesManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public VirtualMachineImagesManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/OperationsInner.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/OperationsInner.java new file mode 100644 index 000000000000..6144938302a3 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ApiErrorException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.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 Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ImageBuilderClientImpl 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, ImageBuilderClientImpl 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.imagebuilder.v2019_02_01_preview.Operations list" }) + @GET("providers/Microsoft.VirtualMachineImages/operations") + Observable> list(@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.imagebuilder.v2019_02_01_preview.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException 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<OperationInner> 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 available operations for the Microsoft.VirtualMachineImages provider. + * + * @param serviceCallback 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 available operations for the Microsoft.VirtualMachineImages provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> 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 available operations for the Microsoft.VirtualMachineImages provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ApiErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ApiErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ApiErrorException.class) + .build(response); + } + + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException 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<OperationInner> 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 available operations for the Microsoft.VirtualMachineImages provider. + * + * @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 available operations for the Microsoft.VirtualMachineImages provider. + * + * @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<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider. + * + * @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<OperationInner> 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 available operations for the Microsoft.VirtualMachineImages provider. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> 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 ApiErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ApiErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ApiErrorException.class) + .build(response); + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/PageImpl.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/PageImpl.java new file mode 100644 index 000000000000..39a1d9c521a4 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/RunOutputImpl.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/RunOutputImpl.java new file mode 100644 index 000000000000..36c78a77d2ee --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/RunOutputImpl.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation; + +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.RunOutput; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; + +class RunOutputImpl extends IndexableRefreshableWrapperImpl implements RunOutput { + private final VirtualMachineImagesManager manager; + private String resourceGroupName; + private String imageTemplateName; + private String runOutputName; + + RunOutputImpl(RunOutputInner inner, VirtualMachineImagesManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.imageTemplateName = IdParsingUtils.getValueFromIdByName(inner.id(), "imageTemplates"); + this.runOutputName = IdParsingUtils.getValueFromIdByName(inner.id(), "runOutputs"); + } + + @Override + public VirtualMachineImagesManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + VirtualMachineImageTemplatesInner client = this.manager().inner().virtualMachineImageTemplates(); + return client.getRunOutputAsync(this.resourceGroupName, this.imageTemplateName, this.runOutputName); + } + + + + @Override + public String artifactId() { + return this.inner().artifactId(); + } + + @Override + public String artifactUri() { + return this.inner().artifactUri(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/RunOutputInner.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/RunOutputInner.java new file mode 100644 index 000000000000..2dd861ed04d5 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/RunOutputInner.java @@ -0,0 +1,129 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.SubResource; + +/** + * Represents an output that was created by running an image template. + */ +@JsonFlatten +public class RunOutputInner extends SubResource { + /** + * The resource id of the artifact. + */ + @JsonProperty(value = "properties.artifactId") + private String artifactId; + + /** + * The location URI of the artifact. + */ + @JsonProperty(value = "properties.artifactUri") + private String artifactUri; + + /** + * Provisioning state of the resource. Possible values include: 'Creating', + * 'Succeeded', 'Failed', 'Deleting'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Resource name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get the resource id of the artifact. + * + * @return the artifactId value + */ + public String artifactId() { + return this.artifactId; + } + + /** + * Set the resource id of the artifact. + * + * @param artifactId the artifactId value to set + * @return the RunOutputInner object itself. + */ + public RunOutputInner withArtifactId(String artifactId) { + this.artifactId = artifactId; + return this; + } + + /** + * Get the location URI of the artifact. + * + * @return the artifactUri value + */ + public String artifactUri() { + return this.artifactUri; + } + + /** + * Set the location URI of the artifact. + * + * @param artifactUri the artifactUri value to set + * @return the RunOutputInner object itself. + */ + public RunOutputInner withArtifactUri(String artifactUri) { + this.artifactUri = artifactUri; + return this; + } + + /** + * Get provisioning state of the resource. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Deleting'. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get resource name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set resource name. + * + * @param name the name value to set + * @return the RunOutputInner object itself. + */ + public RunOutputInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/VirtualMachineImageTemplatesImpl.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/VirtualMachineImageTemplatesImpl.java new file mode 100644 index 000000000000..97dd0380b267 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/VirtualMachineImageTemplatesImpl.java @@ -0,0 +1,158 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ImageTemplate; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.RunOutput; + +class VirtualMachineImageTemplatesImpl extends WrapperImpl implements VirtualMachineImageTemplates { + private final VirtualMachineImagesManager manager; + + VirtualMachineImageTemplatesImpl(VirtualMachineImagesManager manager) { + super(manager.inner().virtualMachineImageTemplates()); + this.manager = manager; + } + + public VirtualMachineImagesManager manager() { + return this.manager; + } + + @Override + public ImageTemplateImpl defineImageTemplate(String name) { + return wrapImageTemplateModel(name); + } + + private ImageTemplateImpl wrapImageTemplateModel(String name) { + return new ImageTemplateImpl(name, new ImageTemplateInner(), this.manager()); + } + + private ImageTemplateImpl wrapImageTemplateModel(ImageTemplateInner inner) { + return new ImageTemplateImpl(inner.name(), inner, manager()); + } + + private RunOutputImpl wrapRunOutputModel(RunOutputInner inner) { + return new RunOutputImpl(inner, manager()); + } + + private Observable getImageTemplateInnerUsingVirtualMachineImageTemplatesInnerAsync(String resourceGroupName, String name) { + VirtualMachineImageTemplatesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + private Observable getRunOutputInnerUsingVirtualMachineImageTemplatesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String imageTemplateName = IdParsingUtils.getValueFromIdByName(id, "imageTemplates"); + String runOutputName = IdParsingUtils.getValueFromIdByName(id, "runOutputs"); + VirtualMachineImageTemplatesInner client = this.inner(); + return client.getRunOutputAsync(resourceGroupName, imageTemplateName, runOutputName); + } + + @Override + public Observable getByResourceGroupAsync(String resourceGroupName, String name) { + return this.getImageTemplateInnerUsingVirtualMachineImageTemplatesInnerAsync(resourceGroupName, name).flatMap(new Func1> () { + @Override + public Observable call(ImageTemplateInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ImageTemplate)wrapImageTemplateModel(inner)); + } + } + }); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + VirtualMachineImageTemplatesInner 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 ImageTemplate call(ImageTemplateInner inner) { + return wrapImageTemplateModel(inner); + } + }); + } + + @Override + public Observable listAsync() { + VirtualMachineImageTemplatesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ImageTemplate call(ImageTemplateInner inner) { + return wrapImageTemplateModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String name) { + return this.inner().deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Completable runAsync(String resourceGroupName, String imageTemplateName) { + VirtualMachineImageTemplatesInner client = this.inner(); + return client.runAsync(resourceGroupName, imageTemplateName).toCompletable(); + } + + @Override + public Observable getRunOutputAsync(String resourceGroupName, String imageTemplateName, String runOutputName) { + VirtualMachineImageTemplatesInner client = this.inner(); + return client.getRunOutputAsync(resourceGroupName, imageTemplateName, runOutputName) + .flatMap(new Func1>() { + @Override + public Observable call(RunOutputInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((RunOutput)wrapRunOutputModel(inner)); + } + } + }); + } + + @Override + public Observable listRunOutputsAsync(final String resourceGroupName, final String imageTemplateName) { + VirtualMachineImageTemplatesInner client = this.inner(); + return client.listRunOutputsAsync(resourceGroupName, imageTemplateName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public RunOutput call(RunOutputInner inner) { + return wrapRunOutputModel(inner); + } + }); + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/VirtualMachineImageTemplatesInner.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/VirtualMachineImageTemplatesInner.java new file mode 100644 index 000000000000..1dad24bfe39d --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/VirtualMachineImageTemplatesInner.java @@ -0,0 +1,1648 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.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.imagebuilder.v2019_02_01_preview.ApiErrorException; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.ImageTemplateUpdateParameters; +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 java.util.Map; +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; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; + +/** + * An instance of this class provides access to all the operations defined + * in VirtualMachineImageTemplates. + */ +public class VirtualMachineImageTemplatesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private VirtualMachineImageTemplatesService service; + /** The service client containing this operation class. */ + private ImageBuilderClientImpl client; + + /** + * Initializes an instance of VirtualMachineImageTemplatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public VirtualMachineImageTemplatesInner(Retrofit retrofit, ImageBuilderClientImpl client) { + this.service = retrofit.create(VirtualMachineImageTemplatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for VirtualMachineImageTemplates to be + * used by Retrofit to perform actually REST calls. + */ + interface VirtualMachineImageTemplatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.VirtualMachineImages/imageTemplates") + 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.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @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.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("imageTemplateName") String imageTemplateName, @Body ImageTemplateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("imageTemplateName") String imageTemplateName, @Body ImageTemplateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("imageTemplateName") String imageTemplateName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ImageTemplateUpdateParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("imageTemplateName") String imageTemplateName, @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.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("imageTemplateName") String imageTemplateName, @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.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("imageTemplateName") String imageTemplateName, @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.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates run" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/run") + Observable> run(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("imageTemplateName") String imageTemplateName, @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.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates beginRun" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/run") + Observable> beginRun(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("imageTemplateName") String imageTemplateName, @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.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates listRunOutputs" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs") + Observable> listRunOutputs(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("imageTemplateName") String imageTemplateName, @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.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates getRunOutput" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs/{runOutputName}") + Observable> getRunOutput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("imageTemplateName") String imageTemplateName, @Path("runOutputName") String runOutputName, @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.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates 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.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates listRunOutputsNext" }) + @GET + Observable> listRunOutputsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException 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<ImageTemplateInner> 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(); + } + }; + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ImageTemplateInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ImageTemplateInner> 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)); + } + }); + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ImageTemplateInner> 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 ApiErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ApiErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ApiErrorException.class) + .build(response); + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException 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<ImageTemplateInner> 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(); + } + }; + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @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); + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ImageTemplateInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ImageTemplateInner> 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)); + } + }); + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ImageTemplateInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, 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 = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ApiErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ApiErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ApiErrorException.class) + .build(response); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param parameters Parameters supplied to the CreateImageTemplate operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageTemplateInner object if successful. + */ + public ImageTemplateInner createOrUpdate(String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, imageTemplateName, parameters).toBlocking().last().body(); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param parameters Parameters supplied to the CreateImageTemplate 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 imageTemplateName, ImageTemplateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, imageTemplateName, parameters), serviceCallback); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param parameters Parameters supplied to the CreateImageTemplate operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, imageTemplateName, parameters).map(new Func1, ImageTemplateInner>() { + @Override + public ImageTemplateInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param parameters Parameters supplied to the CreateImageTemplate operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String imageTemplateName, ImageTemplateInner 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 (imageTemplateName == null) { + throw new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, imageTemplateName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param parameters Parameters supplied to the CreateImageTemplate operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageTemplateInner object if successful. + */ + public ImageTemplateInner beginCreateOrUpdate(String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, imageTemplateName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param parameters Parameters supplied to the CreateImageTemplate 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 beginCreateOrUpdateAsync(String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, imageTemplateName, parameters), serviceCallback); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param parameters Parameters supplied to the CreateImageTemplate operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageTemplateInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, imageTemplateName, parameters).map(new Func1, ImageTemplateInner>() { + @Override + public ImageTemplateInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param parameters Parameters supplied to the CreateImageTemplate operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageTemplateInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String imageTemplateName, ImageTemplateInner 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 (imageTemplateName == null) { + throw new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, imageTemplateName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws ApiErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ApiErrorException.class) + .build(response); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageTemplateInner object if successful. + */ + public ImageTemplateInner update(String resourceGroupName, String imageTemplateName) { + return updateWithServiceResponseAsync(resourceGroupName, imageTemplateName).toBlocking().single().body(); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param serviceCallback 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 imageTemplateName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, imageTemplateName), serviceCallback); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageTemplateInner object + */ + public Observable updateAsync(String resourceGroupName, String imageTemplateName) { + return updateWithServiceResponseAsync(resourceGroupName, imageTemplateName).map(new Func1, ImageTemplateInner>() { + @Override + public ImageTemplateInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageTemplateInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String imageTemplateName) { + 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 (imageTemplateName == null) { + throw new IllegalArgumentException("Parameter imageTemplateName 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 Map tags = null; + ImageTemplateUpdateParameters parameters = new ImageTemplateUpdateParameters(); + parameters.withTags(null); + return service.update(this.client.subscriptionId(), resourceGroupName, imageTemplateName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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); + } + } + }); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param tags The user-specified tags associated with the image template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageTemplateInner object if successful. + */ + public ImageTemplateInner update(String resourceGroupName, String imageTemplateName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, imageTemplateName, tags).toBlocking().single().body(); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param tags The user-specified tags associated with the image template. + * @param serviceCallback 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 imageTemplateName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, imageTemplateName, tags), serviceCallback); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param tags The user-specified tags associated with the image template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageTemplateInner object + */ + public Observable updateAsync(String resourceGroupName, String imageTemplateName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, imageTemplateName, tags).map(new Func1, ImageTemplateInner>() { + @Override + public ImageTemplateInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param tags The user-specified tags associated with the image template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageTemplateInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String imageTemplateName, Map tags) { + 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 (imageTemplateName == null) { + throw new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(tags); + ImageTemplateUpdateParameters parameters = new ImageTemplateUpdateParameters(); + parameters.withTags(tags); + return service.update(this.client.subscriptionId(), resourceGroupName, imageTemplateName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 ApiErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ApiErrorException.class) + .build(response); + } + + /** + * Get information about a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageTemplateInner object if successful. + */ + public ImageTemplateInner getByResourceGroup(String resourceGroupName, String imageTemplateName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, imageTemplateName).toBlocking().single().body(); + } + + /** + * Get information about a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param serviceCallback 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 imageTemplateName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, imageTemplateName), serviceCallback); + } + + /** + * Get information about a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageTemplateInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String imageTemplateName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, imageTemplateName).map(new Func1, ImageTemplateInner>() { + @Override + public ImageTemplateInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get information about a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageTemplateInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String imageTemplateName) { + 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 (imageTemplateName == null) { + throw new IllegalArgumentException("Parameter imageTemplateName 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, imageTemplateName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ApiErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ApiErrorException.class) + .build(response); + } + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException 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 imageTemplateName) { + deleteWithServiceResponseAsync(resourceGroupName, imageTemplateName).toBlocking().last().body(); + } + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param serviceCallback 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 imageTemplateName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, imageTemplateName), serviceCallback); + } + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String imageTemplateName) { + return deleteWithServiceResponseAsync(resourceGroupName, imageTemplateName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String imageTemplateName) { + 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 (imageTemplateName == null) { + throw new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, imageTemplateName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String imageTemplateName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, imageTemplateName).toBlocking().single().body(); + } + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String imageTemplateName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, imageTemplateName), serviceCallback); + } + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String imageTemplateName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, imageTemplateName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String imageTemplateName) { + 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 (imageTemplateName == null) { + throw new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, imageTemplateName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws ApiErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ApiErrorException.class) + .build(response); + } + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void run(String resourceGroupName, String imageTemplateName) { + runWithServiceResponseAsync(resourceGroupName, imageTemplateName).toBlocking().last().body(); + } + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture runAsync(String resourceGroupName, String imageTemplateName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(runWithServiceResponseAsync(resourceGroupName, imageTemplateName), serviceCallback); + } + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable runAsync(String resourceGroupName, String imageTemplateName) { + return runWithServiceResponseAsync(resourceGroupName, imageTemplateName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> runWithServiceResponseAsync(String resourceGroupName, String imageTemplateName) { + 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 (imageTemplateName == null) { + throw new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.run(this.client.subscriptionId(), resourceGroupName, imageTemplateName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); + } + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginRun(String resourceGroupName, String imageTemplateName) { + beginRunWithServiceResponseAsync(resourceGroupName, imageTemplateName).toBlocking().single().body(); + } + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginRunAsync(String resourceGroupName, String imageTemplateName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRunWithServiceResponseAsync(resourceGroupName, imageTemplateName), serviceCallback); + } + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRunAsync(String resourceGroupName, String imageTemplateName) { + return beginRunWithServiceResponseAsync(resourceGroupName, imageTemplateName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRunWithServiceResponseAsync(String resourceGroupName, String imageTemplateName) { + 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 (imageTemplateName == null) { + throw new IllegalArgumentException("Parameter imageTemplateName 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.beginRun(this.client.subscriptionId(), resourceGroupName, imageTemplateName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginRunDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRunDelegate(Response response) throws ApiErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ApiErrorException.class) + .build(response); + } + + /** + * List all run outputs for the specified Image Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException 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<RunOutputInner> object if successful. + */ + public PagedList listRunOutputs(final String resourceGroupName, final String imageTemplateName) { + ServiceResponse> response = listRunOutputsSinglePageAsync(resourceGroupName, imageTemplateName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listRunOutputsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List all run outputs for the specified Image Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listRunOutputsAsync(final String resourceGroupName, final String imageTemplateName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listRunOutputsSinglePageAsync(resourceGroupName, imageTemplateName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listRunOutputsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List all run outputs for the specified Image Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RunOutputInner> object + */ + public Observable> listRunOutputsAsync(final String resourceGroupName, final String imageTemplateName) { + return listRunOutputsWithServiceResponseAsync(resourceGroupName, imageTemplateName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all run outputs for the specified Image Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RunOutputInner> object + */ + public Observable>> listRunOutputsWithServiceResponseAsync(final String resourceGroupName, final String imageTemplateName) { + return listRunOutputsSinglePageAsync(resourceGroupName, imageTemplateName) + .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(listRunOutputsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List all run outputs for the specified Image Template resource. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param imageTemplateName The name of the image Template + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RunOutputInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listRunOutputsSinglePageAsync(final String resourceGroupName, final String imageTemplateName) { + 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 (imageTemplateName == null) { + throw new IllegalArgumentException("Parameter imageTemplateName 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.listRunOutputs(this.client.subscriptionId(), resourceGroupName, imageTemplateName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listRunOutputsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listRunOutputsDelegate(Response response) throws ApiErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ApiErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ApiErrorException.class) + .build(response); + } + + /** + * Get the specified run output for the specified image template resource. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param runOutputName The name of the run output + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RunOutputInner object if successful. + */ + public RunOutputInner getRunOutput(String resourceGroupName, String imageTemplateName, String runOutputName) { + return getRunOutputWithServiceResponseAsync(resourceGroupName, imageTemplateName, runOutputName).toBlocking().single().body(); + } + + /** + * Get the specified run output for the specified image template resource. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param runOutputName The name of the run output + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getRunOutputAsync(String resourceGroupName, String imageTemplateName, String runOutputName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getRunOutputWithServiceResponseAsync(resourceGroupName, imageTemplateName, runOutputName), serviceCallback); + } + + /** + * Get the specified run output for the specified image template resource. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param runOutputName The name of the run output + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RunOutputInner object + */ + public Observable getRunOutputAsync(String resourceGroupName, String imageTemplateName, String runOutputName) { + return getRunOutputWithServiceResponseAsync(resourceGroupName, imageTemplateName, runOutputName).map(new Func1, RunOutputInner>() { + @Override + public RunOutputInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the specified run output for the specified image template resource. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template + * @param runOutputName The name of the run output + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RunOutputInner object + */ + public Observable> getRunOutputWithServiceResponseAsync(String resourceGroupName, String imageTemplateName, String runOutputName) { + 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 (imageTemplateName == null) { + throw new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null."); + } + if (runOutputName == null) { + throw new IllegalArgumentException("Parameter runOutputName 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.getRunOutput(this.client.subscriptionId(), resourceGroupName, imageTemplateName, runOutputName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getRunOutputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getRunOutputDelegate(Response response) throws ApiErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ApiErrorException.class) + .build(response); + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException 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<ImageTemplateInner> 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(); + } + }; + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ImageTemplateInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ImageTemplateInner> 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)); + } + }); + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ImageTemplateInner> 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 ApiErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ApiErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ApiErrorException.class) + .build(response); + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException 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<ImageTemplateInner> 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(); + } + }; + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ImageTemplateInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ImageTemplateInner> 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)); + } + }); + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ImageTemplateInner> 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 ApiErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ApiErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ApiErrorException.class) + .build(response); + } + + /** + * List all run outputs for the specified Image Template resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ApiErrorException 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<RunOutputInner> object if successful. + */ + public PagedList listRunOutputsNext(final String nextPageLink) { + ServiceResponse> response = listRunOutputsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listRunOutputsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List all run outputs for the specified Image Template resource. + * + * @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> listRunOutputsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listRunOutputsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listRunOutputsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List all run outputs for the specified Image Template resource. + * + * @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<RunOutputInner> object + */ + public Observable> listRunOutputsNextAsync(final String nextPageLink) { + return listRunOutputsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all run outputs for the specified Image Template resource. + * + * @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<RunOutputInner> object + */ + public Observable>> listRunOutputsNextWithServiceResponseAsync(final String nextPageLink) { + return listRunOutputsNextSinglePageAsync(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(listRunOutputsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List all run outputs for the specified Image Template resource. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RunOutputInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listRunOutputsNextSinglePageAsync(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.listRunOutputsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listRunOutputsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listRunOutputsNextDelegate(Response response) throws ApiErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ApiErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ApiErrorException.class) + .build(response); + } + +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/VirtualMachineImagesManager.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/VirtualMachineImagesManager.java new file mode 100644 index 000000000000..44ca7e4c4243 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/VirtualMachineImagesManager.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.imagebuilder.v2019_02_01_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.VirtualMachineImageTemplates; +import com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.Operations; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure VirtualMachineImages resource management. + */ +public final class VirtualMachineImagesManager extends ManagerCore { + private VirtualMachineImageTemplates virtualMachineImageTemplates; + private Operations operations; + /** + * Get a Configurable instance that can be used to create VirtualMachineImagesManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new VirtualMachineImagesManager.ConfigurableImpl(); + } + /** + * Creates an instance of VirtualMachineImagesManager that exposes VirtualMachineImages resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the VirtualMachineImagesManager + */ + public static VirtualMachineImagesManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new VirtualMachineImagesManager(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 VirtualMachineImagesManager that exposes VirtualMachineImages resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the VirtualMachineImagesManager + */ + public static VirtualMachineImagesManager authenticate(RestClient restClient, String subscriptionId) { + return new VirtualMachineImagesManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of VirtualMachineImagesManager that exposes VirtualMachineImages management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing VirtualMachineImages management API entry points that work across subscriptions + */ + VirtualMachineImagesManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage VirtualMachineImageTemplates. + */ + public VirtualMachineImageTemplates virtualMachineImageTemplates() { + if (this.virtualMachineImageTemplates == null) { + this.virtualMachineImageTemplates = new VirtualMachineImageTemplatesImpl(this); + } + return this.virtualMachineImageTemplates; + } + + /** + * @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 VirtualMachineImagesManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return VirtualMachineImagesManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private VirtualMachineImagesManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new ImageBuilderClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/package-info.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/package-info.java new file mode 100644 index 000000000000..056ea2ade995 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ImageBuilderClient. + * Azure Virtual Machine Image Builder Client. + */ +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview.implementation; diff --git a/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/package-info.java b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/package-info.java new file mode 100644 index 000000000000..353fa8f94811 --- /dev/null +++ b/sdk/imagebuilder/mgmt-v2019_02_01_preview/src/main/java/com/microsoft/azure/management/imagebuilder/v2019_02_01_preview/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ImageBuilderClient. + * Azure Virtual Machine Image Builder Client. + */ +package com.microsoft.azure.management.imagebuilder.v2019_02_01_preview;