diff --git a/resources/resource-manager/v2019_05_10/pom.xml b/resources/resource-manager/v2019_05_10/pom.xml new file mode 100644 index 0000000000000..d096dd0643cc5 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.resources.v2019_05_10 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-resources + 1.0.0-beta + jar + Microsoft Azure SDK for Resources Management + This package contains Microsoft Resources 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 + + + + + + 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/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/AliasPathType.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/AliasPathType.java new file mode 100644 index 0000000000000..1b92c11faf9a6 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/AliasPathType.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The type of the paths for alias. + */ +public class AliasPathType { + /** + * The path of an alias. + */ + @JsonProperty(value = "path") + private String path; + + /** + * The API versions. + */ + @JsonProperty(value = "apiVersions") + private List apiVersions; + + /** + * Get the path of an alias. + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set the path of an alias. + * + * @param path the path value to set + * @return the AliasPathType object itself. + */ + public AliasPathType withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the API versions. + * + * @return the apiVersions value + */ + public List apiVersions() { + return this.apiVersions; + } + + /** + * Set the API versions. + * + * @param apiVersions the apiVersions value to set + * @return the AliasPathType object itself. + */ + public AliasPathType withApiVersions(List apiVersions) { + this.apiVersions = apiVersions; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/AliasType.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/AliasType.java new file mode 100644 index 0000000000000..96051be44eea0 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/AliasType.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The alias type. + */ +public class AliasType { + /** + * The alias name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The paths for an alias. + */ + @JsonProperty(value = "paths") + private List paths; + + /** + * Get the alias name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the alias name. + * + * @param name the name value to set + * @return the AliasType object itself. + */ + public AliasType withName(String name) { + this.name = name; + return this; + } + + /** + * Get the paths for an alias. + * + * @return the paths value + */ + public List paths() { + return this.paths; + } + + /** + * Set the paths for an alias. + * + * @param paths the paths value to set + * @return the AliasType object itself. + */ + public AliasType withPaths(List paths) { + this.paths = paths; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/BasicDependency.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/BasicDependency.java new file mode 100644 index 0000000000000..a06d55bac1c10 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/BasicDependency.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.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment dependency information. + */ +public class BasicDependency { + /** + * The ID of the dependency. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The dependency resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * The dependency resource name. + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /** + * Get the ID of the dependency. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID of the dependency. + * + * @param id the id value to set + * @return the BasicDependency object itself. + */ + public BasicDependency withId(String id) { + this.id = id; + return this; + } + + /** + * Get the dependency resource type. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the dependency resource type. + * + * @param resourceType the resourceType value to set + * @return the BasicDependency object itself. + */ + public BasicDependency withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the dependency resource name. + * + * @return the resourceName value + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the dependency resource name. + * + * @param resourceName the resourceName value to set + * @return the BasicDependency object itself. + */ + public BasicDependency withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DebugSetting.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DebugSetting.java new file mode 100644 index 0000000000000..b0526522a5614 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DebugSetting.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. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The debug setting. + */ +public class DebugSetting { + /** + * Specifies the type of information to log for debugging. The permitted + * values are none, requestContent, responseContent, or both requestContent + * and responseContent separated by a comma. The default is none. When + * setting this value, carefully consider the type of information you are + * passing in during deployment. By logging information about the request + * or response, you could potentially expose sensitive data that is + * retrieved through the deployment operations. + */ + @JsonProperty(value = "detailLevel") + private String detailLevel; + + /** + * Get specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations. + * + * @return the detailLevel value + */ + public String detailLevel() { + return this.detailLevel; + } + + /** + * Set specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations. + * + * @param detailLevel the detailLevel value to set + * @return the DebugSetting object itself. + */ + public DebugSetting withDetailLevel(String detailLevel) { + this.detailLevel = detailLevel; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Dependency.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Dependency.java new file mode 100644 index 0000000000000..ce119bf89b0f1 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Dependency.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.resources.v2019_05_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment dependency information. + */ +public class Dependency { + /** + * The list of dependencies. + */ + @JsonProperty(value = "dependsOn") + private List dependsOn; + + /** + * The ID of the dependency. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The dependency resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * The dependency resource name. + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /** + * Get the list of dependencies. + * + * @return the dependsOn value + */ + public List dependsOn() { + return this.dependsOn; + } + + /** + * Set the list of dependencies. + * + * @param dependsOn the dependsOn value to set + * @return the Dependency object itself. + */ + public Dependency withDependsOn(List dependsOn) { + this.dependsOn = dependsOn; + return this; + } + + /** + * Get the ID of the dependency. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID of the dependency. + * + * @param id the id value to set + * @return the Dependency object itself. + */ + public Dependency withId(String id) { + this.id = id; + return this; + } + + /** + * Get the dependency resource type. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the dependency resource type. + * + * @param resourceType the resourceType value to set + * @return the Dependency object itself. + */ + public Dependency withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the dependency resource name. + * + * @return the resourceName value + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the dependency resource name. + * + * @param resourceName the resourceName value to set + * @return the Dependency object itself. + */ + public Dependency withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentExportResult.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentExportResult.java new file mode 100644 index 0000000000000..f2ae5246e1052 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentExportResult.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.DeploymentExportResultInner; + +/** + * Type representing DeploymentExportResult. + */ +public interface DeploymentExportResult extends HasInner, HasManager { + /** + * @return the template value. + */ + Object template(); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentExtended.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentExtended.java new file mode 100644 index 0000000000000..27675442abd27 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentExtended.java @@ -0,0 +1,132 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.DeploymentExtendedInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ResourcesManager; + +/** + * Type representing DeploymentExtended. + */ +public interface DeploymentExtended extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + DeploymentPropertiesExtended properties(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DeploymentExtended definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithMicrosoft.Resource, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * Grouping of DeploymentExtended definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DeploymentExtended definition. + */ + interface Blank extends WithMicrosoft.Resource { + } + + /** + * The stage of the deploymentextended definition allowing to specify Microsoft.Resource. + */ + interface WithMicrosoft.Resource { + /** + * Specifies groupId. + * @param groupId The management group ID + * @return the next definition stage + */ + WithProperties withExistingMicrosoft.Resource(String groupId); + } + + /** + * The stage of the deploymentextended definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties The deployment properties + * @return the next definition stage + */ + WithCreate withProperties(DeploymentProperties properties); + } + + /** + * The stage of the deploymentextended definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location to store the deployment data + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithLocation { + } + } + /** + * The template for a DeploymentExtended update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithLocation { + } + + /** + * Grouping of DeploymentExtended update stages. + */ + interface UpdateStages { + /** + * The stage of the deploymentextended update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location to store the deployment data + * @return the next update stage + */ + Update withLocation(String location); + } + + } +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentExtendedFilter.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentExtendedFilter.java new file mode 100644 index 0000000000000..a7b8abf91f833 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentExtendedFilter.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment filter. + */ +public class DeploymentExtendedFilter { + /** + * The provisioning state. + */ + @JsonProperty(value = "provisioningState") + private String provisioningState; + + /** + * Get the provisioning state. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning state. + * + * @param provisioningState the provisioningState value to set + * @return the DeploymentExtendedFilter object itself. + */ + public DeploymentExtendedFilter withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentMode.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentMode.java new file mode 100644 index 0000000000000..c5152d9332b13 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentMode.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.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DeploymentMode. + */ +public enum DeploymentMode { + /** Enum value Incremental. */ + INCREMENTAL("Incremental"), + + /** Enum value Complete. */ + COMPLETE("Complete"); + + /** The actual serialized value for a DeploymentMode instance. */ + private String value; + + DeploymentMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DeploymentMode instance. + * + * @param value the serialized value to parse. + * @return the parsed DeploymentMode object, or null if unable to parse. + */ + @JsonCreator + public static DeploymentMode fromString(String value) { + DeploymentMode[] items = DeploymentMode.values(); + for (DeploymentMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentOperation.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentOperation.java new file mode 100644 index 0000000000000..cd93540ede4c2 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentOperation.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.DeploymentOperationInner; +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.resources.v2019_05_10.implementation.ResourcesManager; + +/** + * Type representing DeploymentOperation. + */ +public interface DeploymentOperation extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the operationId value. + */ + String operationId(); + + /** + * @return the properties value. + */ + DeploymentOperationProperties properties(); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentOperationProperties.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentOperationProperties.java new file mode 100644 index 0000000000000..206c05364a06a --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentOperationProperties.java @@ -0,0 +1,153 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment operation properties. + */ +public class DeploymentOperationProperties { + /** + * The state of the provisioning. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The date and time of the operation. + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime timestamp; + + /** + * The duration of the operation. + */ + @JsonProperty(value = "duration", access = JsonProperty.Access.WRITE_ONLY) + private String duration; + + /** + * Deployment operation service request id. + */ + @JsonProperty(value = "serviceRequestId", access = JsonProperty.Access.WRITE_ONLY) + private String serviceRequestId; + + /** + * Operation status code. + */ + @JsonProperty(value = "statusCode", access = JsonProperty.Access.WRITE_ONLY) + private String statusCode; + + /** + * Operation status message. + */ + @JsonProperty(value = "statusMessage", access = JsonProperty.Access.WRITE_ONLY) + private Object statusMessage; + + /** + * The target resource. + */ + @JsonProperty(value = "targetResource", access = JsonProperty.Access.WRITE_ONLY) + private TargetResource targetResource; + + /** + * The HTTP request message. + */ + @JsonProperty(value = "request", access = JsonProperty.Access.WRITE_ONLY) + private HttpMessage request; + + /** + * The HTTP response message. + */ + @JsonProperty(value = "response", access = JsonProperty.Access.WRITE_ONLY) + private HttpMessage response; + + /** + * Get the state of the provisioning. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the date and time of the operation. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Get the duration of the operation. + * + * @return the duration value + */ + public String duration() { + return this.duration; + } + + /** + * Get deployment operation service request id. + * + * @return the serviceRequestId value + */ + public String serviceRequestId() { + return this.serviceRequestId; + } + + /** + * Get operation status code. + * + * @return the statusCode value + */ + public String statusCode() { + return this.statusCode; + } + + /** + * Get operation status message. + * + * @return the statusMessage value + */ + public Object statusMessage() { + return this.statusMessage; + } + + /** + * Get the target resource. + * + * @return the targetResource value + */ + public TargetResource targetResource() { + return this.targetResource; + } + + /** + * Get the HTTP request message. + * + * @return the request value + */ + public HttpMessage request() { + return this.request; + } + + /** + * Get the HTTP response message. + * + * @return the response value + */ + public HttpMessage response() { + return this.response; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentOperations.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentOperations.java new file mode 100644 index 0000000000000..5b2667604fb48 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentOperations.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.DeploymentOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DeploymentOperations. + */ +public interface DeploymentOperations extends HasInner { + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtSubscriptionScopeAsync(String deploymentName, String operationId); + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAtSubscriptionScopeAsync(final String deploymentName); + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String deploymentName, String operationId); + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupAsync(final String resourceGroupName, final String deploymentName); + + /** + * Gets a deployments operation. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtManagementGroupScopeAsync(String groupId, String deploymentName, String operationId); + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAtManagementGroupScopeAsync(final String groupId, final String deploymentName); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentProperties.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentProperties.java new file mode 100644 index 0000000000000..9377f6d8ee2fd --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentProperties.java @@ -0,0 +1,216 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment properties. + */ +public class DeploymentProperties { + /** + * The template content. You use this element when you want to pass the + * template syntax directly in the request rather than link to an existing + * template. It can be a JObject or well-formed JSON string. Use either the + * templateLink property or the template property, but not both. + */ + @JsonProperty(value = "template") + private Object template; + + /** + * The URI of the template. Use either the templateLink property or the + * template property, but not both. + */ + @JsonProperty(value = "templateLink") + private TemplateLink templateLink; + + /** + * Name and value pairs that define the deployment parameters for the + * template. You use this element when you want to provide the parameter + * values directly in the request rather than link to an existing parameter + * file. Use either the parametersLink property or the parameters property, + * but not both. It can be a JObject or a well formed JSON string. + */ + @JsonProperty(value = "parameters") + private Object parameters; + + /** + * The URI of parameters file. You use this element to link to an existing + * parameters file. Use either the parametersLink property or the + * parameters property, but not both. + */ + @JsonProperty(value = "parametersLink") + private ParametersLink parametersLink; + + /** + * The mode that is used to deploy resources. This value can be either + * Incremental or Complete. In Incremental mode, resources are deployed + * without deleting existing resources that are not included in the + * template. In Complete mode, resources are deployed and existing + * resources in the resource group that are not included in the template + * are deleted. Be careful when using Complete mode as you may + * unintentionally delete resources. Possible values include: + * 'Incremental', 'Complete'. + */ + @JsonProperty(value = "mode", required = true) + private DeploymentMode mode; + + /** + * The debug setting of the deployment. + */ + @JsonProperty(value = "debugSetting") + private DebugSetting debugSetting; + + /** + * The deployment on error behavior. + */ + @JsonProperty(value = "onErrorDeployment") + private OnErrorDeployment onErrorDeployment; + + /** + * Get the template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. + * + * @return the template value + */ + public Object template() { + return this.template; + } + + /** + * Set the template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. + * + * @param template the template value to set + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withTemplate(Object template) { + this.template = template; + return this; + } + + /** + * Get the URI of the template. Use either the templateLink property or the template property, but not both. + * + * @return the templateLink value + */ + public TemplateLink templateLink() { + return this.templateLink; + } + + /** + * Set the URI of the template. Use either the templateLink property or the template property, but not both. + * + * @param templateLink the templateLink value to set + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withTemplateLink(TemplateLink templateLink) { + this.templateLink = templateLink; + return this; + } + + /** + * Get name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. + * + * @param parameters the parameters value to set + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. + * + * @return the parametersLink value + */ + public ParametersLink parametersLink() { + return this.parametersLink; + } + + /** + * Set the URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. + * + * @param parametersLink the parametersLink value to set + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withParametersLink(ParametersLink parametersLink) { + this.parametersLink = parametersLink; + return this; + } + + /** + * Get the mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. Possible values include: 'Incremental', 'Complete'. + * + * @return the mode value + */ + public DeploymentMode mode() { + return this.mode; + } + + /** + * Set the mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. Possible values include: 'Incremental', 'Complete'. + * + * @param mode the mode value to set + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withMode(DeploymentMode mode) { + this.mode = mode; + return this; + } + + /** + * Get the debug setting of the deployment. + * + * @return the debugSetting value + */ + public DebugSetting debugSetting() { + return this.debugSetting; + } + + /** + * Set the debug setting of the deployment. + * + * @param debugSetting the debugSetting value to set + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withDebugSetting(DebugSetting debugSetting) { + this.debugSetting = debugSetting; + return this; + } + + /** + * Get the deployment on error behavior. + * + * @return the onErrorDeployment value + */ + public OnErrorDeployment onErrorDeployment() { + return this.onErrorDeployment; + } + + /** + * Set the deployment on error behavior. + * + * @param onErrorDeployment the onErrorDeployment value to set + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withOnErrorDeployment(OnErrorDeployment onErrorDeployment) { + this.onErrorDeployment = onErrorDeployment; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentPropertiesExtended.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentPropertiesExtended.java new file mode 100644 index 0000000000000..b3399e5e09493 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentPropertiesExtended.java @@ -0,0 +1,343 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ProviderInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment properties with additional details. + */ +public class DeploymentPropertiesExtended { + /** + * The state of the provisioning. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The correlation ID of the deployment. + */ + @JsonProperty(value = "correlationId", access = JsonProperty.Access.WRITE_ONLY) + private String correlationId; + + /** + * The timestamp of the template deployment. + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime timestamp; + + /** + * The duration of the template deployment. + */ + @JsonProperty(value = "duration", access = JsonProperty.Access.WRITE_ONLY) + private String duration; + + /** + * Key/value pairs that represent deployment output. + */ + @JsonProperty(value = "outputs") + private Object outputs; + + /** + * The list of resource providers needed for the deployment. + */ + @JsonProperty(value = "providers") + private List providers; + + /** + * The list of deployment dependencies. + */ + @JsonProperty(value = "dependencies") + private List dependencies; + + /** + * The template content. Use only one of Template or TemplateLink. + */ + @JsonProperty(value = "template") + private Object template; + + /** + * The URI referencing the template. Use only one of Template or + * TemplateLink. + */ + @JsonProperty(value = "templateLink") + private TemplateLink templateLink; + + /** + * Deployment parameters. Use only one of Parameters or ParametersLink. + */ + @JsonProperty(value = "parameters") + private Object parameters; + + /** + * The URI referencing the parameters. Use only one of Parameters or + * ParametersLink. + */ + @JsonProperty(value = "parametersLink") + private ParametersLink parametersLink; + + /** + * The deployment mode. Possible values are Incremental and Complete. + * Possible values include: 'Incremental', 'Complete'. + */ + @JsonProperty(value = "mode") + private DeploymentMode mode; + + /** + * The debug setting of the deployment. + */ + @JsonProperty(value = "debugSetting") + private DebugSetting debugSetting; + + /** + * The deployment on error behavior. + */ + @JsonProperty(value = "onErrorDeployment") + private OnErrorDeploymentExtended onErrorDeployment; + + /** + * Get the state of the provisioning. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the correlation ID of the deployment. + * + * @return the correlationId value + */ + public String correlationId() { + return this.correlationId; + } + + /** + * Get the timestamp of the template deployment. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Get the duration of the template deployment. + * + * @return the duration value + */ + public String duration() { + return this.duration; + } + + /** + * Get key/value pairs that represent deployment output. + * + * @return the outputs value + */ + public Object outputs() { + return this.outputs; + } + + /** + * Set key/value pairs that represent deployment output. + * + * @param outputs the outputs value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withOutputs(Object outputs) { + this.outputs = outputs; + return this; + } + + /** + * Get the list of resource providers needed for the deployment. + * + * @return the providers value + */ + public List providers() { + return this.providers; + } + + /** + * Set the list of resource providers needed for the deployment. + * + * @param providers the providers value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withProviders(List providers) { + this.providers = providers; + return this; + } + + /** + * Get the list of deployment dependencies. + * + * @return the dependencies value + */ + public List dependencies() { + return this.dependencies; + } + + /** + * Set the list of deployment dependencies. + * + * @param dependencies the dependencies value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withDependencies(List dependencies) { + this.dependencies = dependencies; + return this; + } + + /** + * Get the template content. Use only one of Template or TemplateLink. + * + * @return the template value + */ + public Object template() { + return this.template; + } + + /** + * Set the template content. Use only one of Template or TemplateLink. + * + * @param template the template value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withTemplate(Object template) { + this.template = template; + return this; + } + + /** + * Get the URI referencing the template. Use only one of Template or TemplateLink. + * + * @return the templateLink value + */ + public TemplateLink templateLink() { + return this.templateLink; + } + + /** + * Set the URI referencing the template. Use only one of Template or TemplateLink. + * + * @param templateLink the templateLink value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withTemplateLink(TemplateLink templateLink) { + this.templateLink = templateLink; + return this; + } + + /** + * Get deployment parameters. Use only one of Parameters or ParametersLink. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set deployment parameters. Use only one of Parameters or ParametersLink. + * + * @param parameters the parameters value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the URI referencing the parameters. Use only one of Parameters or ParametersLink. + * + * @return the parametersLink value + */ + public ParametersLink parametersLink() { + return this.parametersLink; + } + + /** + * Set the URI referencing the parameters. Use only one of Parameters or ParametersLink. + * + * @param parametersLink the parametersLink value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withParametersLink(ParametersLink parametersLink) { + this.parametersLink = parametersLink; + return this; + } + + /** + * Get the deployment mode. Possible values are Incremental and Complete. Possible values include: 'Incremental', 'Complete'. + * + * @return the mode value + */ + public DeploymentMode mode() { + return this.mode; + } + + /** + * Set the deployment mode. Possible values are Incremental and Complete. Possible values include: 'Incremental', 'Complete'. + * + * @param mode the mode value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withMode(DeploymentMode mode) { + this.mode = mode; + return this; + } + + /** + * Get the debug setting of the deployment. + * + * @return the debugSetting value + */ + public DebugSetting debugSetting() { + return this.debugSetting; + } + + /** + * Set the debug setting of the deployment. + * + * @param debugSetting the debugSetting value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withDebugSetting(DebugSetting debugSetting) { + this.debugSetting = debugSetting; + return this; + } + + /** + * Get the deployment on error behavior. + * + * @return the onErrorDeployment value + */ + public OnErrorDeploymentExtended onErrorDeployment() { + return this.onErrorDeployment; + } + + /** + * Set the deployment on error behavior. + * + * @param onErrorDeployment the onErrorDeployment value to set + * @return the DeploymentPropertiesExtended object itself. + */ + public DeploymentPropertiesExtended withOnErrorDeployment(OnErrorDeploymentExtended onErrorDeployment) { + this.onErrorDeployment = onErrorDeployment; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentValidateResult.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentValidateResult.java new file mode 100644 index 0000000000000..15dcdcdf369e9 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/DeploymentValidateResult.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.DeploymentValidateResultInner; + +/** + * Type representing DeploymentValidateResult. + */ +public interface DeploymentValidateResult extends HasInner, HasManager { + /** + * @return the error value. + */ + ResourceManagementErrorWithDetails error(); + + /** + * @return the properties value. + */ + DeploymentPropertiesExtended properties(); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Deployments.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Deployments.java new file mode 100644 index 0000000000000..1cef4a8efb30b --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Deployments.java @@ -0,0 +1,254 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.DeploymentInner; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.DeploymentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Deployments. + */ +public interface Deployments extends SupportsCreating, HasInner { + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAtManagementGroupScopeAsync(String groupId, String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkExistenceAtManagementGroupScopeAsync(String groupId, String deploymentName); + + /** + * Gets a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtManagementGroupScopeAsync(String groupId, String deploymentName); + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAtManagementGroupScopeAsync(String groupId, String deploymentName); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateAtManagementGroupScopeAsync(String groupId, String deploymentName, DeploymentInner parameters); + + /** + * Exports the template used for specified deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportTemplateAtManagementGroupScopeAsync(String groupId, String deploymentName); + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAtManagementGroupScopeAsync(final String groupId); + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAtSubscriptionScopeAsync(String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkExistenceAtSubscriptionScopeAsync(String deploymentName); + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters); + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtSubscriptionScopeAsync(String deploymentName); + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAtSubscriptionScopeAsync(String deploymentName); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters); + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportTemplateAtSubscriptionScopeAsync(String deploymentName); + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String deploymentName); + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkExistenceAsync(String resourceGroupName, String deploymentName); + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters); + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByResourceGroupAsync(String resourceGroupName, String deploymentName); + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAsync(String resourceGroupName, String deploymentName); + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters); + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportTemplateAsync(String resourceGroupName, String deploymentName); + + /** + * Get all the deployments for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupAsync(final String resourceGroupName); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ExportTemplateRequest.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ExportTemplateRequest.java new file mode 100644 index 0000000000000..a693a6d4c7213 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ExportTemplateRequest.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.resources.v2019_05_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Export resource group template request parameters. + */ +public class ExportTemplateRequest { + /** + * The IDs of the resources to filter the export by. To export all + * resources, supply an array with single entry '*'. + */ + @JsonProperty(value = "resources") + private List resources; + + /** + * The export template options. A CSV-formatted list containing zero or + * more of the following: 'IncludeParameterDefaultValue', + * 'IncludeComments', 'SkipResourceNameParameterization', + * 'SkipAllParameterization'. + */ + @JsonProperty(value = "options") + private String options; + + /** + * Get the IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. + * + * @return the resources value + */ + public List resources() { + return this.resources; + } + + /** + * Set the IDs of the resources to filter the export by. To export all resources, supply an array with single entry '*'. + * + * @param resources the resources value to set + * @return the ExportTemplateRequest object itself. + */ + public ExportTemplateRequest withResources(List resources) { + this.resources = resources; + return this; + } + + /** + * Get the export template options. A CSV-formatted list containing zero or more of the following: 'IncludeParameterDefaultValue', 'IncludeComments', 'SkipResourceNameParameterization', 'SkipAllParameterization'. + * + * @return the options value + */ + public String options() { + return this.options; + } + + /** + * Set the export template options. A CSV-formatted list containing zero or more of the following: 'IncludeParameterDefaultValue', 'IncludeComments', 'SkipResourceNameParameterization', 'SkipAllParameterization'. + * + * @param options the options value to set + * @return the ExportTemplateRequest object itself. + */ + public ExportTemplateRequest withOptions(String options) { + this.options = options; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/GenericResource.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/GenericResource.java new file mode 100644 index 0000000000000..fcbed6a326747 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/GenericResource.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.GenericResourceInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ResourcesManager; +import java.util.Map; + +/** + * Type representing GenericResource. + */ +public interface GenericResource extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the identity value. + */ + Identity identity(); + + /** + * @return the kind value. + */ + String kind(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the managedBy value. + */ + String managedBy(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the plan value. + */ + Plan plan(); + + /** + * @return the properties value. + */ + Object properties(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/GenericResourceFilter.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/GenericResourceFilter.java new file mode 100644 index 0000000000000..32a43d2fdca21 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/GenericResourceFilter.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.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource filter. + */ +public class GenericResourceFilter { + /** + * The resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * The tag name. + */ + @JsonProperty(value = "tagname") + private String tagname; + + /** + * The tag value. + */ + @JsonProperty(value = "tagvalue") + private String tagvalue; + + /** + * Get the resource type. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resource type. + * + * @param resourceType the resourceType value to set + * @return the GenericResourceFilter object itself. + */ + public GenericResourceFilter withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the tag name. + * + * @return the tagname value + */ + public String tagname() { + return this.tagname; + } + + /** + * Set the tag name. + * + * @param tagname the tagname value to set + * @return the GenericResourceFilter object itself. + */ + public GenericResourceFilter withTagname(String tagname) { + this.tagname = tagname; + return this; + } + + /** + * Get the tag value. + * + * @return the tagvalue value + */ + public String tagvalue() { + return this.tagvalue; + } + + /** + * Set the tag value. + * + * @param tagvalue the tagvalue value to set + * @return the GenericResourceFilter object itself. + */ + public GenericResourceFilter withTagvalue(String tagvalue) { + this.tagvalue = tagvalue; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/HttpMessage.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/HttpMessage.java new file mode 100644 index 0000000000000..f11dfa5de7032 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/HttpMessage.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * HTTP message. + */ +public class HttpMessage { + /** + * HTTP message content. + */ + @JsonProperty(value = "content") + private Object content; + + /** + * Get hTTP message content. + * + * @return the content value + */ + public Object content() { + return this.content; + } + + /** + * Set hTTP message content. + * + * @param content the content value to set + * @return the HttpMessage object itself. + */ + public HttpMessage withContent(Object content) { + this.content = content; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Identity.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Identity.java new file mode 100644 index 0000000000000..19df808a35890 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Identity.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.resources.v2019_05_10; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity for the resource. + */ +public class Identity { + /** + * The principal ID of resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The tenant ID of resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The identity type. Possible values include: 'SystemAssigned', + * 'UserAssigned', 'SystemAssigned, UserAssigned', 'None'. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /** + * The list of user identities associated with the resource. The user + * identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + private Map userAssignedIdentities; + + /** + * Get the principal ID of resource identity. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenant ID of resource. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the identity type. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', 'None'. + * + * @return the type value + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the identity type. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', 'None'. + * + * @param type the type value to set + * @return the Identity object itself. + */ + public Identity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @return the userAssignedIdentities value + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @param userAssignedIdentities the userAssignedIdentities value to set + * @return the Identity object itself. + */ + public Identity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/IdentityUserAssignedIdentitiesValue.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/IdentityUserAssignedIdentitiesValue.java new file mode 100644 index 0000000000000..9b57b9c4a79f8 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/IdentityUserAssignedIdentitiesValue.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.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The IdentityUserAssignedIdentitiesValue model. + */ +public class IdentityUserAssignedIdentitiesValue { + /** + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The client id of user assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Get the principal id of user assigned identity. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the client id of user assigned identity. + * + * @return the clientId value + */ + public String clientId() { + return this.clientId; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/OnErrorDeployment.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/OnErrorDeployment.java new file mode 100644 index 0000000000000..718a3ac644c5f --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/OnErrorDeployment.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment on error behavior. + */ +public class OnErrorDeployment { + /** + * The deployment on error behavior type. Possible values are + * LastSuccessful and SpecificDeployment. Possible values include: + * 'LastSuccessful', 'SpecificDeployment'. + */ + @JsonProperty(value = "type") + private OnErrorDeploymentType type; + + /** + * The deployment to be used on error case. + */ + @JsonProperty(value = "deploymentName") + private String deploymentName; + + /** + * Get the deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Possible values include: 'LastSuccessful', 'SpecificDeployment'. + * + * @return the type value + */ + public OnErrorDeploymentType type() { + return this.type; + } + + /** + * Set the deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Possible values include: 'LastSuccessful', 'SpecificDeployment'. + * + * @param type the type value to set + * @return the OnErrorDeployment object itself. + */ + public OnErrorDeployment withType(OnErrorDeploymentType type) { + this.type = type; + return this; + } + + /** + * Get the deployment to be used on error case. + * + * @return the deploymentName value + */ + public String deploymentName() { + return this.deploymentName; + } + + /** + * Set the deployment to be used on error case. + * + * @param deploymentName the deploymentName value to set + * @return the OnErrorDeployment object itself. + */ + public OnErrorDeployment withDeploymentName(String deploymentName) { + this.deploymentName = deploymentName; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/OnErrorDeploymentExtended.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/OnErrorDeploymentExtended.java new file mode 100644 index 0000000000000..06ac855f9f82d --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/OnErrorDeploymentExtended.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment on error behavior with additional details. + */ +public class OnErrorDeploymentExtended { + /** + * The state of the provisioning for the on error deployment. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The deployment on error behavior type. Possible values are + * LastSuccessful and SpecificDeployment. Possible values include: + * 'LastSuccessful', 'SpecificDeployment'. + */ + @JsonProperty(value = "type") + private OnErrorDeploymentType type; + + /** + * The deployment to be used on error case. + */ + @JsonProperty(value = "deploymentName") + private String deploymentName; + + /** + * Get the state of the provisioning for the on error deployment. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Possible values include: 'LastSuccessful', 'SpecificDeployment'. + * + * @return the type value + */ + public OnErrorDeploymentType type() { + return this.type; + } + + /** + * Set the deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. Possible values include: 'LastSuccessful', 'SpecificDeployment'. + * + * @param type the type value to set + * @return the OnErrorDeploymentExtended object itself. + */ + public OnErrorDeploymentExtended withType(OnErrorDeploymentType type) { + this.type = type; + return this; + } + + /** + * Get the deployment to be used on error case. + * + * @return the deploymentName value + */ + public String deploymentName() { + return this.deploymentName; + } + + /** + * Set the deployment to be used on error case. + * + * @param deploymentName the deploymentName value to set + * @return the OnErrorDeploymentExtended object itself. + */ + public OnErrorDeploymentExtended withDeploymentName(String deploymentName) { + this.deploymentName = deploymentName; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/OnErrorDeploymentType.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/OnErrorDeploymentType.java new file mode 100644 index 0000000000000..da74f28c22364 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/OnErrorDeploymentType.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.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for OnErrorDeploymentType. + */ +public enum OnErrorDeploymentType { + /** Enum value LastSuccessful. */ + LAST_SUCCESSFUL("LastSuccessful"), + + /** Enum value SpecificDeployment. */ + SPECIFIC_DEPLOYMENT("SpecificDeployment"); + + /** The actual serialized value for a OnErrorDeploymentType instance. */ + private String value; + + OnErrorDeploymentType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OnErrorDeploymentType instance. + * + * @param value the serialized value to parse. + * @return the parsed OnErrorDeploymentType object, or null if unable to parse. + */ + @JsonCreator + public static OnErrorDeploymentType fromString(String value) { + OnErrorDeploymentType[] items = OnErrorDeploymentType.values(); + for (OnErrorDeploymentType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Operation.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Operation.java new file mode 100644 index 0000000000000..5af92511ed76e --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/OperationDisplay.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/OperationDisplay.java new file mode 100644 index 0000000000000..2c54c2aad1292 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/OperationDisplay.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Resources. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get service provider: Microsoft.Resources. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft.Resources. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed: Profile, endpoint, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: Read, write, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the operation. + * + * @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/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Operations.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Operations.java new file mode 100644 index 0000000000000..9ff1d247a0631 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/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.resources.v2019_05_10; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ParametersLink.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ParametersLink.java new file mode 100644 index 0000000000000..d1a82ebdfcfdf --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ParametersLink.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.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Entity representing the reference to the deployment parameters. + */ +public class ParametersLink { + /** + * The URI of the parameters file. + */ + @JsonProperty(value = "uri", required = true) + private String uri; + + /** + * If included, must match the ContentVersion in the template. + */ + @JsonProperty(value = "contentVersion") + private String contentVersion; + + /** + * Get the URI of the parameters file. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Set the URI of the parameters file. + * + * @param uri the uri value to set + * @return the ParametersLink object itself. + */ + public ParametersLink withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get if included, must match the ContentVersion in the template. + * + * @return the contentVersion value + */ + public String contentVersion() { + return this.contentVersion; + } + + /** + * Set if included, must match the ContentVersion in the template. + * + * @param contentVersion the contentVersion value to set + * @return the ParametersLink object itself. + */ + public ParametersLink withContentVersion(String contentVersion) { + this.contentVersion = contentVersion; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Plan.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Plan.java new file mode 100644 index 0000000000000..2f9f6055dfc39 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Plan.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.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Plan for the resource. + */ +public class Plan { + /** + * The plan ID. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The publisher ID. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /** + * The offer ID. + */ + @JsonProperty(value = "product") + private String product; + + /** + * The promotion code. + */ + @JsonProperty(value = "promotionCode") + private String promotionCode; + + /** + * The plan's version. + */ + @JsonProperty(value = "version") + private String version; + + /** + * Get the plan ID. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the plan ID. + * + * @param name the name value to set + * @return the Plan object itself. + */ + public Plan withName(String name) { + this.name = name; + return this; + } + + /** + * Get the publisher ID. + * + * @return the publisher value + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher ID. + * + * @param publisher the publisher value to set + * @return the Plan object itself. + */ + public Plan withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the offer ID. + * + * @return the product value + */ + public String product() { + return this.product; + } + + /** + * Set the offer ID. + * + * @param product the product value to set + * @return the Plan object itself. + */ + public Plan withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the promotion code. + * + * @return the promotionCode value + */ + public String promotionCode() { + return this.promotionCode; + } + + /** + * Set the promotion code. + * + * @param promotionCode the promotionCode value to set + * @return the Plan object itself. + */ + public Plan withPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** + * Get the plan's version. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set the plan's version. + * + * @param version the version value to set + * @return the Plan object itself. + */ + public Plan withVersion(String version) { + this.version = version; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Provider.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Provider.java new file mode 100644 index 0000000000000..07d6fd68da649 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Provider.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ProviderInner; +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.resources.v2019_05_10.implementation.ResourcesManager; +import java.util.List; + +/** + * Type representing Provider. + */ +public interface Provider extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the namespace value. + */ + String namespace(); + + /** + * @return the registrationPolicy value. + */ + String registrationPolicy(); + + /** + * @return the registrationState value. + */ + String registrationState(); + + /** + * @return the resourceTypes value. + */ + List resourceTypes(); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ProviderResourceType.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ProviderResourceType.java new file mode 100644 index 0000000000000..37d9280f077a3 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ProviderResourceType.java @@ -0,0 +1,175 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource type managed by the resource provider. + */ +public class ProviderResourceType { + /** + * The resource type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * The collection of locations where this resource type can be created. + */ + @JsonProperty(value = "locations") + private List locations; + + /** + * The aliases that are supported by this resource type. + */ + @JsonProperty(value = "aliases") + private List aliases; + + /** + * The API version. + */ + @JsonProperty(value = "apiVersions") + private List apiVersions; + + /** + * The additional capabilities offered by this resource type. + */ + @JsonProperty(value = "capabilities") + private String capabilities; + + /** + * The properties. + */ + @JsonProperty(value = "properties") + private Map properties; + + /** + * Get the resource type. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resource type. + * + * @param resourceType the resourceType value to set + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the collection of locations where this resource type can be created. + * + * @return the locations value + */ + public List locations() { + return this.locations; + } + + /** + * Set the collection of locations where this resource type can be created. + * + * @param locations the locations value to set + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the aliases that are supported by this resource type. + * + * @return the aliases value + */ + public List aliases() { + return this.aliases; + } + + /** + * Set the aliases that are supported by this resource type. + * + * @param aliases the aliases value to set + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withAliases(List aliases) { + this.aliases = aliases; + return this; + } + + /** + * Get the API version. + * + * @return the apiVersions value + */ + public List apiVersions() { + return this.apiVersions; + } + + /** + * Set the API version. + * + * @param apiVersions the apiVersions value to set + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withApiVersions(List apiVersions) { + this.apiVersions = apiVersions; + return this; + } + + /** + * Get the additional capabilities offered by this resource type. + * + * @return the capabilities value + */ + public String capabilities() { + return this.capabilities; + } + + /** + * Set the additional capabilities offered by this resource type. + * + * @param capabilities the capabilities value to set + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withCapabilities(String capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Get the properties. + * + * @return the properties value + */ + public Map properties() { + return this.properties; + } + + /** + * Set the properties. + * + * @param properties the properties value to set + * @return the ProviderResourceType object itself. + */ + public ProviderResourceType withProperties(Map properties) { + this.properties = properties; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Providers.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Providers.java new file mode 100644 index 0000000000000..ef4ba80c3d231 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Providers.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ProvidersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Providers. + */ +public interface Providers extends HasInner { + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable unregisterAsync(String resourceProviderNamespace); + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable registerAsync(String resourceProviderNamespace); + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtTenantScopeAsync(String resourceProviderNamespace); + + /** + * Gets all resource providers for the tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAtTenantScopeAsync(); + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceProviderNamespace); + + /** + * Gets all resource providers for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroup.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroup.java new file mode 100644 index 0000000000000..18bb4cb2ac5b3 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroup.java @@ -0,0 +1,203 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ResourceGroupInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ResourcesManager; +import java.util.Map; + +/** + * Type representing ResourceGroup. + */ +public interface ResourceGroup extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the managedBy value. + */ + String managedBy(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + ResourceGroupProperties properties(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ResourceGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithSubscription, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of ResourceGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ResourceGroup definition. + */ + interface Blank extends WithSubscription { + } + + /** + * The stage of the resourcegroup definition allowing to specify Subscription. + */ + interface WithSubscription { + /** + * Specifies . + * @return the next definition stage + */ + WithLocation withExistingSubscription(); + } + + /** + * The stage of the resourcegroup definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the resourcegroup definition allowing to specify ManagedBy. + */ + interface WithManagedBy { + /** + * Specifies managedBy. + * @param managedBy The ID of the resource that manages this resource group + * @return the next definition stage + */ + WithCreate withManagedBy(String managedBy); + } + + /** + * The stage of the resourcegroup definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties The resource group properties + * @return the next definition stage + */ + WithCreate withProperties(ResourceGroupProperties properties); + } + + /** + * The stage of the resourcegroup definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithManagedBy, DefinitionStages.WithProperties, DefinitionStages.WithTags { + } + } + /** + * The template for a ResourceGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithManagedBy, UpdateStages.WithName, UpdateStages.WithProperties, UpdateStages.WithTags { + } + + /** + * Grouping of ResourceGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the resourcegroup update allowing to specify ManagedBy. + */ + interface WithManagedBy { + /** + * Specifies managedBy. + * @param managedBy The ID of the resource that manages this resource group + * @return the next update stage + */ + Update withManagedBy(String managedBy); + } + + /** + * The stage of the resourcegroup update allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name The name of the resource group + * @return the next update stage + */ + Update withName(String name); + } + + /** + * The stage of the resourcegroup update allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties The resource group properties + * @return the next update stage + */ + Update withProperties(ResourceGroupProperties properties); + } + + /** + * The stage of the resourcegroup update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags attached to the resource group + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroupExportResult.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroupExportResult.java new file mode 100644 index 0000000000000..121e35bc65618 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroupExportResult.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ResourceGroupExportResultInner; + +/** + * Type representing ResourceGroupExportResult. + */ +public interface ResourceGroupExportResult extends HasInner, HasManager { + /** + * @return the error value. + */ + ResourceManagementErrorWithDetails error(); + + /** + * @return the template value. + */ + Object template(); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroupFilter.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroupFilter.java new file mode 100644 index 0000000000000..75f8e82021d2e --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroupFilter.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.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource group filter. + */ +public class ResourceGroupFilter { + /** + * The tag name. + */ + @JsonProperty(value = "tagName") + private String tagName; + + /** + * The tag value. + */ + @JsonProperty(value = "tagValue") + private String tagValue; + + /** + * Get the tag name. + * + * @return the tagName value + */ + public String tagName() { + return this.tagName; + } + + /** + * Set the tag name. + * + * @param tagName the tagName value to set + * @return the ResourceGroupFilter object itself. + */ + public ResourceGroupFilter withTagName(String tagName) { + this.tagName = tagName; + return this; + } + + /** + * Get the tag value. + * + * @return the tagValue value + */ + public String tagValue() { + return this.tagValue; + } + + /** + * Set the tag value. + * + * @param tagValue the tagValue value to set + * @return the ResourceGroupFilter object itself. + */ + public ResourceGroupFilter withTagValue(String tagValue) { + this.tagValue = tagValue; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroupPatchable.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroupPatchable.java new file mode 100644 index 0000000000000..d37f0fa882f6f --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroupPatchable.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.resources.v2019_05_10; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource group information. + */ +public class ResourceGroupPatchable { + /** + * The name of the resource group. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The resource group properties. + */ + @JsonProperty(value = "properties") + private ResourceGroupProperties properties; + + /** + * The ID of the resource that manages this resource group. + */ + @JsonProperty(value = "managedBy") + private String managedBy; + + /** + * The tags attached to the resource group. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the name of the resource group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the resource group. + * + * @param name the name value to set + * @return the ResourceGroupPatchable object itself. + */ + public ResourceGroupPatchable withName(String name) { + this.name = name; + return this; + } + + /** + * Get the resource group properties. + * + * @return the properties value + */ + public ResourceGroupProperties properties() { + return this.properties; + } + + /** + * Set the resource group properties. + * + * @param properties the properties value to set + * @return the ResourceGroupPatchable object itself. + */ + public ResourceGroupPatchable withProperties(ResourceGroupProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the ID of the resource that manages this resource group. + * + * @return the managedBy value + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Set the ID of the resource that manages this resource group. + * + * @param managedBy the managedBy value to set + * @return the ResourceGroupPatchable object itself. + */ + public ResourceGroupPatchable withManagedBy(String managedBy) { + this.managedBy = managedBy; + return this; + } + + /** + * Get the tags attached to the resource group. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags attached to the resource group. + * + * @param tags the tags value to set + * @return the ResourceGroupPatchable object itself. + */ + public ResourceGroupPatchable withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroupProperties.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroupProperties.java new file mode 100644 index 0000000000000..db0351e7d84f5 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroupProperties.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource group properties. + */ +public class ResourceGroupProperties { + /** + * The provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the provisioning state. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroups.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroups.java new file mode 100644 index 0000000000000..665852fa9e7da --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceGroups.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ResourceGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ResourceGroups. + */ +public interface ResourceGroups extends SupportsCreating, HasInner { + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkExistenceAsync(String resourceGroupName); + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group to export as a template. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable exportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters); + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName); + + /** + * Gets all the resource groups for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceIdentityType.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceIdentityType.java new file mode 100644 index 0000000000000..8e2d3999785e4 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceIdentityType.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ResourceIdentityType. + */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"), + + /** Enum value SystemAssigned, UserAssigned. */ + SYSTEM_ASSIGNED_USER_ASSIGNED("SystemAssigned, UserAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceManagementErrorWithDetails.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceManagementErrorWithDetails.java new file mode 100644 index 0000000000000..3ece195ee8285 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceManagementErrorWithDetails.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The detailed error message of resource management. + */ +public class ResourceManagementErrorWithDetails { + /** + * The error code returned when exporting the template. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * The error message describing the export error. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The target of the error. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /** + * Validation error. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private List details; + + /** + * Get the error code returned when exporting the template. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the error message describing the export error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the target of the error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Get validation error. + * + * @return the details value + */ + public List details() { + return this.details; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceProviderOperationDisplayProperties.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceProviderOperationDisplayProperties.java new file mode 100644 index 0000000000000..75d7541c61e69 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourceProviderOperationDisplayProperties.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.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource provider operation's display properties. + */ +public class ResourceProviderOperationDisplayProperties { + /** + * Operation description. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /** + * Operation provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Operation resource. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Resource provider operation. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Operation description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get operation description. + * + * @return the publisher value + */ + public String publisher() { + return this.publisher; + } + + /** + * Set operation description. + * + * @param publisher the publisher value to set + * @return the ResourceProviderOperationDisplayProperties object itself. + */ + public ResourceProviderOperationDisplayProperties withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get operation provider. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set operation provider. + * + * @param provider the provider value to set + * @return the ResourceProviderOperationDisplayProperties object itself. + */ + public ResourceProviderOperationDisplayProperties withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get operation resource. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set operation resource. + * + * @param resource the resource value to set + * @return the ResourceProviderOperationDisplayProperties object itself. + */ + public ResourceProviderOperationDisplayProperties withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get resource provider operation. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set resource provider operation. + * + * @param operation the operation value to set + * @return the ResourceProviderOperationDisplayProperties object itself. + */ + public ResourceProviderOperationDisplayProperties withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get operation description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set operation description. + * + * @param description the description value to set + * @return the ResourceProviderOperationDisplayProperties object itself. + */ + public ResourceProviderOperationDisplayProperties withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Resources.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Resources.java new file mode 100644 index 0000000000000..8f35dbf30d58d --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Resources.java @@ -0,0 +1,184 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.GenericResourceInner; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ResourcesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Resources. + */ +public interface Resources extends HasInner { + /** + * Get all the resources in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkExistenceByIdAsync(String resourceId, String apiVersion); + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteByIdAsync(String resourceId, String apiVersion); + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters); + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters); + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByIdAsync(String resourceId, String apiVersion); + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupAsync(final String resourceGroupName); + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable moveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters); + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable validateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters); + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion); + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion); + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters); + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters); + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourcesMoveInfo.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourcesMoveInfo.java new file mode 100644 index 0000000000000..11f7a8921555d --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/ResourcesMoveInfo.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters of move resources. + */ +public class ResourcesMoveInfo { + /** + * The IDs of the resources. + */ + @JsonProperty(value = "resources") + private List resources; + + /** + * The target resource group. + */ + @JsonProperty(value = "targetResourceGroup") + private String targetResourceGroup; + + /** + * Get the IDs of the resources. + * + * @return the resources value + */ + public List resources() { + return this.resources; + } + + /** + * Set the IDs of the resources. + * + * @param resources the resources value to set + * @return the ResourcesMoveInfo object itself. + */ + public ResourcesMoveInfo withResources(List resources) { + this.resources = resources; + return this; + } + + /** + * Get the target resource group. + * + * @return the targetResourceGroup value + */ + public String targetResourceGroup() { + return this.targetResourceGroup; + } + + /** + * Set the target resource group. + * + * @param targetResourceGroup the targetResourceGroup value to set + * @return the ResourcesMoveInfo object itself. + */ + public ResourcesMoveInfo withTargetResourceGroup(String targetResourceGroup) { + this.targetResourceGroup = targetResourceGroup; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Sku.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Sku.java new file mode 100644 index 0000000000000..eb58ef6b52168 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Sku.java @@ -0,0 +1,173 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SKU for the resource. + */ +public class Sku { + /** + * The SKU name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The SKU tier. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * The SKU size. + */ + @JsonProperty(value = "size") + private String size; + + /** + * The SKU family. + */ + @JsonProperty(value = "family") + private String family; + + /** + * The SKU model. + */ + @JsonProperty(value = "model") + private String model; + + /** + * The SKU capacity. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the SKU name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the SKU name. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the SKU tier. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set the SKU tier. + * + * @param tier the tier value to set + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the SKU size. + * + * @return the size value + */ + public String size() { + return this.size; + } + + /** + * Set the SKU size. + * + * @param size the size value to set + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the SKU family. + * + * @return the family value + */ + public String family() { + return this.family; + } + + /** + * Set the SKU family. + * + * @param family the family value to set + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the SKU model. + * + * @return the model value + */ + public String model() { + return this.model; + } + + /** + * Set the SKU model. + * + * @param model the model value to set + * @return the Sku object itself. + */ + public Sku withModel(String model) { + this.model = model; + return this; + } + + /** + * Get the SKU capacity. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the SKU capacity. + * + * @param capacity the capacity value to set + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TagCount.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TagCount.java new file mode 100644 index 0000000000000..81eb277962048 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TagCount.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.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Tag count. + */ +public class TagCount { + /** + * Type of count. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Value of count. + */ + @JsonProperty(value = "value") + private Integer value; + + /** + * Get type of count. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set type of count. + * + * @param type the type value to set + * @return the TagCount object itself. + */ + public TagCount withType(String type) { + this.type = type; + return this; + } + + /** + * Get value of count. + * + * @return the value value + */ + public Integer value() { + return this.value; + } + + /** + * Set value of count. + * + * @param value the value value to set + * @return the TagCount object itself. + */ + public TagCount withValue(Integer value) { + this.value = value; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TagDetails.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TagDetails.java new file mode 100644 index 0000000000000..75f4fcd141f31 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TagDetails.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.TagDetailsInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ResourcesManager; +import java.util.List; + +/** + * Type representing TagDetails. + */ +public interface TagDetails extends HasInner, HasManager { + /** + * @return the count value. + */ + TagCount count(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the tagName value. + */ + String tagName(); + + /** + * @return the values value. + */ + List values(); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TagValue.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TagValue.java new file mode 100644 index 0000000000000..b8f8ef0a0b075 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TagValue.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_05_10.implementation.TagValueInner; + +/** + * Type representing TagValue. + */ +public interface TagValue extends HasInner, HasManager { + /** + * @return the count value. + */ + TagCount count(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the tagValue value. + */ + String tagValue(); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Tags.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Tags.java new file mode 100644 index 0000000000000..0ed35a48adddc --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/Tags.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_05_10.TagDetails; +import rx.Completable; + +/** + * Type representing Tags. + */ +public interface Tags { + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String tagName); + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String tagName); + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteValueAsync(String tagName, String tagValue); + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateValueAsync(String tagName, String tagValue); + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TargetResource.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TargetResource.java new file mode 100644 index 0000000000000..a3c631871a308 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TargetResource.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.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Target resource. + */ +public class TargetResource { + /** + * The ID of the resource. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The name of the resource. + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /** + * The type of the resource. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * Get the ID of the resource. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID of the resource. + * + * @param id the id value to set + * @return the TargetResource object itself. + */ + public TargetResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name of the resource. + * + * @return the resourceName value + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the name of the resource. + * + * @param resourceName the resourceName value to set + * @return the TargetResource object itself. + */ + public TargetResource withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * Get the type of the resource. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the type of the resource. + * + * @param resourceType the resourceType value to set + * @return the TargetResource object itself. + */ + public TargetResource withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TemplateLink.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TemplateLink.java new file mode 100644 index 0000000000000..fc139bee67327 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/TemplateLink.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.resources.v2019_05_10; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Entity representing the reference to the template. + */ +public class TemplateLink { + /** + * The URI of the template to deploy. + */ + @JsonProperty(value = "uri", required = true) + private String uri; + + /** + * If included, must match the ContentVersion in the template. + */ + @JsonProperty(value = "contentVersion") + private String contentVersion; + + /** + * Get the URI of the template to deploy. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Set the URI of the template to deploy. + * + * @param uri the uri value to set + * @return the TemplateLink object itself. + */ + public TemplateLink withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get if included, must match the ContentVersion in the template. + * + * @return the contentVersion value + */ + public String contentVersion() { + return this.contentVersion; + } + + /** + * Set if included, must match the ContentVersion in the template. + * + * @param contentVersion the contentVersion value to set + * @return the TemplateLink object itself. + */ + public TemplateLink withContentVersion(String contentVersion) { + this.contentVersion = contentVersion; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentExportResultImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentExportResultImpl.java new file mode 100644 index 0000000000000..0764a8a2a9f45 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentExportResultImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentExportResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class DeploymentExportResultImpl extends WrapperImpl implements DeploymentExportResult { + private final ResourcesManager manager; + DeploymentExportResultImpl(DeploymentExportResultInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Object template() { + return this.inner().template(); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentExportResultInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentExportResultInner.java new file mode 100644 index 0000000000000..eea5f9d225c03 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentExportResultInner.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The deployment export result. + */ +public class DeploymentExportResultInner { + /** + * The template content. + */ + @JsonProperty(value = "template") + private Object template; + + /** + * Get the template content. + * + * @return the template value + */ + public Object template() { + return this.template; + } + + /** + * Set the template content. + * + * @param template the template value to set + * @return the DeploymentExportResultInner object itself. + */ + public DeploymentExportResultInner withTemplate(Object template) { + this.template = template; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentExtendedImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentExtendedImpl.java new file mode 100644 index 0000000000000..12474ac90fc69 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentExtendedImpl.java @@ -0,0 +1,136 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentExtended; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentProperties; +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentPropertiesExtended; +import rx.functions.Func1; + +class DeploymentExtendedImpl extends CreatableUpdatableImpl implements DeploymentExtended, DeploymentExtended.Definition, DeploymentExtended.Update { + private final ResourcesManager manager; + private String groupId; + private String deploymentName; + private DeploymentInner createOrUpdateParameter; + + DeploymentExtendedImpl(String name, ResourcesManager manager) { + super(name, new DeploymentExtendedInner()); + this.manager = manager; + // Set resource name + this.deploymentName = name; + // + this.createOrUpdateParameter = new DeploymentInner(); + } + + DeploymentExtendedImpl(DeploymentExtendedInner inner, ResourcesManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.deploymentName = inner.name(); + // set resource ancestor and positional variables + this.groupId = IdParsingUtils.getValueFromIdByName(inner.id(), "managementGroups"); + this.deploymentName = IdParsingUtils.getValueFromIdByName(inner.id(), "deployments"); + // + this.createOrUpdateParameter = new DeploymentInner(); + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DeploymentsInner client = this.manager().inner().deployments(); + return client.createOrUpdateAtManagementGroupScopeAsync(this.groupId, this.deploymentName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public DeploymentExtendedInner call(DeploymentExtendedInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DeploymentsInner client = this.manager().inner().deployments(); + return client.createOrUpdateAtManagementGroupScopeAsync(this.groupId, this.deploymentName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public DeploymentExtendedInner call(DeploymentExtendedInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DeploymentsInner client = this.manager().inner().deployments(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new DeploymentInner(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DeploymentPropertiesExtended properties() { + return this.inner().properties(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DeploymentExtendedImpl withExistingMicrosoft.Resource(String groupId) { + this.groupId = groupId; + return this; + } + + @Override + public DeploymentExtendedImpl withProperties(DeploymentProperties properties) { + this.createOrUpdateParameter.withProperties(properties); + return this; + } + + @Override + public DeploymentExtendedImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentExtendedInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentExtendedInner.java new file mode 100644 index 0000000000000..8818ca179e46f --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentExtendedInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentPropertiesExtended; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.ProxyResource; + +/** + * Deployment information. + */ +public class DeploymentExtendedInner extends ProxyResource { + /** + * the location of the deployment. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Deployment properties. + */ + @JsonProperty(value = "properties") + private DeploymentPropertiesExtended properties; + + /** + * Get the location of the deployment. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location of the deployment. + * + * @param location the location value to set + * @return the DeploymentExtendedInner object itself. + */ + public DeploymentExtendedInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get deployment properties. + * + * @return the properties value + */ + public DeploymentPropertiesExtended properties() { + return this.properties; + } + + /** + * Set deployment properties. + * + * @param properties the properties value to set + * @return the DeploymentExtendedInner object itself. + */ + public DeploymentExtendedInner withProperties(DeploymentPropertiesExtended properties) { + this.properties = properties; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentInner.java new file mode 100644 index 0000000000000..a93d32a0d78f4 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment operation parameters. + */ +public class DeploymentInner { + /** + * The location to store the deployment data. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The deployment properties. + */ + @JsonProperty(value = "properties", required = true) + private DeploymentProperties properties; + + /** + * Get the location to store the deployment data. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location to store the deployment data. + * + * @param location the location value to set + * @return the DeploymentInner object itself. + */ + public DeploymentInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the deployment properties. + * + * @return the properties value + */ + public DeploymentProperties properties() { + return this.properties; + } + + /** + * Set the deployment properties. + * + * @param properties the properties value to set + * @return the DeploymentInner object itself. + */ + public DeploymentInner withProperties(DeploymentProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentOperationImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentOperationImpl.java new file mode 100644 index 0000000000000..c9f4e4caa0508 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentOperationImpl.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentOperation; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentOperationProperties; + +class DeploymentOperationImpl extends IndexableRefreshableWrapperImpl implements DeploymentOperation { + private final ResourcesManager manager; + private String groupId; + private String deploymentName; + private String operationId; + + DeploymentOperationImpl(DeploymentOperationInner inner, ResourcesManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.groupId = IdParsingUtils.getValueFromIdByName(inner.id(), "managementGroups"); + this.deploymentName = IdParsingUtils.getValueFromIdByName(inner.id(), "deployments"); + this.operationId = IdParsingUtils.getValueFromIdByName(inner.id(), "operations"); + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + DeploymentOperationsInner client = this.manager().inner().deploymentOperations(); + return client.getAtManagementGroupScopeAsync(this.groupId, this.deploymentName, this.operationId); + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String operationId() { + return this.inner().operationId(); + } + + @Override + public DeploymentOperationProperties properties() { + return this.inner().properties(); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentOperationInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentOperationInner.java new file mode 100644 index 0000000000000..2f3434696381d --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentOperationInner.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.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentOperationProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deployment operation information. + */ +public class DeploymentOperationInner { + /** + * Full deployment operation ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Deployment operation ID. + */ + @JsonProperty(value = "operationId", access = JsonProperty.Access.WRITE_ONLY) + private String operationId; + + /** + * Deployment properties. + */ + @JsonProperty(value = "properties") + private DeploymentOperationProperties properties; + + /** + * Get full deployment operation ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get deployment operation ID. + * + * @return the operationId value + */ + public String operationId() { + return this.operationId; + } + + /** + * Get deployment properties. + * + * @return the properties value + */ + public DeploymentOperationProperties properties() { + return this.properties; + } + + /** + * Set deployment properties. + * + * @param properties the properties value to set + * @return the DeploymentOperationInner object itself. + */ + public DeploymentOperationInner withProperties(DeploymentOperationProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentOperationsImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentOperationsImpl.java new file mode 100644 index 0000000000000..beace75569a89 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentOperationsImpl.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentOperations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentOperation; + +class DeploymentOperationsImpl extends WrapperImpl implements DeploymentOperations { + private final ResourcesManager manager; + + DeploymentOperationsImpl(ResourcesManager manager) { + super(manager.inner().deploymentOperations()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + private DeploymentOperationImpl wrapModel(DeploymentOperationInner inner) { + return new DeploymentOperationImpl(inner, manager()); + } + + @Override + public Observable getAtSubscriptionScopeAsync(String deploymentName, String operationId) { + DeploymentOperationsInner client = this.inner(); + return client.getAtSubscriptionScopeAsync(deploymentName, operationId) + .map(new Func1() { + @Override + public DeploymentOperation call(DeploymentOperationInner inner) { + return new DeploymentOperationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAtSubscriptionScopeAsync(final String deploymentName) { + DeploymentOperationsInner client = this.inner(); + return client.listAtSubscriptionScopeAsync(deploymentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DeploymentOperation call(DeploymentOperationInner inner) { + return new DeploymentOperationImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String deploymentName, String operationId) { + DeploymentOperationsInner client = this.inner(); + return client.getAsync(resourceGroupName, deploymentName, operationId) + .map(new Func1() { + @Override + public DeploymentOperation call(DeploymentOperationInner inner) { + return new DeploymentOperationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupAsync(final String resourceGroupName, final String deploymentName) { + DeploymentOperationsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName, deploymentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DeploymentOperation call(DeploymentOperationInner inner) { + return new DeploymentOperationImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAtManagementGroupScopeAsync(final String groupId, final String deploymentName) { + DeploymentOperationsInner client = this.inner(); + return client.listAtManagementGroupScopeAsync(groupId, deploymentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DeploymentOperation call(DeploymentOperationInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAtManagementGroupScopeAsync(String groupId, String deploymentName, String operationId) { + DeploymentOperationsInner client = this.inner(); + return client.getAtManagementGroupScopeAsync(groupId, deploymentName, operationId) + .map(new Func1() { + @Override + public DeploymentOperation call(DeploymentOperationInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentOperationsInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentOperationsInner.java new file mode 100644 index 0000000000000..55bbd608117e7 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentOperationsInner.java @@ -0,0 +1,1413 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.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 DeploymentOperations. + */ +public class DeploymentOperationsInner { + /** The Retrofit service to perform REST calls. */ + private DeploymentOperationsService service; + /** The service client containing this operation class. */ + private ResourceManagementClientImpl client; + + /** + * Initializes an instance of DeploymentOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DeploymentOperationsInner(Retrofit retrofit, ResourceManagementClientImpl client) { + this.service = retrofit.create(DeploymentOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DeploymentOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface DeploymentOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.DeploymentOperations getAtManagementGroupScope" }) + @GET("providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}") + Observable> getAtManagementGroupScope(@Path("groupId") String groupId, @Path("deploymentName") String deploymentName, @Path("operationId") String operationId, @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.resources.v2019_05_10.DeploymentOperations listAtManagementGroupScope" }) + @GET("providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations") + Observable> listAtManagementGroupScope(@Path("groupId") String groupId, @Path("deploymentName") String deploymentName, @Query("$top") Integer top, @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.resources.v2019_05_10.DeploymentOperations getAtSubscriptionScope" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}") + Observable> getAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("operationId") String operationId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.DeploymentOperations listAtSubscriptionScope" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations") + Observable> listAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("$top") Integer top, @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.resources.v2019_05_10.DeploymentOperations get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("operationId") String operationId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.DeploymentOperations listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("$top") Integer top, @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.resources.v2019_05_10.DeploymentOperations listAtManagementGroupScopeNext" }) + @GET + Observable> listAtManagementGroupScopeNext(@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.resources.v2019_05_10.DeploymentOperations listAtSubscriptionScopeNext" }) + @GET + Observable> listAtSubscriptionScopeNext(@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.resources.v2019_05_10.DeploymentOperations listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a deployments operation. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentOperationInner object if successful. + */ + public DeploymentOperationInner getAtManagementGroupScope(String groupId, String deploymentName, String operationId) { + return getAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName, operationId).toBlocking().single().body(); + } + + /** + * Gets a deployments operation. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @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 getAtManagementGroupScopeAsync(String groupId, String deploymentName, String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName, operationId), serviceCallback); + } + + /** + * Gets a deployments operation. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentOperationInner object + */ + public Observable getAtManagementGroupScopeAsync(String groupId, String deploymentName, String operationId) { + return getAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName, operationId).map(new Func1, DeploymentOperationInner>() { + @Override + public DeploymentOperationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deployments operation. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentOperationInner object + */ + public Observable> getAtManagementGroupScopeWithServiceResponseAsync(String groupId, String deploymentName, String operationId) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId 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.getAtManagementGroupScope(groupId, deploymentName, operationId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtManagementGroupScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtManagementGroupScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentOperationInner> object if successful. + */ + public PagedList listAtManagementGroupScope(final String groupId, final String deploymentName) { + ServiceResponse> response = listAtManagementGroupScopeSinglePageAsync(groupId, deploymentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtManagementGroupScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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> listAtManagementGroupScopeAsync(final String groupId, final String deploymentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtManagementGroupScopeSinglePageAsync(groupId, deploymentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtManagementGroupScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable> listAtManagementGroupScopeAsync(final String groupId, final String deploymentName) { + return listAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable>> listAtManagementGroupScopeWithServiceResponseAsync(final String groupId, final String deploymentName) { + return listAtManagementGroupScopeSinglePageAsync(groupId, deploymentName) + .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(listAtManagementGroupScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtManagementGroupScopeSinglePageAsync(final String groupId, final String deploymentName) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer top = null; + return service.listAtManagementGroupScope(groupId, deploymentName, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtManagementGroupScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentOperationInner> object if successful. + */ + public PagedList listAtManagementGroupScope(final String groupId, final String deploymentName, final Integer top) { + ServiceResponse> response = listAtManagementGroupScopeSinglePageAsync(groupId, deploymentName, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtManagementGroupScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAtManagementGroupScopeAsync(final String groupId, final String deploymentName, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtManagementGroupScopeSinglePageAsync(groupId, deploymentName, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtManagementGroupScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable> listAtManagementGroupScopeAsync(final String groupId, final String deploymentName, final Integer top) { + return listAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable>> listAtManagementGroupScopeWithServiceResponseAsync(final String groupId, final String deploymentName, final Integer top) { + return listAtManagementGroupScopeSinglePageAsync(groupId, deploymentName, top) + .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(listAtManagementGroupScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + ServiceResponse> * @param groupId The management group ID. + ServiceResponse> * @param deploymentName The name of the deployment. + ServiceResponse> * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtManagementGroupScopeSinglePageAsync(final String groupId, final String deploymentName, final Integer top) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.listAtManagementGroupScope(groupId, deploymentName, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtManagementGroupScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAtManagementGroupScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentOperationInner object if successful. + */ + public DeploymentOperationInner getAtSubscriptionScope(String deploymentName, String operationId) { + return getAtSubscriptionScopeWithServiceResponseAsync(deploymentName, operationId).toBlocking().single().body(); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @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 getAtSubscriptionScopeAsync(String deploymentName, String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtSubscriptionScopeWithServiceResponseAsync(deploymentName, operationId), serviceCallback); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentOperationInner object + */ + public Observable getAtSubscriptionScopeAsync(String deploymentName, String operationId) { + return getAtSubscriptionScopeWithServiceResponseAsync(deploymentName, operationId).map(new Func1, DeploymentOperationInner>() { + @Override + public DeploymentOperationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deployments operation. + * + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentOperationInner object + */ + public Observable> getAtSubscriptionScopeWithServiceResponseAsync(String deploymentName, String operationId) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAtSubscriptionScope(deploymentName, operationId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtSubscriptionScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentOperationInner> object if successful. + */ + public PagedList listAtSubscriptionScope(final String deploymentName) { + ServiceResponse> response = listAtSubscriptionScopeSinglePageAsync(deploymentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtSubscriptionScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @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> listAtSubscriptionScopeAsync(final String deploymentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtSubscriptionScopeSinglePageAsync(deploymentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtSubscriptionScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable> listAtSubscriptionScopeAsync(final String deploymentName) { + return listAtSubscriptionScopeWithServiceResponseAsync(deploymentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable>> listAtSubscriptionScopeWithServiceResponseAsync(final String deploymentName) { + return listAtSubscriptionScopeSinglePageAsync(deploymentName) + .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(listAtSubscriptionScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtSubscriptionScopeSinglePageAsync(final String deploymentName) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer top = null; + return service.listAtSubscriptionScope(deploymentName, this.client.subscriptionId(), top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtSubscriptionScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentOperationInner> object if successful. + */ + public PagedList listAtSubscriptionScope(final String deploymentName, final Integer top) { + ServiceResponse> response = listAtSubscriptionScopeSinglePageAsync(deploymentName, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtSubscriptionScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAtSubscriptionScopeAsync(final String deploymentName, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtSubscriptionScopeSinglePageAsync(deploymentName, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtSubscriptionScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable> listAtSubscriptionScopeAsync(final String deploymentName, final Integer top) { + return listAtSubscriptionScopeWithServiceResponseAsync(deploymentName, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable>> listAtSubscriptionScopeWithServiceResponseAsync(final String deploymentName, final Integer top) { + return listAtSubscriptionScopeSinglePageAsync(deploymentName, top) + .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(listAtSubscriptionScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + ServiceResponse> * @param deploymentName The name of the deployment. + ServiceResponse> * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtSubscriptionScopeSinglePageAsync(final String deploymentName, final Integer top) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.listAtSubscriptionScope(deploymentName, this.client.subscriptionId(), top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtSubscriptionScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAtSubscriptionScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentOperationInner object if successful. + */ + public DeploymentOperationInner get(String resourceGroupName, String deploymentName, String operationId) { + return getWithServiceResponseAsync(resourceGroupName, deploymentName, operationId).toBlocking().single().body(); + } + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String deploymentName, String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, deploymentName, operationId), serviceCallback); + } + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentOperationInner object + */ + public Observable getAsync(String resourceGroupName, String deploymentName, String operationId) { + return getWithServiceResponseAsync(resourceGroupName, deploymentName, operationId).map(new Func1, DeploymentOperationInner>() { + @Override + public DeploymentOperationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deployments operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param operationId The ID of the operation to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentOperationInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String deploymentName, String operationId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, deploymentName, operationId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentOperationInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String deploymentName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 String deploymentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String deploymentName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, deploymentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String deploymentName) { + return listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName) + .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 all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String deploymentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer top = null; + return service.listByResourceGroup(resourceGroupName, deploymentName, this.client.subscriptionId(), top, 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); + } + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentOperationInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String deploymentName, final Integer top) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final String deploymentName, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String deploymentName, final Integer top) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, deploymentName, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentOperationInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String deploymentName, final Integer top) { + return listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName, top) + .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 all deployments operations for a deployment. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. The name is case insensitive. + ServiceResponse> * @param deploymentName The name of the deployment. + ServiceResponse> * @param top The number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String deploymentName, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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, deploymentName, this.client.subscriptionId(), top, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentOperationInner> object if successful. + */ + public PagedList listAtManagementGroupScopeNext(final String nextPageLink) { + ServiceResponse> response = listAtManagementGroupScopeNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtManagementGroupScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @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> listAtManagementGroupScopeNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtManagementGroupScopeNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtManagementGroupScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @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<DeploymentOperationInner> object + */ + public Observable> listAtManagementGroupScopeNextAsync(final String nextPageLink) { + return listAtManagementGroupScopeNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @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<DeploymentOperationInner> object + */ + public Observable>> listAtManagementGroupScopeNextWithServiceResponseAsync(final String nextPageLink) { + return listAtManagementGroupScopeNextSinglePageAsync(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(listAtManagementGroupScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtManagementGroupScopeNextSinglePageAsync(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.listAtManagementGroupScopeNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtManagementGroupScopeNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAtManagementGroupScopeNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentOperationInner> object if successful. + */ + public PagedList listAtSubscriptionScopeNext(final String nextPageLink) { + ServiceResponse> response = listAtSubscriptionScopeNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtSubscriptionScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all deployments operations for a deployment. + * + * @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> listAtSubscriptionScopeNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtSubscriptionScopeNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtSubscriptionScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all deployments operations for a deployment. + * + * @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<DeploymentOperationInner> object + */ + public Observable> listAtSubscriptionScopeNextAsync(final String nextPageLink) { + return listAtSubscriptionScopeNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @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<DeploymentOperationInner> object + */ + public Observable>> listAtSubscriptionScopeNextWithServiceResponseAsync(final String nextPageLink) { + return listAtSubscriptionScopeNextSinglePageAsync(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(listAtSubscriptionScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtSubscriptionScopeNextSinglePageAsync(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.listAtSubscriptionScopeNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtSubscriptionScopeNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAtSubscriptionScopeNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all deployments operations for a deployment. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentOperationInner> 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 all deployments operations for a deployment. + * + * @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 all deployments operations for a deployment. + * + * @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<DeploymentOperationInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all deployments operations for a deployment. + * + * @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<DeploymentOperationInner> 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 all deployments operations for a deployment. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentOperationInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentValidateResultImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentValidateResultImpl.java new file mode 100644 index 0000000000000..e1eaa9c1d1201 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentValidateResultImpl.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentValidateResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_05_10.ResourceManagementErrorWithDetails; +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentPropertiesExtended; + +class DeploymentValidateResultImpl extends WrapperImpl implements DeploymentValidateResult { + private final ResourcesManager manager; + DeploymentValidateResultImpl(DeploymentValidateResultInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public ResourceManagementErrorWithDetails error() { + return this.inner().error(); + } + + @Override + public DeploymentPropertiesExtended properties() { + return this.inner().properties(); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentValidateResultInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentValidateResultInner.java new file mode 100644 index 0000000000000..c845da1784add --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentValidateResultInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.ResourceManagementErrorWithDetails; +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentPropertiesExtended; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information from validate template deployment response. + */ +public class DeploymentValidateResultInner { + /** + * Validation error. + */ + @JsonProperty(value = "error") + private ResourceManagementErrorWithDetails error; + + /** + * The template deployment properties. + */ + @JsonProperty(value = "properties") + private DeploymentPropertiesExtended properties; + + /** + * Get validation error. + * + * @return the error value + */ + public ResourceManagementErrorWithDetails error() { + return this.error; + } + + /** + * Set validation error. + * + * @param error the error value to set + * @return the DeploymentValidateResultInner object itself. + */ + public DeploymentValidateResultInner withError(ResourceManagementErrorWithDetails error) { + this.error = error; + return this; + } + + /** + * Get the template deployment properties. + * + * @return the properties value + */ + public DeploymentPropertiesExtended properties() { + return this.properties; + } + + /** + * Set the template deployment properties. + * + * @param properties the properties value to set + * @return the DeploymentValidateResultInner object itself. + */ + public DeploymentValidateResultInner withProperties(DeploymentPropertiesExtended properties) { + this.properties = properties; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentsImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentsImpl.java new file mode 100644 index 0000000000000..38a5cae1b07bb --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentsImpl.java @@ -0,0 +1,287 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_05_10.Deployments; +import rx.Completable; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentExtended; +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentValidateResult; +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentExportResult; + +class DeploymentsImpl extends WrapperImpl implements Deployments { + private final ResourcesManager manager; + + DeploymentsImpl(ResourcesManager manager) { + super(manager.inner().deployments()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public DeploymentExtendedImpl define(String name) { + return wrapModel(name); + } + + private DeploymentExtendedImpl wrapModel(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + + private DeploymentExtendedImpl wrapModel(String name) { + return new DeploymentExtendedImpl(name, this.manager()); + } + + @Override + public Completable deleteAtManagementGroupScopeAsync(String groupId, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.deleteAtManagementGroupScopeAsync(groupId, deploymentName).toCompletable(); + } + + @Override + public Observable checkExistenceAtManagementGroupScopeAsync(String groupId, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.checkExistenceAtManagementGroupScopeAsync(groupId, deploymentName) + ;} + + @Override + public Observable getAtManagementGroupScopeAsync(String groupId, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.getAtManagementGroupScopeAsync(groupId, deploymentName) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + + @Override + public Completable cancelAtManagementGroupScopeAsync(String groupId, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.cancelAtManagementGroupScopeAsync(groupId, deploymentName).toCompletable(); + } + + @Override + public Observable validateAtManagementGroupScopeAsync(String groupId, String deploymentName, DeploymentInner parameters) { + DeploymentsInner client = this.inner(); + return client.validateAtManagementGroupScopeAsync(groupId, deploymentName, parameters) + .map(new Func1() { + @Override + public DeploymentValidateResult call(DeploymentValidateResultInner inner) { + return new DeploymentValidateResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable exportTemplateAtManagementGroupScopeAsync(String groupId, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.exportTemplateAtManagementGroupScopeAsync(groupId, deploymentName) + .map(new Func1() { + @Override + public DeploymentExportResult call(DeploymentExportResultInner inner) { + return new DeploymentExportResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAtManagementGroupScopeAsync(final String groupId) { + DeploymentsInner client = this.inner(); + return client.listAtManagementGroupScopeAsync(groupId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAtSubscriptionScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.deleteAtSubscriptionScopeAsync(deploymentName).toCompletable(); + } + + @Override + public Observable checkExistenceAtSubscriptionScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.checkExistenceAtSubscriptionScopeAsync(deploymentName) + ;} + + @Override + public Observable createOrUpdateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters) { + DeploymentsInner client = this.inner(); + return client.createOrUpdateAtSubscriptionScopeAsync(deploymentName, parameters) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAtSubscriptionScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.getAtSubscriptionScopeAsync(deploymentName) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + + @Override + public Completable cancelAtSubscriptionScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.cancelAtSubscriptionScopeAsync(deploymentName).toCompletable(); + } + + @Override + public Observable validateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters) { + DeploymentsInner client = this.inner(); + return client.validateAtSubscriptionScopeAsync(deploymentName, parameters) + .map(new Func1() { + @Override + public DeploymentValidateResult call(DeploymentValidateResultInner inner) { + return new DeploymentValidateResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable exportTemplateAtSubscriptionScopeAsync(String deploymentName) { + DeploymentsInner client = this.inner(); + return client.exportTemplateAtSubscriptionScopeAsync(deploymentName) + .map(new Func1() { + @Override + public DeploymentExportResult call(DeploymentExportResultInner inner) { + return new DeploymentExportResultImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, deploymentName).toCompletable(); + } + + @Override + public Observable checkExistenceAsync(String resourceGroupName, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.checkExistenceAsync(resourceGroupName, deploymentName) + ;} + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + DeploymentsInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, deploymentName, parameters) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByResourceGroupAsync(String resourceGroupName, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, deploymentName) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + + @Override + public Completable cancelAsync(String resourceGroupName, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.cancelAsync(resourceGroupName, deploymentName).toCompletable(); + } + + @Override + public Observable validateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + DeploymentsInner client = this.inner(); + return client.validateAsync(resourceGroupName, deploymentName, parameters) + .map(new Func1() { + @Override + public DeploymentValidateResult call(DeploymentValidateResultInner inner) { + return new DeploymentValidateResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable exportTemplateAsync(String resourceGroupName, String deploymentName) { + DeploymentsInner client = this.inner(); + return client.exportTemplateAsync(resourceGroupName, deploymentName) + .map(new Func1() { + @Override + public DeploymentExportResult call(DeploymentExportResultInner inner) { + return new DeploymentExportResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + DeploymentsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupAsync(final String resourceGroupName) { + DeploymentsInner 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 DeploymentExtended call(DeploymentExtendedInner inner) { + return new DeploymentExtendedImpl(inner, manager()); + } + }); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentsInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentsInner.java new file mode 100644 index 0000000000000..89c9a57012d2e --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/DeploymentsInner.java @@ -0,0 +1,3484 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.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.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Deployments. + */ +public class DeploymentsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private DeploymentsService service; + /** The service client containing this operation class. */ + private ResourceManagementClientImpl client; + + /** + * Initializes an instance of DeploymentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DeploymentsInner(Retrofit retrofit, ResourceManagementClientImpl client) { + this.service = retrofit.create(DeploymentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Deployments to be + * used by Retrofit to perform actually REST calls. + */ + interface DeploymentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.Deployments deleteAtManagementGroupScope" }) + @HTTP(path = "providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", method = "DELETE", hasBody = true) + Observable> deleteAtManagementGroupScope(@Path("groupId") String groupId, @Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments beginDeleteAtManagementGroupScope" }) + @HTTP(path = "providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", method = "DELETE", hasBody = true) + Observable> beginDeleteAtManagementGroupScope(@Path("groupId") String groupId, @Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments checkExistenceAtManagementGroupScope" }) + @HEAD("providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> checkExistenceAtManagementGroupScope(@Path("groupId") String groupId, @Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments createOrUpdateAtManagementGroupScope" }) + @PUT("providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> createOrUpdateAtManagementGroupScope(@Path("groupId") String groupId, @Path("deploymentName") String deploymentName, @Body DeploymentInner 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.resources.v2019_05_10.Deployments beginCreateOrUpdateAtManagementGroupScope" }) + @PUT("providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> beginCreateOrUpdateAtManagementGroupScope(@Path("groupId") String groupId, @Path("deploymentName") String deploymentName, @Body DeploymentInner 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.resources.v2019_05_10.Deployments getAtManagementGroupScope" }) + @GET("providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> getAtManagementGroupScope(@Path("groupId") String groupId, @Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments cancelAtManagementGroupScope" }) + @POST("providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel") + Observable> cancelAtManagementGroupScope(@Path("groupId") String groupId, @Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments validateAtManagementGroupScope" }) + @POST("providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate") + Observable> validateAtManagementGroupScope(@Path("groupId") String groupId, @Path("deploymentName") String deploymentName, @Body DeploymentInner 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.resources.v2019_05_10.Deployments exportTemplateAtManagementGroupScope" }) + @POST("providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate") + Observable> exportTemplateAtManagementGroupScope(@Path("groupId") String groupId, @Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments listAtManagementGroupScope" }) + @GET("providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/") + Observable> listAtManagementGroupScope(@Path("groupId") String groupId, @Query("$filter") String filter, @Query("$top") Integer top, @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.resources.v2019_05_10.Deployments deleteAtSubscriptionScope" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", method = "DELETE", hasBody = true) + Observable> deleteAtSubscriptionScope(@Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments beginDeleteAtSubscriptionScope" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}", method = "DELETE", hasBody = true) + Observable> beginDeleteAtSubscriptionScope(@Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments checkExistenceAtSubscriptionScope" }) + @HEAD("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> checkExistenceAtSubscriptionScope(@Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments createOrUpdateAtSubscriptionScope" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> createOrUpdateAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentInner 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.resources.v2019_05_10.Deployments beginCreateOrUpdateAtSubscriptionScope" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> beginCreateOrUpdateAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentInner 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.resources.v2019_05_10.Deployments getAtSubscriptionScope" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> getAtSubscriptionScope(@Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments cancelAtSubscriptionScope" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel") + Observable> cancelAtSubscriptionScope(@Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments validateAtSubscriptionScope" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate") + Observable> validateAtSubscriptionScope(@Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentInner 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.resources.v2019_05_10.Deployments exportTemplateAtSubscriptionScope" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate") + Observable> exportTemplateAtSubscriptionScope(@Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @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.resources.v2019_05_10.Deployments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments checkExistence" }) + @HEAD("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> checkExistence(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentInner 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.resources.v2019_05_10.Deployments beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentInner 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.resources.v2019_05_10.Deployments getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments cancel" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel") + Observable> cancel(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments validate" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate") + Observable> validate(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Body DeploymentInner 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.resources.v2019_05_10.Deployments exportTemplate" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate") + Observable> exportTemplate(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @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.resources.v2019_05_10.Deployments listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @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.resources.v2019_05_10.Deployments listAtManagementGroupScopeNext" }) + @GET + Observable> listAtManagementGroupScopeNext(@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.resources.v2019_05_10.Deployments 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.resources.v2019_05_10.Deployments listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAtManagementGroupScope(String groupId, String deploymentName) { + deleteAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName).toBlocking().last().body(); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 deleteAtManagementGroupScopeAsync(String groupId, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName), serviceCallback); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAtManagementGroupScopeAsync(String groupId, String deploymentName) { + return deleteAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteAtManagementGroupScopeWithServiceResponseAsync(String groupId, String deploymentName) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.deleteAtManagementGroupScope(groupId, deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDeleteAtManagementGroupScope(String groupId, String deploymentName) { + beginDeleteAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName).toBlocking().single().body(); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 beginDeleteAtManagementGroupScopeAsync(String groupId, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName), serviceCallback); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAtManagementGroupScopeAsync(String groupId, String deploymentName) { + return beginDeleteAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteAtManagementGroupScopeWithServiceResponseAsync(String groupId, String deploymentName) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.beginDeleteAtManagementGroupScope(groupId, deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteAtManagementGroupScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteAtManagementGroupScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks whether the deployment exists. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + public boolean checkExistenceAtManagementGroupScope(String groupId, String deploymentName) { + return checkExistenceAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName).toBlocking().single().body(); + } + + /** + * Checks whether the deployment exists. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 checkExistenceAtManagementGroupScopeAsync(String groupId, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkExistenceAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName), serviceCallback); + } + + /** + * Checks whether the deployment exists. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkExistenceAtManagementGroupScopeAsync(String groupId, String deploymentName) { + return checkExistenceAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether the deployment exists. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkExistenceAtManagementGroupScopeWithServiceResponseAsync(String groupId, String deploymentName) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.checkExistenceAtManagementGroupScope(groupId, deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkExistenceAtManagementGroupScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkExistenceAtManagementGroupScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Deploys resources at management group scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner createOrUpdateAtManagementGroupScope(String groupId, String deploymentName, DeploymentInner parameters) { + return createOrUpdateAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName, parameters).toBlocking().last().body(); + } + + /** + * Deploys resources at management group scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 createOrUpdateAtManagementGroupScopeAsync(String groupId, String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName, parameters), serviceCallback); + } + + /** + * Deploys resources at management group scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAtManagementGroupScopeAsync(String groupId, String deploymentName, DeploymentInner parameters) { + return createOrUpdateAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName, parameters).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deploys resources at management group scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateAtManagementGroupScopeWithServiceResponseAsync(String groupId, String deploymentName, DeploymentInner parameters) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.createOrUpdateAtManagementGroupScope(groupId, deploymentName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deploys resources at management group scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner beginCreateOrUpdateAtManagementGroupScope(String groupId, String deploymentName, DeploymentInner parameters) { + return beginCreateOrUpdateAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Deploys resources at management group scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 beginCreateOrUpdateAtManagementGroupScopeAsync(String groupId, String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName, parameters), serviceCallback); + } + + /** + * Deploys resources at management group scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable beginCreateOrUpdateAtManagementGroupScopeAsync(String groupId, String deploymentName, DeploymentInner parameters) { + return beginCreateOrUpdateAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName, parameters).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deploys resources at management group scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable> beginCreateOrUpdateAtManagementGroupScopeWithServiceResponseAsync(String groupId, String deploymentName, DeploymentInner parameters) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.beginCreateOrUpdateAtManagementGroupScope(groupId, deploymentName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateAtManagementGroupScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateAtManagementGroupScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner getAtManagementGroupScope(String groupId, String deploymentName) { + return getAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName).toBlocking().single().body(); + } + + /** + * Gets a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 getAtManagementGroupScopeAsync(String groupId, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName), serviceCallback); + } + + /** + * Gets a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable getAtManagementGroupScopeAsync(String groupId, String deploymentName) { + return getAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable> getAtManagementGroupScopeWithServiceResponseAsync(String groupId, String deploymentName) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.getAtManagementGroupScope(groupId, deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtManagementGroupScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtManagementGroupScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void cancelAtManagementGroupScope(String groupId, String deploymentName) { + cancelAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName).toBlocking().single().body(); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 cancelAtManagementGroupScopeAsync(String groupId, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName), serviceCallback); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAtManagementGroupScopeAsync(String groupId, String deploymentName) { + return cancelAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelAtManagementGroupScopeWithServiceResponseAsync(String groupId, String deploymentName) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.cancelAtManagementGroupScope(groupId, deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelAtManagementGroupScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelAtManagementGroupScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentValidateResultInner object if successful. + */ + public DeploymentValidateResultInner validateAtManagementGroupScope(String groupId, String deploymentName, DeploymentInner parameters) { + return validateAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 validateAtManagementGroupScopeAsync(String groupId, String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName, parameters), serviceCallback); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentValidateResultInner object + */ + public Observable validateAtManagementGroupScopeAsync(String groupId, String deploymentName, DeploymentInner parameters) { + return validateAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName, parameters).map(new Func1, DeploymentValidateResultInner>() { + @Override + public DeploymentValidateResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentValidateResultInner object + */ + public Observable> validateAtManagementGroupScopeWithServiceResponseAsync(String groupId, String deploymentName, DeploymentInner parameters) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.validateAtManagementGroupScope(groupId, deploymentName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateAtManagementGroupScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateAtManagementGroupScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(400, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Exports the template used for specified deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentExportResultInner object if successful. + */ + public DeploymentExportResultInner exportTemplateAtManagementGroupScope(String groupId, String deploymentName) { + return exportTemplateAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName).toBlocking().single().body(); + } + + /** + * Exports the template used for specified deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @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 exportTemplateAtManagementGroupScopeAsync(String groupId, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportTemplateAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName), serviceCallback); + } + + /** + * Exports the template used for specified deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExportResultInner object + */ + public Observable exportTemplateAtManagementGroupScopeAsync(String groupId, String deploymentName) { + return exportTemplateAtManagementGroupScopeWithServiceResponseAsync(groupId, deploymentName).map(new Func1, DeploymentExportResultInner>() { + @Override + public DeploymentExportResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports the template used for specified deployment. + * + * @param groupId The management group ID. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExportResultInner object + */ + public Observable> exportTemplateAtManagementGroupScopeWithServiceResponseAsync(String groupId, String deploymentName) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.exportTemplateAtManagementGroupScope(groupId, deploymentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = exportTemplateAtManagementGroupScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportTemplateAtManagementGroupScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentExtendedInner> object if successful. + */ + public PagedList listAtManagementGroupScope(final String groupId) { + ServiceResponse> response = listAtManagementGroupScopeSinglePageAsync(groupId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtManagementGroupScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAtManagementGroupScopeAsync(final String groupId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtManagementGroupScopeSinglePageAsync(groupId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtManagementGroupScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listAtManagementGroupScopeAsync(final String groupId) { + return listAtManagementGroupScopeWithServiceResponseAsync(groupId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable>> listAtManagementGroupScopeWithServiceResponseAsync(final String groupId) { + return listAtManagementGroupScopeSinglePageAsync(groupId) + .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(listAtManagementGroupScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtManagementGroupScopeSinglePageAsync(final String groupId) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + return service.listAtManagementGroupScope(groupId, filter, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtManagementGroupScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentExtendedInner> object if successful. + */ + public PagedList listAtManagementGroupScope(final String groupId, final String filter, final Integer top) { + ServiceResponse> response = listAtManagementGroupScopeSinglePageAsync(groupId, filter, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtManagementGroupScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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> listAtManagementGroupScopeAsync(final String groupId, final String filter, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtManagementGroupScopeSinglePageAsync(groupId, filter, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtManagementGroupScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listAtManagementGroupScopeAsync(final String groupId, final String filter, final Integer top) { + return listAtManagementGroupScopeWithServiceResponseAsync(groupId, filter, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a management group. + * + * @param groupId The management group ID. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable>> listAtManagementGroupScopeWithServiceResponseAsync(final String groupId, final String filter, final Integer top) { + return listAtManagementGroupScopeSinglePageAsync(groupId, filter, top) + .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(listAtManagementGroupScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the deployments for a management group. + * + ServiceResponse> * @param groupId The management group ID. + ServiceResponse> * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + ServiceResponse> * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtManagementGroupScopeSinglePageAsync(final String groupId, final String filter, final Integer top) { + if (groupId == null) { + throw new IllegalArgumentException("Parameter groupId 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.listAtManagementGroupScope(groupId, filter, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtManagementGroupScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAtManagementGroupScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAtSubscriptionScope(String deploymentName) { + deleteAtSubscriptionScopeWithServiceResponseAsync(deploymentName).toBlocking().last().body(); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @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 deleteAtSubscriptionScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtSubscriptionScopeWithServiceResponseAsync(deploymentName), serviceCallback); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAtSubscriptionScopeAsync(String deploymentName) { + return deleteAtSubscriptionScopeWithServiceResponseAsync(deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteAtSubscriptionScopeWithServiceResponseAsync(String deploymentName) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.deleteAtSubscriptionScope(deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDeleteAtSubscriptionScope(String deploymentName) { + beginDeleteAtSubscriptionScopeWithServiceResponseAsync(deploymentName).toBlocking().single().body(); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @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 beginDeleteAtSubscriptionScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteAtSubscriptionScopeWithServiceResponseAsync(deploymentName), serviceCallback); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAtSubscriptionScopeAsync(String deploymentName) { + return beginDeleteAtSubscriptionScopeWithServiceResponseAsync(deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteAtSubscriptionScopeWithServiceResponseAsync(String deploymentName) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.beginDeleteAtSubscriptionScope(deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteAtSubscriptionScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + public boolean checkExistenceAtSubscriptionScope(String deploymentName) { + return checkExistenceAtSubscriptionScopeWithServiceResponseAsync(deploymentName).toBlocking().single().body(); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @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 checkExistenceAtSubscriptionScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkExistenceAtSubscriptionScopeWithServiceResponseAsync(deploymentName), serviceCallback); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkExistenceAtSubscriptionScopeAsync(String deploymentName) { + return checkExistenceAtSubscriptionScopeWithServiceResponseAsync(deploymentName).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether the deployment exists. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkExistenceAtSubscriptionScopeWithServiceResponseAsync(String deploymentName) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.checkExistenceAtSubscriptionScope(deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkExistenceAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkExistenceAtSubscriptionScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner createOrUpdateAtSubscriptionScope(String deploymentName, DeploymentInner parameters) { + return createOrUpdateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).toBlocking().last().body(); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 createOrUpdateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters), serviceCallback); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters) { + return createOrUpdateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateAtSubscriptionScopeWithServiceResponseAsync(String deploymentName, DeploymentInner parameters) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdateAtSubscriptionScope(deploymentName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner beginCreateOrUpdateAtSubscriptionScope(String deploymentName, DeploymentInner parameters) { + return beginCreateOrUpdateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 beginCreateOrUpdateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters), serviceCallback); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable beginCreateOrUpdateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters) { + return beginCreateOrUpdateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deploys resources at subscription scope. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable> beginCreateOrUpdateAtSubscriptionScopeWithServiceResponseAsync(String deploymentName, DeploymentInner parameters) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdateAtSubscriptionScope(deploymentName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateAtSubscriptionScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner getAtSubscriptionScope(String deploymentName) { + return getAtSubscriptionScopeWithServiceResponseAsync(deploymentName).toBlocking().single().body(); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @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 getAtSubscriptionScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtSubscriptionScopeWithServiceResponseAsync(deploymentName), serviceCallback); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable getAtSubscriptionScopeAsync(String deploymentName) { + return getAtSubscriptionScopeWithServiceResponseAsync(deploymentName).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable> getAtSubscriptionScopeWithServiceResponseAsync(String deploymentName) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.getAtSubscriptionScope(deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtSubscriptionScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void cancelAtSubscriptionScope(String deploymentName) { + cancelAtSubscriptionScopeWithServiceResponseAsync(deploymentName).toBlocking().single().body(); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @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 cancelAtSubscriptionScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelAtSubscriptionScopeWithServiceResponseAsync(deploymentName), serviceCallback); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAtSubscriptionScopeAsync(String deploymentName) { + return cancelAtSubscriptionScopeWithServiceResponseAsync(deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelAtSubscriptionScopeWithServiceResponseAsync(String deploymentName) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.cancelAtSubscriptionScope(deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelAtSubscriptionScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentValidateResultInner object if successful. + */ + public DeploymentValidateResultInner validateAtSubscriptionScope(String deploymentName, DeploymentInner parameters) { + return validateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 validateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters), serviceCallback); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentValidateResultInner object + */ + public Observable validateAtSubscriptionScopeAsync(String deploymentName, DeploymentInner parameters) { + return validateAtSubscriptionScopeWithServiceResponseAsync(deploymentName, parameters).map(new Func1, DeploymentValidateResultInner>() { + @Override + public DeploymentValidateResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentValidateResultInner object + */ + public Observable> validateAtSubscriptionScopeWithServiceResponseAsync(String deploymentName, DeploymentInner parameters) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.validateAtSubscriptionScope(deploymentName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateAtSubscriptionScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(400, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentExportResultInner object if successful. + */ + public DeploymentExportResultInner exportTemplateAtSubscriptionScope(String deploymentName) { + return exportTemplateAtSubscriptionScopeWithServiceResponseAsync(deploymentName).toBlocking().single().body(); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @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 exportTemplateAtSubscriptionScopeAsync(String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportTemplateAtSubscriptionScopeWithServiceResponseAsync(deploymentName), serviceCallback); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExportResultInner object + */ + public Observable exportTemplateAtSubscriptionScopeAsync(String deploymentName) { + return exportTemplateAtSubscriptionScopeWithServiceResponseAsync(deploymentName).map(new Func1, DeploymentExportResultInner>() { + @Override + public DeploymentExportResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports the template used for specified deployment. + * + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExportResultInner object + */ + public Observable> exportTemplateAtSubscriptionScopeWithServiceResponseAsync(String deploymentName) { + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.exportTemplateAtSubscriptionScope(deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = exportTemplateAtSubscriptionScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportTemplateAtSubscriptionScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get all the deployments for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentExtendedInner> 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(); + } + }; + } + + /** + * Get all the deployments for a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> 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)); + } + }); + } + + /** + * Get all the deployments for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> 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."); + } + final String filter = null; + final Integer top = null; + return service.list(this.client.subscriptionId(), filter, top, 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); + } + } + }); + } + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentExtendedInner> object if successful. + */ + public PagedList list(final String filter, final Integer top) { + ServiceResponse> response = listSinglePageAsync(filter, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 String filter, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listAsync(final String filter, final Integer top) { + return listWithServiceResponseAsync(filter, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a subscription. + * + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter, final Integer top) { + return listSinglePageAsync(filter, top) + .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)); + } + }); + } + + /** + * Get all the deployments for a subscription. + * + ServiceResponse> * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + ServiceResponse> * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter, final Integer top) { + 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(), filter, top, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String deploymentName) { + deleteWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().last().body(); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, deploymentName), serviceCallback); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String deploymentName) { + return deleteWithServiceResponseAsync(resourceGroupName, deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String deploymentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String deploymentName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body(); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, deploymentName), serviceCallback); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String deploymentName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a deployment from the deployment history. + * A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + * + * @param resourceGroupName The name of the resource group with the deployment to delete. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String deploymentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + public boolean checkExistence(String resourceGroupName, String deploymentName) { + return checkExistenceWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body(); + } + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 checkExistenceAsync(String resourceGroupName, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkExistenceWithServiceResponseAsync(resourceGroupName, deploymentName), serviceCallback); + } + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkExistenceAsync(String resourceGroupName, String deploymentName) { + return checkExistenceWithServiceResponseAsync(resourceGroupName, deploymentName).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether the deployment exists. + * + * @param resourceGroupName The name of the resource group with the deployment to check. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkExistenceWithServiceResponseAsync(String resourceGroupName, String deploymentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.checkExistence(resourceGroupName, deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkExistenceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkExistenceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner createOrUpdate(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).toBlocking().last().body(); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters), serviceCallback); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, deploymentName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner beginCreateOrUpdate(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the 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 deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters), serviceCallback); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deploys resources to a resource group. + * You can provide the template and parameters directly in the request or link to JSON files. + * + * @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. + * @param deploymentName The name of the deployment. + * @param parameters Additional parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, deploymentName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentExtendedInner object if successful. + */ + public DeploymentExtendedInner getByResourceGroup(String resourceGroupName, String deploymentName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body(); + } + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, deploymentName), serviceCallback); + } + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String deploymentName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, deploymentName).map(new Func1, DeploymentExtendedInner>() { + @Override + public DeploymentExtendedInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExtendedInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String deploymentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.getByResourceGroup(resourceGroupName, deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void cancel(String resourceGroupName, String deploymentName) { + cancelWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body(); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture cancelAsync(String resourceGroupName, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(resourceGroupName, deploymentName), serviceCallback); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAsync(String resourceGroupName, String deploymentName) { + return cancelWithServiceResponseAsync(resourceGroupName, deploymentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a currently running template deployment. + * You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelWithServiceResponseAsync(String resourceGroupName, String deploymentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.cancel(resourceGroupName, deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentValidateResultInner object if successful. + */ + public DeploymentValidateResultInner validate(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + return validateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).toBlocking().single().body(); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @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 validateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters), serviceCallback); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentValidateResultInner object + */ + public Observable validateAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + return validateWithServiceResponseAsync(resourceGroupName, deploymentName, parameters).map(new Func1, DeploymentValidateResultInner>() { + @Override + public DeploymentValidateResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + * + * @param resourceGroupName The name of the resource group the template will be deployed to. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @param parameters Parameters to validate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentValidateResultInner object + */ + public Observable> validateWithServiceResponseAsync(String resourceGroupName, String deploymentName, DeploymentInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.validate(resourceGroupName, deploymentName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(400, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DeploymentExportResultInner object if successful. + */ + public DeploymentExportResultInner exportTemplate(String resourceGroupName, String deploymentName) { + return exportTemplateWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body(); + } + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @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 exportTemplateAsync(String resourceGroupName, String deploymentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportTemplateWithServiceResponseAsync(resourceGroupName, deploymentName), serviceCallback); + } + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExportResultInner object + */ + public Observable exportTemplateAsync(String resourceGroupName, String deploymentName) { + return exportTemplateWithServiceResponseAsync(resourceGroupName, deploymentName).map(new Func1, DeploymentExportResultInner>() { + @Override + public DeploymentExportResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports the template used for specified deployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param deploymentName The name of the deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeploymentExportResultInner object + */ + public Observable> exportTemplateWithServiceResponseAsync(String resourceGroupName, String deploymentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (deploymentName == null) { + throw new IllegalArgumentException("Parameter deploymentName 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.exportTemplate(resourceGroupName, deploymentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = exportTemplateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportTemplateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentExtendedInner> 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(); + } + }; + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @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); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> 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)); + } + }); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> 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."); + } + final String filter = null; + final Integer top = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, top, 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); + } + } + }); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentExtendedInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String filter, final Integer top) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, filter, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @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 String filter, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, filter, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String filter, final Integer top) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a resource group. + * + * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter, final Integer top) { + return listByResourceGroupSinglePageAsync(resourceGroupName, filter, top) + .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)); + } + }); + } + + /** + * Get all the deployments for a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group with the deployments to get. The name is case insensitive. + ServiceResponse> * @param filter The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + ServiceResponse> * @param top The number of results to get. If null is passed, returns all deployments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String filter, final Integer top) { + 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(), filter, top, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get all the deployments for a management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentExtendedInner> object if successful. + */ + public PagedList listAtManagementGroupScopeNext(final String nextPageLink) { + ServiceResponse> response = listAtManagementGroupScopeNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtManagementGroupScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the deployments for a management 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> listAtManagementGroupScopeNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtManagementGroupScopeNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtManagementGroupScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments for a management 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<DeploymentExtendedInner> object + */ + public Observable> listAtManagementGroupScopeNextAsync(final String nextPageLink) { + return listAtManagementGroupScopeNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a management 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<DeploymentExtendedInner> object + */ + public Observable>> listAtManagementGroupScopeNextWithServiceResponseAsync(final String nextPageLink) { + return listAtManagementGroupScopeNextSinglePageAsync(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(listAtManagementGroupScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all the deployments for a management 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<DeploymentExtendedInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtManagementGroupScopeNextSinglePageAsync(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.listAtManagementGroupScopeNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtManagementGroupScopeNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAtManagementGroupScopeNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get all the deployments for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentExtendedInner> 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(); + } + }; + } + + /** + * Get all the deployments for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> 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)); + } + }); + } + + /** + * Get all the deployments for a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get all the deployments for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeploymentExtendedInner> 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(); + } + }; + } + + /** + * Get all the deployments for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the deployments for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the deployments for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeploymentExtendedInner> 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)); + } + }); + } + + /** + * Get all the deployments for a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeploymentExtendedInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/GenericResourceImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/GenericResourceImpl.java new file mode 100644 index 0000000000000..a85c93f4fe59b --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/GenericResourceImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.GenericResource; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_05_10.Identity; +import com.microsoft.azure.management.resources.v2019_05_10.Plan; +import com.microsoft.azure.management.resources.v2019_05_10.Sku; +import java.util.Map; + +class GenericResourceImpl extends WrapperImpl implements GenericResource { + private final ResourcesManager manager; + + GenericResourceImpl(GenericResourceInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Identity identity() { + return this.inner().identity(); + } + + @Override + public String kind() { + return this.inner().kind(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String managedBy() { + return this.inner().managedBy(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Plan plan() { + return this.inner().plan(); + } + + @Override + public Object properties() { + return this.inner().properties(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/GenericResourceInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/GenericResourceInner.java new file mode 100644 index 0000000000000..bd52b7b55466f --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/GenericResourceInner.java @@ -0,0 +1,179 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.Plan; +import com.microsoft.azure.management.resources.v2019_05_10.Sku; +import com.microsoft.azure.management.resources.v2019_05_10.Identity; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Resource information. + */ +@SkipParentValidation +public class GenericResourceInner extends Resource { + /** + * The plan of the resource. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /** + * The resource properties. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * The kind of the resource. + */ + @JsonProperty(value = "kind") + private String kind; + + /** + * ID of the resource that manages this resource. + */ + @JsonProperty(value = "managedBy") + private String managedBy; + + /** + * The SKU of the resource. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * Get the plan of the resource. + * + * @return the plan value + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan of the resource. + * + * @param plan the plan value to set + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** + * Get the resource properties. + * + * @return the properties value + */ + public Object properties() { + return this.properties; + } + + /** + * Set the resource properties. + * + * @param properties the properties value to set + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Get the kind of the resource. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind of the resource. + * + * @param kind the kind value to set + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get iD of the resource that manages this resource. + * + * @return the managedBy value + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Set iD of the resource that manages this resource. + * + * @param managedBy the managedBy value to set + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withManagedBy(String managedBy) { + this.managedBy = managedBy; + return this; + } + + /** + * Get the SKU of the resource. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the SKU of the resource. + * + * @param sku the sku value to set + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the identity of the resource. + * + * @return the identity value + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity of the resource. + * + * @param identity the identity value to set + * @return the GenericResourceInner object itself. + */ + public GenericResourceInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/IdParsingUtils.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..652cedd313d89 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/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.resources.v2019_05_10.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/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/OperationImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/OperationImpl.java new file mode 100644 index 0000000000000..4f328f68fb96a --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_05_10.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ResourcesManager manager; + OperationImpl(OperationInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/OperationInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/OperationInner.java new file mode 100644 index 0000000000000..e68d3c640de62 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/OperationInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Microsoft.Resources operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {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 object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/OperationsImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..3929350deb681 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/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.resources.v2019_05_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_05_10.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_05_10.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ResourcesManager manager; + + OperationsImpl(ResourcesManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ResourcesManager 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/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/OperationsInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/OperationsInner.java new file mode 100644 index 0000000000000..e38c7215774b3 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/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.resources.v2019_05_10.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.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 ResourceManagementClientImpl 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, ResourceManagementClientImpl 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.resources.v2019_05_10.Operations list" }) + @GET("providers/Microsoft.Resources/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.resources.v2019_05_10.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the 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 all of the available Microsoft.Resources REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @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 all of the available Microsoft.Resources REST API operations. + * + * @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 all of the available Microsoft.Resources REST API operations. + * + * @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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<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 all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @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 all of the available Microsoft.Resources REST API operations. + * + * @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 all of the available Microsoft.Resources REST API operations. + * + 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/PageImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/PageImpl.java new file mode 100644 index 0000000000000..4bba8d82c6233 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/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.resources.v2019_05_10.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/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ProviderImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ProviderImpl.java new file mode 100644 index 0000000000000..fff7f49b501fe --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ProviderImpl.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.Provider; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.resources.v2019_05_10.ProviderResourceType; + +class ProviderImpl extends IndexableRefreshableWrapperImpl implements Provider { + private final ResourcesManager manager; + private String resourceProviderNamespace; + + ProviderImpl(ProviderInner inner, ResourcesManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.resourceProviderNamespace = IdParsingUtils.getValueFromIdByName(inner.id(), "providers"); + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ProvidersInner client = this.manager().inner().providers(); + return client.getAsync(this.resourceProviderNamespace); + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String namespace() { + return this.inner().namespace(); + } + + @Override + public String registrationPolicy() { + return this.inner().registrationPolicy(); + } + + @Override + public String registrationState() { + return this.inner().registrationState(); + } + + @Override + public List resourceTypes() { + return this.inner().resourceTypes(); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ProviderInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ProviderInner.java new file mode 100644 index 0000000000000..0091d947e83c6 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ProviderInner.java @@ -0,0 +1,105 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import java.util.List; +import com.microsoft.azure.management.resources.v2019_05_10.ProviderResourceType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource provider information. + */ +public class ProviderInner { + /** + * The provider ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The namespace of the resource provider. + */ + @JsonProperty(value = "namespace") + private String namespace; + + /** + * The registration state of the resource provider. + */ + @JsonProperty(value = "registrationState", access = JsonProperty.Access.WRITE_ONLY) + private String registrationState; + + /** + * The registration policy of the resource provider. + */ + @JsonProperty(value = "registrationPolicy", access = JsonProperty.Access.WRITE_ONLY) + private String registrationPolicy; + + /** + * The collection of provider resource types. + */ + @JsonProperty(value = "resourceTypes", access = JsonProperty.Access.WRITE_ONLY) + private List resourceTypes; + + /** + * Get the provider ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the namespace of the resource provider. + * + * @return the namespace value + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace of the resource provider. + * + * @param namespace the namespace value to set + * @return the ProviderInner object itself. + */ + public ProviderInner withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the registration state of the resource provider. + * + * @return the registrationState value + */ + public String registrationState() { + return this.registrationState; + } + + /** + * Get the registration policy of the resource provider. + * + * @return the registrationPolicy value + */ + public String registrationPolicy() { + return this.registrationPolicy; + } + + /** + * Get the collection of provider resource types. + * + * @return the resourceTypes value + */ + public List resourceTypes() { + return this.resourceTypes; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ProvidersImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ProvidersImpl.java new file mode 100644 index 0000000000000..c570bea9adda2 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ProvidersImpl.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_05_10.Providers; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_05_10.Provider; + +class ProvidersImpl extends WrapperImpl implements Providers { + private final ResourcesManager manager; + + ProvidersImpl(ResourcesManager manager) { + super(manager.inner().providers()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + private ProviderImpl wrapModel(ProviderInner inner) { + return new ProviderImpl(inner, manager()); + } + + @Override + public Observable unregisterAsync(String resourceProviderNamespace) { + ProvidersInner client = this.inner(); + return client.unregisterAsync(resourceProviderNamespace) + .map(new Func1() { + @Override + public Provider call(ProviderInner inner) { + return new ProviderImpl(inner, manager()); + } + }); + } + + @Override + public Observable registerAsync(String resourceProviderNamespace) { + ProvidersInner client = this.inner(); + return client.registerAsync(resourceProviderNamespace) + .map(new Func1() { + @Override + public Provider call(ProviderInner inner) { + return new ProviderImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAtTenantScopeAsync(String resourceProviderNamespace) { + ProvidersInner client = this.inner(); + return client.getAtTenantScopeAsync(resourceProviderNamespace) + .map(new Func1() { + @Override + public Provider call(ProviderInner inner) { + return new ProviderImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAtTenantScopeAsync() { + ProvidersInner client = this.inner(); + return client.listAtTenantScopeAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Provider call(ProviderInner inner) { + return new ProviderImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + ProvidersInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Provider call(ProviderInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceProviderNamespace) { + ProvidersInner client = this.inner(); + return client.getAsync(resourceProviderNamespace) + .map(new Func1() { + @Override + public Provider call(ProviderInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ProvidersInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ProvidersInner.java new file mode 100644 index 0000000000000..13980d5a20a18 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ProvidersInner.java @@ -0,0 +1,1213 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Providers. + */ +public class ProvidersInner { + /** The Retrofit service to perform REST calls. */ + private ProvidersService service; + /** The service client containing this operation class. */ + private ResourceManagementClientImpl client; + + /** + * Initializes an instance of ProvidersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ProvidersInner(Retrofit retrofit, ResourceManagementClientImpl client) { + this.service = retrofit.create(ProvidersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Providers to be + * used by Retrofit to perform actually REST calls. + */ + interface ProvidersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.Providers unregister" }) + @POST("subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister") + Observable> unregister(@Path("resourceProviderNamespace") String resourceProviderNamespace, @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.resources.v2019_05_10.Providers register" }) + @POST("subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register") + Observable> register(@Path("resourceProviderNamespace") String resourceProviderNamespace, @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.resources.v2019_05_10.Providers list" }) + @GET("subscriptions/{subscriptionId}/providers") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$top") Integer top, @Query("$expand") String expand, @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.resources.v2019_05_10.Providers listAtTenantScope" }) + @GET("providers") + Observable> listAtTenantScope(@Query("$top") Integer top, @Query("$expand") String expand, @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.resources.v2019_05_10.Providers get" }) + @GET("subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}") + Observable> get(@Path("resourceProviderNamespace") String resourceProviderNamespace, @Path("subscriptionId") String subscriptionId, @Query("$expand") String expand, @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.resources.v2019_05_10.Providers getAtTenantScope" }) + @GET("providers/{resourceProviderNamespace}") + Observable> getAtTenantScope(@Path("resourceProviderNamespace") String resourceProviderNamespace, @Query("$expand") String expand, @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.resources.v2019_05_10.Providers 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.resources.v2019_05_10.Providers listAtTenantScopeNext" }) + @GET + Observable> listAtTenantScopeNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProviderInner object if successful. + */ + public ProviderInner unregister(String resourceProviderNamespace) { + return unregisterWithServiceResponseAsync(resourceProviderNamespace).toBlocking().single().body(); + } + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @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 unregisterAsync(String resourceProviderNamespace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(unregisterWithServiceResponseAsync(resourceProviderNamespace), serviceCallback); + } + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable unregisterAsync(String resourceProviderNamespace) { + return unregisterWithServiceResponseAsync(resourceProviderNamespace).map(new Func1, ProviderInner>() { + @Override + public ProviderInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Unregisters a subscription from a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to unregister. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable> unregisterWithServiceResponseAsync(String resourceProviderNamespace) { + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace 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.unregister(resourceProviderNamespace, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = unregisterDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse unregisterDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProviderInner object if successful. + */ + public ProviderInner register(String resourceProviderNamespace) { + return registerWithServiceResponseAsync(resourceProviderNamespace).toBlocking().single().body(); + } + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @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 registerAsync(String resourceProviderNamespace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(registerWithServiceResponseAsync(resourceProviderNamespace), serviceCallback); + } + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable registerAsync(String resourceProviderNamespace) { + return registerWithServiceResponseAsync(resourceProviderNamespace).map(new Func1, ProviderInner>() { + @Override + public ProviderInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Registers a subscription with a resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider to register. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable> registerWithServiceResponseAsync(String resourceProviderNamespace) { + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace 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.register(resourceProviderNamespace, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = registerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse registerDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all resource providers for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProviderInner> 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 all resource providers for a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all resource providers for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all resource providers for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> 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 all resource providers for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProviderInner> 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."); + } + final Integer top = null; + final String expand = null; + return service.list(this.client.subscriptionId(), top, expand, 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); + } + } + }); + } + + /** + * Gets all resource providers for a subscription. + * + * @param top The number of results to return. If null is passed returns all deployments. + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProviderInner> object if successful. + */ + public PagedList list(final Integer top, final String expand) { + ServiceResponse> response = listSinglePageAsync(top, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all resource providers for a subscription. + * + * @param top The number of results to return. If null is passed returns all deployments. + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @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 Integer top, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(top, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all resource providers for a subscription. + * + * @param top The number of results to return. If null is passed returns all deployments. + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> object + */ + public Observable> listAsync(final Integer top, final String expand) { + return listWithServiceResponseAsync(top, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all resource providers for a subscription. + * + * @param top The number of results to return. If null is passed returns all deployments. + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> object + */ + public Observable>> listWithServiceResponseAsync(final Integer top, final String expand) { + return listSinglePageAsync(top, expand) + .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 all resource providers for a subscription. + * + ServiceResponse> * @param top The number of results to return. If null is passed returns all deployments. + ServiceResponse> * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProviderInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final Integer top, final String expand) { + 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(), top, expand, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all resource providers for the tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProviderInner> object if successful. + */ + public PagedList listAtTenantScope() { + ServiceResponse> response = listAtTenantScopeSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtTenantScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all resource providers for the tenant. + * + * @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> listAtTenantScopeAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtTenantScopeSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtTenantScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all resource providers for the tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> object + */ + public Observable> listAtTenantScopeAsync() { + return listAtTenantScopeWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all resource providers for the tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> object + */ + public Observable>> listAtTenantScopeWithServiceResponseAsync() { + return listAtTenantScopeSinglePageAsync() + .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(listAtTenantScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all resource providers for the tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProviderInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtTenantScopeSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer top = null; + final String expand = null; + return service.listAtTenantScope(top, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtTenantScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets all resource providers for the tenant. + * + * @param top The number of results to return. If null is passed returns all providers. + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProviderInner> object if successful. + */ + public PagedList listAtTenantScope(final Integer top, final String expand) { + ServiceResponse> response = listAtTenantScopeSinglePageAsync(top, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtTenantScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all resource providers for the tenant. + * + * @param top The number of results to return. If null is passed returns all providers. + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @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> listAtTenantScopeAsync(final Integer top, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtTenantScopeSinglePageAsync(top, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtTenantScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all resource providers for the tenant. + * + * @param top The number of results to return. If null is passed returns all providers. + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> object + */ + public Observable> listAtTenantScopeAsync(final Integer top, final String expand) { + return listAtTenantScopeWithServiceResponseAsync(top, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all resource providers for the tenant. + * + * @param top The number of results to return. If null is passed returns all providers. + * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> object + */ + public Observable>> listAtTenantScopeWithServiceResponseAsync(final Integer top, final String expand) { + return listAtTenantScopeSinglePageAsync(top, expand) + .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(listAtTenantScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all resource providers for the tenant. + * + ServiceResponse> * @param top The number of results to return. If null is passed returns all providers. + ServiceResponse> * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProviderInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtTenantScopeSinglePageAsync(final Integer top, final String expand) { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listAtTenantScope(top, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtTenantScopeDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAtTenantScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProviderInner object if successful. + */ + public ProviderInner get(String resourceProviderNamespace) { + return getWithServiceResponseAsync(resourceProviderNamespace).toBlocking().single().body(); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource 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 getAsync(String resourceProviderNamespace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceProviderNamespace), serviceCallback); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable getAsync(String resourceProviderNamespace) { + return getWithServiceResponseAsync(resourceProviderNamespace).map(new Func1, ProviderInner>() { + @Override + public ProviderInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable> getWithServiceResponseAsync(String resourceProviderNamespace) { + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.get(resourceProviderNamespace, this.client.subscriptionId(), expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProviderInner object if successful. + */ + public ProviderInner get(String resourceProviderNamespace, String expand) { + return getWithServiceResponseAsync(resourceProviderNamespace, expand).toBlocking().single().body(); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceProviderNamespace, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceProviderNamespace, expand), serviceCallback); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable getAsync(String resourceProviderNamespace, String expand) { + return getWithServiceResponseAsync(resourceProviderNamespace, expand).map(new Func1, ProviderInner>() { + @Override + public ProviderInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified resource provider. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable> getWithServiceResponseAsync(String resourceProviderNamespace, String expand) { + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceProviderNamespace, this.client.subscriptionId(), expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProviderInner object if successful. + */ + public ProviderInner getAtTenantScope(String resourceProviderNamespace) { + return getAtTenantScopeWithServiceResponseAsync(resourceProviderNamespace).toBlocking().single().body(); + } + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource 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 getAtTenantScopeAsync(String resourceProviderNamespace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtTenantScopeWithServiceResponseAsync(resourceProviderNamespace), serviceCallback); + } + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable getAtTenantScopeAsync(String resourceProviderNamespace) { + return getAtTenantScopeWithServiceResponseAsync(resourceProviderNamespace).map(new Func1, ProviderInner>() { + @Override + public ProviderInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable> getAtTenantScopeWithServiceResponseAsync(String resourceProviderNamespace) { + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.getAtTenantScope(resourceProviderNamespace, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtTenantScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProviderInner object if successful. + */ + public ProviderInner getAtTenantScope(String resourceProviderNamespace, String expand) { + return getAtTenantScopeWithServiceResponseAsync(resourceProviderNamespace, expand).toBlocking().single().body(); + } + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + * @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 getAtTenantScopeAsync(String resourceProviderNamespace, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtTenantScopeWithServiceResponseAsync(resourceProviderNamespace, expand), serviceCallback); + } + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable getAtTenantScopeAsync(String resourceProviderNamespace, String expand) { + return getAtTenantScopeWithServiceResponseAsync(resourceProviderNamespace, expand).map(new Func1, ProviderInner>() { + @Override + public ProviderInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified resource provider at the tenant level. + * + * @param resourceProviderNamespace The namespace of the resource provider. + * @param expand The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProviderInner object + */ + public Observable> getAtTenantScopeWithServiceResponseAsync(String resourceProviderNamespace, String expand) { + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace 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.getAtTenantScope(resourceProviderNamespace, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtTenantScopeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtTenantScopeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all resource providers for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProviderInner> 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 all resource providers for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all resource providers for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all resource providers for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProviderInner> 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 all resource providers for a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProviderInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all resource providers for the tenant. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProviderInner> object if successful. + */ + public PagedList listAtTenantScopeNext(final String nextPageLink) { + ServiceResponse> response = listAtTenantScopeNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listAtTenantScopeNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all resource providers for the tenant. + * + * @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> listAtTenantScopeNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listAtTenantScopeNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listAtTenantScopeNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all resource providers for the tenant. + * + * @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<ProviderInner> object + */ + public Observable> listAtTenantScopeNextAsync(final String nextPageLink) { + return listAtTenantScopeNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all resource providers for the tenant. + * + * @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<ProviderInner> object + */ + public Observable>> listAtTenantScopeNextWithServiceResponseAsync(final String nextPageLink) { + return listAtTenantScopeNextSinglePageAsync(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(listAtTenantScopeNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all resource providers for the tenant. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProviderInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listAtTenantScopeNextSinglePageAsync(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.listAtTenantScopeNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listAtTenantScopeNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listAtTenantScopeNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupExportResultImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupExportResultImpl.java new file mode 100644 index 0000000000000..29cbe6a2459c7 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupExportResultImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.ResourceGroupExportResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_05_10.ResourceManagementErrorWithDetails; + +class ResourceGroupExportResultImpl extends WrapperImpl implements ResourceGroupExportResult { + private final ResourcesManager manager; + ResourceGroupExportResultImpl(ResourceGroupExportResultInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public ResourceManagementErrorWithDetails error() { + return this.inner().error(); + } + + @Override + public Object template() { + return this.inner().template(); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupExportResultInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupExportResultInner.java new file mode 100644 index 0000000000000..413a269773247 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupExportResultInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.ResourceManagementErrorWithDetails; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource group export result. + */ +public class ResourceGroupExportResultInner { + /** + * The template content. + */ + @JsonProperty(value = "template") + private Object template; + + /** + * The error. + */ + @JsonProperty(value = "error") + private ResourceManagementErrorWithDetails error; + + /** + * Get the template content. + * + * @return the template value + */ + public Object template() { + return this.template; + } + + /** + * Set the template content. + * + * @param template the template value to set + * @return the ResourceGroupExportResultInner object itself. + */ + public ResourceGroupExportResultInner withTemplate(Object template) { + this.template = template; + return this; + } + + /** + * Get the error. + * + * @return the error value + */ + public ResourceManagementErrorWithDetails error() { + return this.error; + } + + /** + * Set the error. + * + * @param error the error value to set + * @return the ResourceGroupExportResultInner object itself. + */ + public ResourceGroupExportResultInner withError(ResourceManagementErrorWithDetails error) { + this.error = error; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupImpl.java new file mode 100644 index 0000000000000..7cec8dae1e05e --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupImpl.java @@ -0,0 +1,174 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.ResourceGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_05_10.ResourceGroupPatchable; +import java.util.Map; +import com.microsoft.azure.management.resources.v2019_05_10.ResourceGroupProperties; +import rx.functions.Func1; + +class ResourceGroupImpl extends CreatableUpdatableImpl implements ResourceGroup, ResourceGroup.Definition, ResourceGroup.Update { + private final ResourcesManager manager; + private String resourceGroupName; + private ResourceGroupPatchable updateParameter; + + ResourceGroupImpl(String name, ResourcesManager manager) { + super(name, new ResourceGroupInner()); + this.manager = manager; + // Set resource name + this.resourceGroupName = name; + // + this.updateParameter = new ResourceGroupPatchable(); + } + + ResourceGroupImpl(ResourceGroupInner inner, ResourcesManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.resourceGroupName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + // + this.updateParameter = new ResourceGroupPatchable(); + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ResourceGroupsInner client = this.manager().inner().resourceGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.inner()) + .map(new Func1() { + @Override + public ResourceGroupInner call(ResourceGroupInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ResourceGroupsInner client = this.manager().inner().resourceGroups(); + return client.updateAsync(this.resourceGroupName, this.updateParameter) + .map(new Func1() { + @Override + public ResourceGroupInner call(ResourceGroupInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ResourceGroupsInner client = this.manager().inner().resourceGroups(); + return client.getAsync(this.resourceGroupName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ResourceGroupPatchable(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String managedBy() { + return this.inner().managedBy(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ResourceGroupProperties properties() { + return this.inner().properties(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ResourceGroupImpl withExistingSubscription() { + return this; + } + + @Override + public ResourceGroupImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public ResourceGroupImpl withName(String name) { + this.updateParameter.withName(name); + return this; + } + + @Override + public ResourceGroupImpl withManagedBy(String managedBy) { + if (isInCreateMode()) { + this.inner().withManagedBy(managedBy); + } else { + this.updateParameter.withManagedBy(managedBy); + } + return this; + } + + @Override + public ResourceGroupImpl withProperties(ResourceGroupProperties properties) { + if (isInCreateMode()) { + this.inner().withProperties(properties); + } else { + this.updateParameter.withProperties(properties); + } + return this; + } + + @Override + public ResourceGroupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupInner.java new file mode 100644 index 0000000000000..cc8d5c8f1a7b3 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.ResourceGroupProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Resource; + +/** + * Resource group information. + */ +public class ResourceGroupInner extends Resource { + /** + * The resource group properties. + */ + @JsonProperty(value = "properties") + private ResourceGroupProperties properties; + + /** + * The ID of the resource that manages this resource group. + */ + @JsonProperty(value = "managedBy") + private String managedBy; + + /** + * Get the resource group properties. + * + * @return the properties value + */ + public ResourceGroupProperties properties() { + return this.properties; + } + + /** + * Set the resource group properties. + * + * @param properties the properties value to set + * @return the ResourceGroupInner object itself. + */ + public ResourceGroupInner withProperties(ResourceGroupProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the ID of the resource that manages this resource group. + * + * @return the managedBy value + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Set the ID of the resource that manages this resource group. + * + * @param managedBy the managedBy value to set + * @return the ResourceGroupInner object itself. + */ + public ResourceGroupInner withManagedBy(String managedBy) { + this.managedBy = managedBy; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupsImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupsImpl.java new file mode 100644 index 0000000000000..3cbac20b5c71a --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupsImpl.java @@ -0,0 +1,101 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_05_10.ResourceGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_05_10.ResourceGroupExportResult; +import com.microsoft.azure.management.resources.v2019_05_10.ExportTemplateRequest; +import com.microsoft.azure.management.resources.v2019_05_10.ResourceGroup; + +class ResourceGroupsImpl extends WrapperImpl implements ResourceGroups { + private final ResourcesManager manager; + + ResourceGroupsImpl(ResourcesManager manager) { + super(manager.inner().resourceGroups()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public ResourceGroupImpl define(String name) { + return wrapModel(name); + } + + private ResourceGroupImpl wrapModel(ResourceGroupInner inner) { + return new ResourceGroupImpl(inner, manager()); + } + + private ResourceGroupImpl wrapModel(String name) { + return new ResourceGroupImpl(name, this.manager()); + } + + @Override + public Observable checkExistenceAsync(String resourceGroupName) { + ResourceGroupsInner client = this.inner(); + return client.checkExistenceAsync(resourceGroupName) + ;} + + @Override + public Observable exportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters) { + ResourceGroupsInner client = this.inner(); + return client.exportTemplateAsync(resourceGroupName, parameters) + .map(new Func1() { + @Override + public ResourceGroupExportResult call(ResourceGroupExportResultInner inner) { + return new ResourceGroupExportResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + ResourceGroupsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ResourceGroup call(ResourceGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName) { + ResourceGroupsInner client = this.inner(); + return client.getAsync(resourceGroupName) + .map(new Func1() { + @Override + public ResourceGroup call(ResourceGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName) { + ResourceGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName).toCompletable(); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupsInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupsInner.java new file mode 100644 index 0000000000000..492c56d47b39f --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceGroupsInner.java @@ -0,0 +1,1010 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.resources.v2019_05_10.ExportTemplateRequest; +import com.microsoft.azure.management.resources.v2019_05_10.ResourceGroupPatchable; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ResourceGroups. + */ +public class ResourceGroupsInner { + /** The Retrofit service to perform REST calls. */ + private ResourceGroupsService service; + /** The service client containing this operation class. */ + private ResourceManagementClientImpl client; + + /** + * Initializes an instance of ResourceGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ResourceGroupsInner(Retrofit retrofit, ResourceManagementClientImpl client) { + this.service = retrofit.create(ResourceGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ResourceGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface ResourceGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.ResourceGroups checkExistence" }) + @HEAD("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + Observable> checkExistence(@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.resources.v2019_05_10.ResourceGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourceGroupInner 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.resources.v2019_05_10.ResourceGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@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.resources.v2019_05_10.ResourceGroups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.resources.v2019_05_10.ResourceGroups get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + Observable> get(@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.resources.v2019_05_10.ResourceGroups update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourceGroupPatchable 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.resources.v2019_05_10.ResourceGroups exportTemplate" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate") + Observable> exportTemplate(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ExportTemplateRequest 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.resources.v2019_05_10.ResourceGroups list" }) + @GET("subscriptions/{subscriptionId}/resourcegroups") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @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.resources.v2019_05_10.ResourceGroups listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + public boolean checkExistence(String resourceGroupName) { + return checkExistenceWithServiceResponseAsync(resourceGroupName).toBlocking().single().body(); + } + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @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 checkExistenceAsync(String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkExistenceWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkExistenceAsync(String resourceGroupName) { + return checkExistenceWithServiceResponseAsync(resourceGroupName).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether a resource group exists. + * + * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkExistenceWithServiceResponseAsync(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.checkExistence(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 clientResponse = checkExistenceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkExistenceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters. + * @param parameters Parameters supplied to the create or update a resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceGroupInner object if successful. + */ + public ResourceGroupInner createOrUpdate(String resourceGroupName, ResourceGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters. + * @param parameters Parameters supplied to the create or update a 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 createOrUpdateAsync(String resourceGroupName, ResourceGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters. + * @param parameters Parameters supplied to the create or update a resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, ResourceGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, parameters).map(new Func1, ResourceGroupInner>() { + @Override + public ResourceGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a resource group. + * + * @param resourceGroupName The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters. + * @param parameters Parameters supplied to the create or update a resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, ResourceGroupInner parameters) { + 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 (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.createOrUpdate(resourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName) { + deleteWithServiceResponseAsync(resourceGroupName).toBlocking().last().body(); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @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, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(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."); + } + Observable> observable = service.delete(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName) { + beginDeleteWithServiceResponseAsync(resourceGroupName).toBlocking().single().body(); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @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, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a resource group. + * When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. + * + * @param resourceGroupName The name of the resource group to delete. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(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.beginDelete(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 clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceGroupInner object if successful. + */ + public ResourceGroupInner get(String resourceGroupName) { + return getWithServiceResponseAsync(resourceGroupName).toBlocking().single().body(); + } + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupInner object + */ + public Observable getAsync(String resourceGroupName) { + return getWithServiceResponseAsync(resourceGroupName).map(new Func1, ResourceGroupInner>() { + @Override + public ResourceGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupInner object + */ + public Observable> getWithServiceResponseAsync(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.get(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 clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a resource group. + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceGroupInner object if successful. + */ + public ResourceGroupInner update(String resourceGroupName, ResourceGroupPatchable parameters) { + return updateWithServiceResponseAsync(resourceGroupName, parameters).toBlocking().single().body(); + } + + /** + * Updates a resource group. + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a 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 updateAsync(String resourceGroupName, ResourceGroupPatchable parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, parameters), serviceCallback); + } + + /** + * Updates a resource group. + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupInner object + */ + public Observable updateAsync(String resourceGroupName, ResourceGroupPatchable parameters) { + return updateWithServiceResponseAsync(resourceGroupName, parameters).map(new Func1, ResourceGroupInner>() { + @Override + public ResourceGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a resource group. + * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained. + * + * @param resourceGroupName The name of the resource group to update. The name is case insensitive. + * @param parameters Parameters supplied to update a resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, ResourceGroupPatchable parameters) { + 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 (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.update(resourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group to export as a template. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceGroupExportResultInner object if successful. + */ + public ResourceGroupExportResultInner exportTemplate(String resourceGroupName, ExportTemplateRequest parameters) { + return exportTemplateWithServiceResponseAsync(resourceGroupName, parameters).toBlocking().single().body(); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group to export as a template. + * @param parameters Parameters for exporting the 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 exportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportTemplateWithServiceResponseAsync(resourceGroupName, parameters), serviceCallback); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group to export as a template. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupExportResultInner object + */ + public Observable exportTemplateAsync(String resourceGroupName, ExportTemplateRequest parameters) { + return exportTemplateWithServiceResponseAsync(resourceGroupName, parameters).map(new Func1, ResourceGroupExportResultInner>() { + @Override + public ResourceGroupExportResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Captures the specified resource group as a template. + * + * @param resourceGroupName The name of the resource group to export as a template. + * @param parameters Parameters for exporting the template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceGroupExportResultInner object + */ + public Observable> exportTemplateWithServiceResponseAsync(String resourceGroupName, ExportTemplateRequest parameters) { + 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 (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.exportTemplate(resourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = exportTemplateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportTemplateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all the resource groups for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ResourceGroupInner> 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 all the resource groups for a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the resource groups for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceGroupInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the resource groups for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceGroupInner> 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 all the resource groups for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceGroupInner> 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."); + } + final String filter = null; + final Integer top = null; + return service.list(this.client.subscriptionId(), filter, top, 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); + } + } + }); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1' + * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ResourceGroupInner> object if successful. + */ + public PagedList list(final String filter, final Integer top) { + ServiceResponse> response = listSinglePageAsync(filter, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1' + * @param top The number of results to return. If null is passed, returns all resource groups. + * @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 String filter, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1' + * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceGroupInner> object + */ + public Observable> listAsync(final String filter, final Integer top) { + return listWithServiceResponseAsync(filter, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1' + * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceGroupInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter, final Integer top) { + return listSinglePageAsync(filter, top) + .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 all the resource groups for a subscription. + * + ServiceResponse> * @param filter The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1' + ServiceResponse> * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter, final Integer top) { + 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(), filter, top, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ResourceGroupInner> 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 all the resource groups for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceGroupInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the resource groups for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceGroupInner> 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 all the resource groups for a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceGroupInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceManagementClientImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceManagementClientImpl.java new file mode 100644 index 0000000000000..0a35faebfcaf2 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourceManagementClientImpl.java @@ -0,0 +1,280 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ResourceManagementClientImpl class. + */ +public class ResourceManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The ID of the target subscription. */ + private String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ResourceManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for this operation. */ + private String apiVersion; + + /** + * Gets The API version to use for this operation. + * + * @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 ResourceManagementClientImpl 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 ResourceManagementClientImpl 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 ResourceManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * 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; + } + + /** + * The DeploymentsInner object to access its operations. + */ + private DeploymentsInner deployments; + + /** + * Gets the DeploymentsInner object to access its operations. + * @return the DeploymentsInner object. + */ + public DeploymentsInner deployments() { + return this.deployments; + } + + /** + * The ProvidersInner object to access its operations. + */ + private ProvidersInner providers; + + /** + * Gets the ProvidersInner object to access its operations. + * @return the ProvidersInner object. + */ + public ProvidersInner providers() { + return this.providers; + } + + /** + * The ResourcesInner object to access its operations. + */ + private ResourcesInner resources; + + /** + * Gets the ResourcesInner object to access its operations. + * @return the ResourcesInner object. + */ + public ResourcesInner resources() { + return this.resources; + } + + /** + * The ResourceGroupsInner object to access its operations. + */ + private ResourceGroupsInner resourceGroups; + + /** + * Gets the ResourceGroupsInner object to access its operations. + * @return the ResourceGroupsInner object. + */ + public ResourceGroupsInner resourceGroups() { + return this.resourceGroups; + } + + /** + * The TagsInner object to access its operations. + */ + private TagsInner tags; + + /** + * Gets the TagsInner object to access its operations. + * @return the TagsInner object. + */ + public TagsInner tags() { + return this.tags; + } + + /** + * The DeploymentOperationsInner object to access its operations. + */ + private DeploymentOperationsInner deploymentOperations; + + /** + * Gets the DeploymentOperationsInner object to access its operations. + * @return the DeploymentOperationsInner object. + */ + public DeploymentOperationsInner deploymentOperations() { + return this.deploymentOperations; + } + + /** + * Initializes an instance of ResourceManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public ResourceManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of ResourceManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public ResourceManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of ResourceManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public ResourceManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2019-05-10"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.deployments = new DeploymentsInner(restClient().retrofit(), this); + this.providers = new ProvidersInner(restClient().retrofit(), this); + this.resources = new ResourcesInner(restClient().retrofit(), this); + this.resourceGroups = new ResourceGroupsInner(restClient().retrofit(), this); + this.tags = new TagsInner(restClient().retrofit(), this); + this.deploymentOperations = new DeploymentOperationsInner(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(), "ResourceManagementClient", "2019-05-10"); + } +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourcesImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourcesImpl.java new file mode 100644 index 0000000000000..496b90aa03f2b --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourcesImpl.java @@ -0,0 +1,181 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_05_10.Resources; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.resources.v2019_05_10.GenericResource; +import com.microsoft.azure.management.resources.v2019_05_10.ResourcesMoveInfo; + +class ResourcesImpl extends WrapperImpl implements Resources { + private final ResourcesManager manager; + + ResourcesImpl(ResourcesManager manager) { + super(manager.inner().resources()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + private GenericResourceImpl wrapModel(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + + @Override + public Observable listAsync() { + ResourcesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable checkExistenceByIdAsync(String resourceId, String apiVersion) { + ResourcesInner client = this.inner(); + return client.checkExistenceByIdAsync(resourceId, apiVersion) + ;} + + @Override + public Completable deleteByIdAsync(String resourceId, String apiVersion) { + ResourcesInner client = this.inner(); + return client.deleteByIdAsync(resourceId, apiVersion).toCompletable(); + } + + @Override + public Observable createOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + ResourcesInner client = this.inner(); + return client.createOrUpdateByIdAsync(resourceId, apiVersion, parameters) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + ResourcesInner client = this.inner(); + return client.updateByIdAsync(resourceId, apiVersion, parameters) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByIdAsync(String resourceId, String apiVersion) { + ResourcesInner client = this.inner(); + return client.getByIdAsync(resourceId, apiVersion) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupAsync(final String resourceGroupName) { + ResourcesInner 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 GenericResource call(GenericResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable moveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + ResourcesInner client = this.inner(); + return client.moveResourcesAsync(sourceResourceGroupName, parameters).toCompletable(); + } + + @Override + public Completable validateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + ResourcesInner client = this.inner(); + return client.validateMoveResourcesAsync(sourceResourceGroupName, parameters).toCompletable(); + } + + @Override + public Observable checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + ResourcesInner client = this.inner(); + return client.checkExistenceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion) + ;} + + @Override + public Completable deleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + ResourcesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).toCompletable(); + } + + @Override + public Observable createOrUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + ResourcesInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + ResourcesInner client = this.inner(); + return client.updateAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + ResourcesInner client = this.inner(); + return client.getAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion) + .map(new Func1() { + @Override + public GenericResource call(GenericResourceInner inner) { + return new GenericResourceImpl(inner, manager()); + } + }); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourcesInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourcesInner.java new file mode 100644 index 0000000000000..b0bdd79afe6c4 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourcesInner.java @@ -0,0 +1,2682 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +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.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.resources.v2019_05_10.ResourcesMoveInfo; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.HEAD; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Resources. + */ +public class ResourcesInner implements InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ResourcesService service; + /** The service client containing this operation class. */ + private ResourceManagementClientImpl client; + + /** + * Initializes an instance of ResourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ResourcesInner(Retrofit retrofit, ResourceManagementClientImpl client) { + this.service = retrofit.create(ResourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Resources to be + * used by Retrofit to perform actually REST calls. + */ + interface ResourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.Resources listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$expand") String expand, @Query("$top") Integer top, @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.resources.v2019_05_10.Resources moveResources" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources") + Observable> moveResources(@Path("sourceResourceGroupName") String sourceResourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourcesMoveInfo 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.resources.v2019_05_10.Resources beginMoveResources" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources") + Observable> beginMoveResources(@Path("sourceResourceGroupName") String sourceResourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourcesMoveInfo 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.resources.v2019_05_10.Resources validateMoveResources" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources") + Observable> validateMoveResources(@Path("sourceResourceGroupName") String sourceResourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourcesMoveInfo 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.resources.v2019_05_10.Resources beginValidateMoveResources" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources") + Observable> beginValidateMoveResources(@Path("sourceResourceGroupName") String sourceResourceGroupName, @Path("subscriptionId") String subscriptionId, @Body ResourcesMoveInfo 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.resources.v2019_05_10.Resources list" }) + @GET("subscriptions/{subscriptionId}/resources") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$expand") String expand, @Query("$top") Integer top, @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.resources.v2019_05_10.Resources checkExistence" }) + @HEAD("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}") + Observable> checkExistence(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @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.resources.v2019_05_10.Resources delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @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.resources.v2019_05_10.Resources beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @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.resources.v2019_05_10.Resources createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.Resources beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.Resources update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.Resources beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.Resources get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @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.resources.v2019_05_10.Resources checkExistenceById" }) + @HEAD("{resourceId}") + Observable> checkExistenceById(@Path(value = "resourceId", encoded = true) String resourceId, @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.resources.v2019_05_10.Resources deleteById" }) + @HTTP(path = "{resourceId}", method = "DELETE", hasBody = true) + Observable> deleteById(@Path(value = "resourceId", encoded = true) String resourceId, @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.resources.v2019_05_10.Resources beginDeleteById" }) + @HTTP(path = "{resourceId}", method = "DELETE", hasBody = true) + Observable> beginDeleteById(@Path(value = "resourceId", encoded = true) String resourceId, @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.resources.v2019_05_10.Resources createOrUpdateById" }) + @PUT("{resourceId}") + Observable> createOrUpdateById(@Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.Resources beginCreateOrUpdateById" }) + @PUT("{resourceId}") + Observable> beginCreateOrUpdateById(@Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.Resources updateById" }) + @PATCH("{resourceId}") + Observable> updateById(@Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.Resources beginUpdateById" }) + @PATCH("{resourceId}") + Observable> beginUpdateById(@Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Body GenericResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.Resources getById" }) + @GET("{resourceId}") + Observable> getById(@Path(value = "resourceId", encoded = true) String resourceId, @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.resources.v2019_05_10.Resources 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.resources.v2019_05_10.Resources listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<GenericResourceInner> 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(); + } + }; + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @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); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> 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)); + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> 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."); + } + final String filter = null; + final String expand = null; + final Integer top = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, expand, top, 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); + } + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<GenericResourceInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String filter, final String expand, final Integer top) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resources. + * @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 String filter, final String expand, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter, expand, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param resourceGroupName The resource group with the resources to get. + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { + return listByResourceGroupSinglePageAsync(resourceGroupName, filter, expand, top) + .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)); + } + }); + } + + /** + * Get all the resources for a resource group. + * + ServiceResponse> * @param resourceGroupName The resource group with the resources to get. + ServiceResponse> * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + ServiceResponse> * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + ServiceResponse> * @param top The number of results to return. If null is passed, returns all resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) { + 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(), filter, expand, top, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + moveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().last().body(); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @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 moveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(moveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters), serviceCallback); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable moveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + return moveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> moveResourcesWithServiceResponseAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + if (sourceResourceGroupName == null) { + throw new IllegalArgumentException("Parameter sourceResourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.moveResources(sourceResourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginMoveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + beginMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().single().body(); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @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 beginMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters), serviceCallback); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + return beginMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Moves resources from one resource group to another resource group. + * The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginMoveResourcesWithServiceResponseAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + if (sourceResourceGroupName == null) { + throw new IllegalArgumentException("Parameter sourceResourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginMoveResources(sourceResourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginMoveResourcesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginMoveResourcesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void validateMoveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + validateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().last().body(); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @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 validateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters), serviceCallback); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable validateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + return validateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> validateMoveResourcesWithServiceResponseAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + if (sourceResourceGroupName == null) { + throw new IllegalArgumentException("Parameter sourceResourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.validateMoveResources(sourceResourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginValidateMoveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + beginValidateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().single().body(); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @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 beginValidateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginValidateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters), serviceCallback); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginValidateMoveResourcesAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + return beginValidateMoveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates whether resources can be moved from one resource group to another resource group. + * This operation checks whether the specified resources can be moved to the target. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation. + * + * @param sourceResourceGroupName The name of the resource group containing the resources to validate for move. + * @param parameters Parameters for moving resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginValidateMoveResourcesWithServiceResponseAsync(String sourceResourceGroupName, ResourcesMoveInfo parameters) { + if (sourceResourceGroupName == null) { + throw new IllegalArgumentException("Parameter sourceResourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginValidateMoveResources(sourceResourceGroupName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginValidateMoveResourcesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginValidateMoveResourcesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .register(409, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get all the resources in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<GenericResourceInner> 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(); + } + }; + } + + /** + * Get all the resources in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the resources in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> 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)); + } + }); + } + + /** + * Get all the resources in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> 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."); + } + final String filter = null; + final String expand = null; + final Integer top = null; + return service.list(this.client.subscriptionId(), filter, expand, top, 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); + } + } + }); + } + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<GenericResourceInner> object if successful. + */ + public PagedList list(final String filter, final String expand, final Integer top) { + ServiceResponse> response = listSinglePageAsync(filter, expand, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resource groups. + * @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 String filter, final String expand, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter, expand, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listAsync(final String filter, final String expand, final Integer top) { + return listWithServiceResponseAsync(filter, expand, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources in a subscription. + * + * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter, final String expand, final Integer top) { + return listSinglePageAsync(filter, expand, top) + .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)); + } + }); + } + + /** + * Get all the resources in a subscription. + * + ServiceResponse> * @param filter The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. + ServiceResponse> * @param expand The $expand query parameter. You can expand createdTime and changedTime. For example, to expand both properties, use $expand=changedTime,createdTime + ServiceResponse> * @param top The number of results to return. If null is passed, returns all resource groups. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter, final String expand, final Integer top) { + 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(), filter, expand, top, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + public boolean checkExistence(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + return checkExistenceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).toBlocking().single().body(); + } + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the 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 checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkExistenceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion), serviceCallback); + } + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + return checkExistenceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether a resource exists. + * + * @param resourceGroupName The name of the resource group containing the resource to check. The name is case insensitive. + * @param resourceProviderNamespace The resource provider of the resource to check. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to check whether it exists. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkExistenceWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + return service.checkExistence(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkExistenceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkExistenceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + deleteWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).toBlocking().last().body(); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the 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 deleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion), serviceCallback); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + return deleteWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + beginDeleteWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).toBlocking().single().body(); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the 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 beginDeleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion), serviceCallback); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a resource. + * + * @param resourceGroupName The name of the resource group that contains the resource to delete. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type. + * @param resourceName The name of the resource to delete. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GenericResourceInner object if successful. + */ + public GenericResourceInner createOrUpdate(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).toBlocking().last().body(); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters), serviceCallback); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GenericResourceInner object if successful. + */ + public GenericResourceInner beginCreateOrUpdate(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).toBlocking().single().body(); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters), serviceCallback); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to create. + * @param resourceName The name of the resource to create. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for creating or updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GenericResourceInner object if successful. + */ + public GenericResourceInner update(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).toBlocking().last().body(); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters), serviceCallback); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.update(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GenericResourceInner object if successful. + */ + public GenericResourceInner beginUpdate(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).toBlocking().single().body(); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters), serviceCallback); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a resource. + * + * @param resourceGroupName The name of the resource group for the resource. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource to update. + * @param resourceName The name of the resource to update. + * @param apiVersion The API version to use for the operation. + * @param parameters Parameters for updating the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GenericResourceInner object if successful. + */ + public GenericResourceInner get(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + return getWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).toBlocking().single().body(); + } + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the 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 getAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion), serviceCallback); + } + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable getAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + return getWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a resource. + * + * @param resourceGroupName The name of the resource group containing the resource to get. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get. + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName 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 (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + return service.get(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + public boolean checkExistenceById(String resourceId, String apiVersion) { + return checkExistenceByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().single().body(); + } + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the 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 checkExistenceByIdAsync(String resourceId, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkExistenceByIdWithServiceResponseAsync(resourceId, apiVersion), serviceCallback); + } + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkExistenceByIdAsync(String resourceId, String apiVersion) { + return checkExistenceByIdWithServiceResponseAsync(resourceId, apiVersion).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks by ID whether a resource exists. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkExistenceByIdWithServiceResponseAsync(String resourceId, String apiVersion) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + return service.checkExistenceById(resourceId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkExistenceByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkExistenceByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteById(String resourceId, String apiVersion) { + deleteByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().last().body(); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the 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 deleteByIdAsync(String resourceId, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByIdWithServiceResponseAsync(resourceId, apiVersion), serviceCallback); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteByIdAsync(String resourceId, String apiVersion) { + return deleteByIdWithServiceResponseAsync(resourceId, apiVersion).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteByIdWithServiceResponseAsync(String resourceId, String apiVersion) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + Observable> observable = service.deleteById(resourceId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDeleteById(String resourceId, String apiVersion) { + beginDeleteByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().single().body(); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the 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 beginDeleteByIdAsync(String resourceId, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteByIdWithServiceResponseAsync(resourceId, apiVersion), serviceCallback); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteByIdAsync(String resourceId, String apiVersion) { + return beginDeleteByIdWithServiceResponseAsync(resourceId, apiVersion).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteByIdWithServiceResponseAsync(String resourceId, String apiVersion) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + return service.beginDeleteById(resourceId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GenericResourceInner object if successful. + */ + public GenericResourceInner createOrUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) { + return createOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().last().body(); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters), serviceCallback); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + return createOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateByIdWithServiceResponseAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdateById(resourceId, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GenericResourceInner object if successful. + */ + public GenericResourceInner beginCreateOrUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) { + return beginCreateOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().single().body(); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters), serviceCallback); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable beginCreateOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + return beginCreateOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Create or update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable> beginCreateOrUpdateByIdWithServiceResponseAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdateById(resourceId, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GenericResourceInner object if successful. + */ + public GenericResourceInner updateById(String resourceId, String apiVersion, GenericResourceInner parameters) { + return updateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().last().body(); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters), serviceCallback); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + return updateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateByIdWithServiceResponseAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.updateById(resourceId, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GenericResourceInner object if successful. + */ + public GenericResourceInner beginUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) { + return beginUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().single().body(); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters), serviceCallback); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable beginUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + return beginUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @param parameters Update resource parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable> beginUpdateByIdWithServiceResponseAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdateById(resourceId, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GenericResourceInner object if successful. + */ + public GenericResourceInner getById(String resourceId, String apiVersion) { + return getByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().single().body(); + } + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the 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 getByIdAsync(String resourceId, String apiVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByIdWithServiceResponseAsync(resourceId, apiVersion), serviceCallback); + } + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable getByIdAsync(String resourceId, String apiVersion) { + return getByIdWithServiceResponseAsync(resourceId, apiVersion).map(new Func1, GenericResourceInner>() { + @Override + public GenericResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a resource by ID. + * + * @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} + * @param apiVersion The API version to use for the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenericResourceInner object + */ + public Observable> getByIdWithServiceResponseAsync(String resourceId, String apiVersion) { + if (resourceId == null) { + throw new IllegalArgumentException("Parameter resourceId is required and cannot be null."); + } + if (apiVersion == null) { + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); + } + return service.getById(resourceId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get all the resources for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<GenericResourceInner> 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(); + } + }; + } + + /** + * Get all the resources for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the resources for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> 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)); + } + }); + } + + /** + * Get all the resources for a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get all the resources in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<GenericResourceInner> 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(); + } + }; + } + + /** + * Get all the resources in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all the resources in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all the resources in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GenericResourceInner> 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)); + } + }); + } + + /** + * Get all the resources in a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GenericResourceInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourcesManager.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourcesManager.java new file mode 100644 index 0000000000000..2d82888d4d0d5 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/ResourcesManager.java @@ -0,0 +1,171 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.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.resources.v2019_05_10.Operations; +import com.microsoft.azure.management.resources.v2019_05_10.Deployments; +import com.microsoft.azure.management.resources.v2019_05_10.Providers; +import com.microsoft.azure.management.resources.v2019_05_10.Resources; +import com.microsoft.azure.management.resources.v2019_05_10.ResourceGroups; +import com.microsoft.azure.management.resources.v2019_05_10.Tags; +import com.microsoft.azure.management.resources.v2019_05_10.DeploymentOperations; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Resources resource management. + */ +public final class ResourcesManager extends ManagerCore { + private Operations operations; + private Deployments deployments; + private Providers providers; + private Resources resources; + private ResourceGroups resourceGroups; + private Tags tags; + private DeploymentOperations deploymentOperations; + /** + * Get a Configurable instance that can be used to create ResourcesManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new ResourcesManager.ConfigurableImpl(); + } + /** + * Creates an instance of ResourcesManager that exposes Resources resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the ResourcesManager + */ + public static ResourcesManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new ResourcesManager(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 ResourcesManager that exposes Resources resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the ResourcesManager + */ + public static ResourcesManager authenticate(RestClient restClient, String subscriptionId) { + return new ResourcesManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of ResourcesManager that exposes Resources management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Resources management API entry points that work across subscriptions + */ + ResourcesManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Deployments. + */ + public Deployments deployments() { + if (this.deployments == null) { + this.deployments = new DeploymentsImpl(this); + } + return this.deployments; + } + + /** + * @return Entry point to manage Providers. + */ + public Providers providers() { + if (this.providers == null) { + this.providers = new ProvidersImpl(this); + } + return this.providers; + } + + /** + * @return Entry point to manage Resources. + */ + public Resources resources() { + if (this.resources == null) { + this.resources = new ResourcesImpl(this); + } + return this.resources; + } + + /** + * @return Entry point to manage ResourceGroups. + */ + public ResourceGroups resourceGroups() { + if (this.resourceGroups == null) { + this.resourceGroups = new ResourceGroupsImpl(this); + } + return this.resourceGroups; + } + + /** + * @return Entry point to manage Tags. + */ + public Tags tags() { + if (this.tags == null) { + this.tags = new TagsImpl(this); + } + return this.tags; + } + + /** + * @return Entry point to manage DeploymentOperations. + */ + public DeploymentOperations deploymentOperations() { + if (this.deploymentOperations == null) { + this.deploymentOperations = new DeploymentOperationsImpl(this); + } + return this.deploymentOperations; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public ResourcesManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return ResourcesManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private ResourcesManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new ResourceManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagDetailsImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagDetailsImpl.java new file mode 100644 index 0000000000000..0f422b4ec6829 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagDetailsImpl.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.TagDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_05_10.TagCount; +import java.util.ArrayList; +import com.microsoft.azure.management.resources.v2019_05_10.TagValue; +import java.util.List; + +class TagDetailsImpl extends WrapperImpl implements TagDetails { + private final ResourcesManager manager; + + TagDetailsImpl(TagDetailsInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + + + @Override + public TagCount count() { + return this.inner().count(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String tagName() { + return this.inner().tagName(); + } + + @Override + public List values() { + List lst = new ArrayList(); + if (this.inner().values() != null) { + for (TagValueInner inner : this.inner().values()) { + lst.add( new TagValueImpl(inner, manager())); + } + } + return lst; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagDetailsInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagDetailsInner.java new file mode 100644 index 0000000000000..eb908eb205078 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagDetailsInner.java @@ -0,0 +1,113 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.TagCount; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Tag details. + */ +public class TagDetailsInner { + /** + * The tag ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The tag name. + */ + @JsonProperty(value = "tagName") + private String tagName; + + /** + * The total number of resources that use the resource tag. When a tag is + * initially created and has no associated resources, the value is 0. + */ + @JsonProperty(value = "count") + private TagCount count; + + /** + * The list of tag values. + */ + @JsonProperty(value = "values") + private List values; + + /** + * Get the tag ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the tag name. + * + * @return the tagName value + */ + public String tagName() { + return this.tagName; + } + + /** + * Set the tag name. + * + * @param tagName the tagName value to set + * @return the TagDetailsInner object itself. + */ + public TagDetailsInner withTagName(String tagName) { + this.tagName = tagName; + return this; + } + + /** + * Get the total number of resources that use the resource tag. When a tag is initially created and has no associated resources, the value is 0. + * + * @return the count value + */ + public TagCount count() { + return this.count; + } + + /** + * Set the total number of resources that use the resource tag. When a tag is initially created and has no associated resources, the value is 0. + * + * @param count the count value to set + * @return the TagDetailsInner object itself. + */ + public TagDetailsInner withCount(TagCount count) { + this.count = count; + return this; + } + + /** + * Get the list of tag values. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set the list of tag values. + * + * @param values the values value to set + * @return the TagDetailsInner object itself. + */ + public TagDetailsInner withValues(List values) { + this.values = values; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagValueImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagValueImpl.java new file mode 100644 index 0000000000000..06b686a5dec14 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagValueImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.TagValue; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_05_10.TagCount; + +class TagValueImpl extends WrapperImpl implements TagValue { + private final ResourcesManager manager; + TagValueImpl(TagValueInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public TagCount count() { + return this.inner().count(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String tagValue() { + return this.inner().tagValue(); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagValueInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagValueInner.java new file mode 100644 index 0000000000000..592626b941925 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagValueInner.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import com.microsoft.azure.management.resources.v2019_05_10.TagCount; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Tag information. + */ +public class TagValueInner { + /** + * The tag ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The tag value. + */ + @JsonProperty(value = "tagValue") + private String tagValue; + + /** + * The tag value count. + */ + @JsonProperty(value = "count") + private TagCount count; + + /** + * Get the tag ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the tag value. + * + * @return the tagValue value + */ + public String tagValue() { + return this.tagValue; + } + + /** + * Set the tag value. + * + * @param tagValue the tagValue value to set + * @return the TagValueInner object itself. + */ + public TagValueInner withTagValue(String tagValue) { + this.tagValue = tagValue; + return this; + } + + /** + * Get the tag value count. + * + * @return the count value + */ + public TagCount count() { + return this.count; + } + + /** + * Set the tag value count. + * + * @param count the count value to set + * @return the TagValueInner object itself. + */ + public TagValueInner withCount(TagCount count) { + this.count = count; + return this; + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagsImpl.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagsImpl.java new file mode 100644 index 0000000000000..471ce867bf236 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagsImpl.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.resources.v2019_05_10.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_05_10.Tags; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_05_10.TagDetails; +import rx.Completable; +import com.microsoft.azure.management.resources.v2019_05_10.TagValue; + +class TagsImpl extends WrapperImpl implements Tags { + private final ResourcesManager manager; + + TagsImpl(ResourcesManager manager) { + super(manager.inner().tags()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + private TagDetailsImpl wrapTagDetailsModel(TagDetailsInner inner) { + return new TagDetailsImpl(inner, manager()); + } + + @Override + public Observable listAsync() { + TagsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TagDetails call(TagDetailsInner inner) { + return wrapTagDetailsModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String tagName) { + TagsInner client = this.inner(); + return client.deleteAsync(tagName).toCompletable(); + } + + @Override + public Observable createOrUpdateAsync(String tagName) { + TagsInner client = this.inner(); + return client.createOrUpdateAsync(tagName) + .map(new Func1() { + @Override + public TagDetails call(TagDetailsInner inner) { + return new TagDetailsImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteValueAsync(String tagName, String tagValue) { + TagsInner client = this.inner(); + return client.deleteValueAsync(tagName, tagValue).toCompletable(); + } + + @Override + public Observable createOrUpdateValueAsync(String tagName, String tagValue) { + TagsInner client = this.inner(); + return client.createOrUpdateValueAsync(tagName, tagValue) + .map(new Func1() { + @Override + public TagValue call(TagValueInner inner) { + return new TagValueImpl(inner, manager()); + } + }); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagsInner.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagsInner.java new file mode 100644 index 0000000000000..a287d127bb5b7 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/TagsInner.java @@ -0,0 +1,646 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_05_10.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Tags. + */ +public class TagsInner { + /** The Retrofit service to perform REST calls. */ + private TagsService service; + /** The service client containing this operation class. */ + private ResourceManagementClientImpl client; + + /** + * Initializes an instance of TagsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TagsInner(Retrofit retrofit, ResourceManagementClientImpl client) { + this.service = retrofit.create(TagsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Tags to be + * used by Retrofit to perform actually REST calls. + */ + interface TagsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_05_10.Tags deleteValue" }) + @HTTP(path = "subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}", method = "DELETE", hasBody = true) + Observable> deleteValue(@Path("tagName") String tagName, @Path("tagValue") String tagValue, @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.resources.v2019_05_10.Tags createOrUpdateValue" }) + @PUT("subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}") + Observable> createOrUpdateValue(@Path("tagName") String tagName, @Path("tagValue") String tagValue, @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.resources.v2019_05_10.Tags createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/tagNames/{tagName}") + Observable> createOrUpdate(@Path("tagName") String tagName, @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.resources.v2019_05_10.Tags delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/tagNames/{tagName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("tagName") String tagName, @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.resources.v2019_05_10.Tags list" }) + @GET("subscriptions/{subscriptionId}/tagNames") + 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.resources.v2019_05_10.Tags listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteValue(String tagName, String tagValue) { + deleteValueWithServiceResponseAsync(tagName, tagValue).toBlocking().single().body(); + } + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @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 deleteValueAsync(String tagName, String tagValue, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteValueWithServiceResponseAsync(tagName, tagValue), serviceCallback); + } + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteValueAsync(String tagName, String tagValue) { + return deleteValueWithServiceResponseAsync(tagName, tagValue).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a tag value. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteValueWithServiceResponseAsync(String tagName, String tagValue) { + if (tagName == null) { + throw new IllegalArgumentException("Parameter tagName is required and cannot be null."); + } + if (tagValue == null) { + throw new IllegalArgumentException("Parameter tagValue 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.deleteValue(tagName, tagValue, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteValueDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteValueDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagValueInner object if successful. + */ + public TagValueInner createOrUpdateValue(String tagName, String tagValue) { + return createOrUpdateValueWithServiceResponseAsync(tagName, tagValue).toBlocking().single().body(); + } + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @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 createOrUpdateValueAsync(String tagName, String tagValue, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateValueWithServiceResponseAsync(tagName, tagValue), serviceCallback); + } + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagValueInner object + */ + public Observable createOrUpdateValueAsync(String tagName, String tagValue) { + return createOrUpdateValueWithServiceResponseAsync(tagName, tagValue).map(new Func1, TagValueInner>() { + @Override + public TagValueInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a tag value. The name of the tag must already exist. + * + * @param tagName The name of the tag. + * @param tagValue The value of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagValueInner object + */ + public Observable> createOrUpdateValueWithServiceResponseAsync(String tagName, String tagValue) { + if (tagName == null) { + throw new IllegalArgumentException("Parameter tagName is required and cannot be null."); + } + if (tagValue == null) { + throw new IllegalArgumentException("Parameter tagValue 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.createOrUpdateValue(tagName, tagValue, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateValueDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateValueDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagDetailsInner object if successful. + */ + public TagDetailsInner createOrUpdate(String tagName) { + return createOrUpdateWithServiceResponseAsync(tagName).toBlocking().single().body(); + } + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @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 tagName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(tagName), serviceCallback); + } + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagDetailsInner object + */ + public Observable createOrUpdateAsync(String tagName) { + return createOrUpdateWithServiceResponseAsync(tagName).map(new Func1, TagDetailsInner>() { + @Override + public TagDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a tag in the subscription. + * The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes. + * + * @param tagName The name of the tag to create. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagDetailsInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String tagName) { + if (tagName == null) { + throw new IllegalArgumentException("Parameter tagName 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.createOrUpdate(tagName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String tagName) { + deleteWithServiceResponseAsync(tagName).toBlocking().single().body(); + } + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @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 tagName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(tagName), serviceCallback); + } + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String tagName) { + return deleteWithServiceResponseAsync(tagName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a tag from the subscription. + * You must remove all values from a resource tag before you can delete it. + * + * @param tagName The name of the tag. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String tagName) { + if (tagName == null) { + throw new IllegalArgumentException("Parameter tagName 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.delete(tagName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TagDetailsInner> 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 the names and values of all resource tags that are defined in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagDetailsInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagDetailsInner> 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 the names and values of all resource tags that are defined in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagDetailsInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TagDetailsInner> 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 the names and values of all resource tags that are defined in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagDetailsInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the names and values of all resource tags that are defined in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TagDetailsInner> 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 the names and values of all resource tags that are defined in a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TagDetailsInner> 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/package-info.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/implementation/package-info.java new file mode 100644 index 0000000000000..90eb47b31593d --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/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 ResourceManagementClient. + * Provides operations for working with resources and resource groups. + */ +package com.microsoft.azure.management.resources.v2019_05_10.implementation; diff --git a/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/package-info.java b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/package-info.java new file mode 100644 index 0000000000000..229de7ca18b54 --- /dev/null +++ b/resources/resource-manager/v2019_05_10/src/main/java/com/microsoft/azure/management/resources/v2019_05_10/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 ResourceManagementClient. + * Provides operations for working with resources and resource groups. + */ +package com.microsoft.azure.management.resources.v2019_05_10;